subject = new AssetTreeBuilder(); } public function testBuildWithAccessControlEnabled(): void { $data = [ 'children' => [ [ 'parent' => 'parent', ], [ 'url' => 'something' ] ], ]; $search = $this->createMock(DirectorySearchQuery::class); $mediaAsset = $this->createMock(MediaAsset::class); $mediaSource = $this->createMock(MediaSource::class); $search->method('getAsset') ->willReturn($mediaAsset); $mediaAsset->method('getMediaSource') ->willReturn($mediaSource); $mediaSource->method('getDirectories') ->willReturn($data); $mediaSource->expects($this->once()) ->method('enableAccessControl'); $expectedData = [ 'children' => [ [ 'url' => tao_helpers_Uri::getRootUrl() . 'taoItems/ItemContent/files?uri=&lang=&1=parent', ], [ 'url' => 'something' ] ], ]; $this->assertEquals( $expectedData, $this->subject->build($search) ); } }