AssetManagerTest\Service\CollectionsResolverTest::testSuccessResolve PHP Метод

testSuccessResolve() публичный Метод

public testSuccessResolve ( )
    public function testSuccessResolve()
    {
        $callbackInvocationCount = 0;
        $callback = function () use(&$callbackInvocationCount) {
            $asset1 = new Asset\StringAsset('bacon');
            $asset2 = new Asset\StringAsset('eggs');
            $asset3 = new Asset\StringAsset('Mud');
            $asset1->mimetype = 'text/plain';
            $asset2->mimetype = 'text/plain';
            $asset3->mimetype = 'text/plain';
            $callbackInvocationCount += 1;
            $assetName = "asset{$callbackInvocationCount}";
            return ${$assetName};
        };
        $aggregateResolver = $this->getMock(ResolverInterface::class);
        $aggregateResolver->expects($this->exactly(3))->method('resolve')->will($this->returnCallback($callback));
        $resolver = new CollectionResolver(array('myCollection' => array('bacon', 'eggs', 'mud')));
        $mimeResolver = new MimeResolver();
        $assetFilterManager = new AssetFilterManager();
        $assetFilterManager->setMimeResolver($mimeResolver);
        $resolver->setAggregateResolver($aggregateResolver);
        $resolver->setAssetFilterManager($assetFilterManager);
        $collectionResolved = $resolver->resolve('myCollection');
        $this->assertEquals($collectionResolved->mimetype, 'text/plain');
        $this->assertTrue($collectionResolved instanceof Asset\AssetCollection);
    }