@@ -84,8 +84,8 @@ protected function setUp(): void {
8484 $ userFolder = $ this ->userFolder ;
8585
8686 $ closure = function ($ name ) use ($ userFolder ) {
87- $ nodes = $ userFolder ->getById (intval ($ name ));
88- return ! empty ( $ nodes ) ;
87+ $ node = $ userFolder ->getFirstNodeById (intval ($ name ));
88+ return $ node !== null ;
8989 };
9090
9191 $ this ->node = new \OCA \DAV \SystemTag \SystemTagsObjectTypeCollection (
@@ -98,14 +98,14 @@ protected function setUp(): void {
9898 );
9999 }
100100
101-
101+
102102 public function testForbiddenCreateFile (): void {
103103 $ this ->expectException (\Sabre \DAV \Exception \Forbidden::class);
104104
105105 $ this ->node ->createFile ('555 ' );
106106 }
107107
108-
108+
109109 public function testForbiddenCreateDirectory (): void {
110110 $ this ->expectException (\Sabre \DAV \Exception \Forbidden::class);
111111
@@ -114,27 +114,27 @@ public function testForbiddenCreateDirectory(): void {
114114
115115 public function testGetChild (): void {
116116 $ this ->userFolder ->expects ($ this ->once ())
117- ->method ('getById ' )
117+ ->method ('getFirstNodeById ' )
118118 ->with ('555 ' )
119- ->willReturn ([ true ] );
119+ ->willReturn ($ this -> createMock (\ OCP \ Files \Node::class) );
120120 $ childNode = $ this ->node ->getChild ('555 ' );
121121
122122 $ this ->assertInstanceOf ('\OCA\DAV\SystemTag\SystemTagsObjectMappingCollection ' , $ childNode );
123123 $ this ->assertEquals ('555 ' , $ childNode ->getName ());
124124 }
125125
126-
126+
127127 public function testGetChildWithoutAccess (): void {
128128 $ this ->expectException (\Sabre \DAV \Exception \NotFound::class);
129129
130130 $ this ->userFolder ->expects ($ this ->once ())
131- ->method ('getById ' )
131+ ->method ('getFirstNodeById ' )
132132 ->with ('555 ' )
133- ->willReturn ([] );
133+ ->willReturn (null );
134134 $ this ->node ->getChild ('555 ' );
135135 }
136136
137-
137+
138138 public function testGetChildren (): void {
139139 $ this ->expectException (\Sabre \DAV \Exception \MethodNotAllowed::class);
140140
@@ -143,28 +143,28 @@ public function testGetChildren(): void {
143143
144144 public function testChildExists (): void {
145145 $ this ->userFolder ->expects ($ this ->once ())
146- ->method ('getById ' )
146+ ->method ('getFirstNodeById ' )
147147 ->with ('123 ' )
148- ->willReturn ([ true ] );
148+ ->willReturn ($ this -> createMock (\ OCP \ Files \Node::class) );
149149 $ this ->assertTrue ($ this ->node ->childExists ('123 ' ));
150150 }
151151
152152 public function testChildExistsWithoutAccess (): void {
153153 $ this ->userFolder ->expects ($ this ->once ())
154- ->method ('getById ' )
154+ ->method ('getFirstNodeById ' )
155155 ->with ('555 ' )
156- ->willReturn ([] );
156+ ->willReturn (null );
157157 $ this ->assertFalse ($ this ->node ->childExists ('555 ' ));
158158 }
159159
160-
160+
161161 public function testDelete (): void {
162162 $ this ->expectException (\Sabre \DAV \Exception \Forbidden::class);
163163
164164 $ this ->node ->delete ();
165165 }
166166
167-
167+
168168 public function testSetName (): void {
169169 $ this ->expectException (\Sabre \DAV \Exception \Forbidden::class);
170170
0 commit comments