AssetManagerTest\Service\AssetCacheManagerTest::testGetProviderWithMultipleDefinition PHP Method

testGetProviderWithMultipleDefinition() public method

    public function testGetProviderWithMultipleDefinition()
    {
        $serviceManager = new ServiceManager();
        $config = array('default' => array('cache' => 'myZf2Service'), 'my_callback.tmp' => array('cache' => function () {
            return new FilePathCache('somewhere', 'somefile');
        }), 'my_provided_class.tmp' => array('cache' => FilePathCache::class, 'options' => array('dir' => 'somewhere')), 'my_bc_check.tmp' => array('cache' => 'Apc'));
        $serviceManager->setFactory('myZf2Service', function () {
            return new FilePathCache('somewhere', 'somfile');
        });
        $assetManager = new AssetCacheManager($serviceManager, $config);
        $reflectionMethod = new \ReflectionMethod(AssetCacheManager::class, 'getProvider');
        $reflectionMethod->setAccessible(true);
        $provider = $reflectionMethod->invoke($assetManager, 'no/path');
        $this->assertTrue($provider instanceof FilePathCache);
        $provider = $reflectionMethod->invoke($assetManager, 'my_callback.tmp');
        $this->assertTrue($provider instanceof FilePathCache);
        $provider = $reflectionMethod->invoke($assetManager, 'my_provided_class.tmp');
        $this->assertTrue($provider instanceof FilePathCache);
        $provider = $reflectionMethod->invoke($assetManager, 'my_bc_check.tmp');
        $this->assertTrue($provider instanceof ApcCache);
    }