Bolt\Tests\Extension\AssetTraitTest::testRegisterValidAssetsThemePath PHP Метод

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

    public function testRegisterValidAssetsThemePath()
    {
        $app = $this->getApp();
        $mockParams = ['root' => new Filesystem(new Local($app['resources']->getPath('root'))), 'web' => new Filesystem(new Local($app['resources']->getPath('web'))), 'app' => new Filesystem(new Local($app['resources']->getPath('app'))), 'view' => new Filesystem(new Local($app['resources']->getPath('view'))), 'default' => new Filesystem(new Local($app['resources']->getPath('files'))), 'files' => new Filesystem(new Local($app['resources']->getPath('files'))), 'config' => new Filesystem(new Local($app['resources']->getPath('config'))), 'themes' => new Filesystem(new Local($app['resources']->getPath('themebase'))), 'theme' => new Filesystem(new Local($app['resources']->getPath('themebase') . '/' . $app['config']->get('general/theme'))), 'extensions' => new Filesystem(new Local($app['resources']->getPath('extensions'))), 'cache' => new Filesystem(new Local($app['resources']->getPath('cache')))];
        $mock = $this->getMockBuilder(Manager::class)->setMethods(['has'])->setConstructorArgs([$mockParams])->getMock();
        $mock->expects($this->any())->method('has')->willReturn(true);
        $dir = $app['filesystem']->getDir('extensions://');
        $dir->setPath('local/bolt/koala');
        $ext = new AssetExtension();
        $ext->setAssets([new JavaScript('js/test.js')]);
        $ext->setContainer($app);
        $ext->setBaseDirectory($dir);
        $webDir = $app['filesystem']->getDir('extensions://');
        $ext->setWebDirectory($webDir);
        $app['filesystem'] = $mock;
        $ext->register($app);
        $fileQueue = $app['asset.queue.file']->getQueue();
        $queued = reset($fileQueue['javascript']);
        $this->assertInstanceOf('Bolt\\Asset\\File\\JavaScript', $queued);
        $this->assertSame('js/test.js', $queued->getFileName());
    }