AssetManagerTest\View\Helper\AssetTest::testInvoke PHP Method

testInvoke() public method

public testInvoke ( )
    public function testInvoke()
    {
        $configWithCache = array('view_helper' => array('append_timestamp' => true, 'query_string' => '_', 'cache' => null), 'caching' => array('default' => array('cache' => FilePathCache::class, 'options' => array('dir' => 'public/assets'))));
        $configWithoutCache = array('view_helper' => array('append_timestamp' => true, 'query_string' => '_', 'cache' => null));
        $filename = 'porn-food/bac.on';
        $resolver = $this->getGenericResolver();
        $resolver->setMap(array('porn-food/bac.on' => __FILE__));
        $helperWithCache = new Asset($resolver, null, $configWithCache);
        $newFilenameWithCache = $helperWithCache->__invoke($filename);
        // with cache file should have a timestamp query param
        $this->assertContains('?_=', $newFilenameWithCache);
        $helperWithoutCache = new Asset($resolver, null, $configWithoutCache);
        $newFilenameWithoutCache = $helperWithoutCache->__invoke($filename);
        // without cache file should have a timestamp query param
        $this->assertContains('?_=', $newFilenameWithoutCache);
        // without cache the timestamp query param should be different than with cache
        $this->assertNotSame($newFilenameWithCache, $newFilenameWithoutCache);
    }