コード例 #1
0
 public function setUp()
 {
     $container = new Container(new LibraryCollection([new LibraryDefinition('jquery', array(new FileResource(realpath(__DIR__ . '/../Data/web/js/jquery.js')))), new LibraryDefinition('my-lib', array(new ReferenceResource('jquery'), new GlobResource(realpath(__DIR__ . '/../Data/web/lib/tipsy') . '/*'), new HttpResource('http://code.jquery.com/jquery-1.11.3.js')))]));
     $compiler = new Compiler();
     $compiler->addCompilerPass(new Compiler\CheckCircularReferencesPass(), 0)->addCompilerPass(new Compiler\ValidateLibraryDefinitionsPass(), 1)->addCompilerPass(new Compiler\ValidateResourcesPass(), 2)->addCompilerPass(new Compiler\ProcessGlobResourcesPass(), 3)->addCompilerPass(new Compiler\IncludeRemoteResourcesDynamicallyPass(), 4)->addCompilerPass(new Compiler\ResolveResourceReferencesPass(), 5)->addCompilerPass(new Compiler\CheckContainerResourcesRenderability(), 6);
     $this->container = $compiler->compile($container)->getContainer();
     $this->dumper = new PhpDumper();
 }
コード例 #2
0
 public function setUp()
 {
     $this->loader = new \Twig_Loader_Filesystem(array(realpath(__DIR__ . '/../Data/twig')));
     $this->environment = new \Twig_Environment($this->loader, array());
     $container = new Container(new LibraryCollection([new LibraryDefinition('jquery', array(new HttpResource('http://code.jquery.com/jquery-1.11.3.js'))), new LibraryDefinition('my-lib', array(new ReferenceResource('jquery'), new FileResource(realpath(__DIR__ . '/../Data/web/js/myjavascript.js')))), new LibraryDefinition('tipsy', array(new ReferenceResource('jquery'), new FileResource(realpath(__DIR__ . '/../Data/web/lib/tipsy/tipsy.js')), new FileResource(realpath(__DIR__ . '/../Data/web/lib/tipsy/tipsy.css'))))]));
     $compiler = new Compiler();
     $compiler->addCompilerPass(new Compiler\CheckCircularReferencesPass(), 0)->addCompilerPass(new Compiler\ValidateLibraryDefinitionsPass(), 1)->addCompilerPass(new Compiler\ValidateResourcesPass(), 2)->addCompilerPass(new Compiler\ProcessGlobResourcesPass(), 3)->addCompilerPass(new Compiler\ResolveResourceReferencesPass(), 5)->addCompilerPass(new Compiler\CheckContainerResourcesRenderability(), 6);
     $manager = new Manager($compiler->compile($container)->getContainer(), new SequentialRenderer(), array('web_root' => realpath(__DIR__ . '/../Data/web'), 'http_root' => 'http://www.mysite.com/'));
     $this->environment->addExtension(new AssetsInjectionExtension($manager, ['bufferize' => true]));
 }