Example #1
0
 public function dumpAssets($environment)
 {
     if ($this->output) {
         $this->output->writeln('Dumping translations...');
     }
     $translationDumpCommand = new TranslationDumpCommand();
     $translationDumpCommand->setContainer($this->container);
     $translationDumpCommand->run(new ArrayInput(array()), $this->output ?: new NullOutput());
     if ($this->output) {
         $this->output->writeln('Compiling javascripts...');
     }
     $assetDumpCmd = new DumpCommand();
     $assetDumpCmd->setContainer($this->container);
     $assetDumpCmd->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'Env', $environment));
     $assetDumpCmd->run(new ArrayInput(array()), $this->output ?: new NullOutput());
 }
Example #2
0
 public function testDumpDebug()
 {
     $asset = $this->getMock('Assetic\\Asset\\AssetCollection');
     $leaf = $this->getMock('Assetic\\Asset\\AssetInterface');
     $this->am->expects($this->once())->method('getNames')->will($this->returnValue(array('test_asset')));
     $this->am->expects($this->once())->method('get')->with('test_asset')->will($this->returnValue($asset));
     $this->am->expects($this->once())->method('hasFormula')->with('test_asset')->will($this->returnValue(true));
     $this->am->expects($this->once())->method('getFormula')->with('test_asset')->will($this->returnValue(array()));
     $this->am->expects($this->exactly(2))->method('isDebug')->will($this->returnValue(true));
     $asset->expects($this->once())->method('getTargetPath')->will($this->returnValue('test_asset.css'));
     $asset->expects($this->once())->method('dump')->will($this->returnValue('/* test_asset */'));
     $asset->expects($this->once())->method('getIterator')->will($this->returnValue(new \ArrayIterator(array($leaf))));
     $asset->expects($this->any())->method('getVars')->will($this->returnValue(array()));
     $asset->expects($this->any())->method('getValues')->will($this->returnValue(array()));
     $leaf->expects($this->once())->method('getTargetPath')->will($this->returnValue('test_leaf.css'));
     $leaf->expects($this->once())->method('dump')->will($this->returnValue('/* test_leaf */'));
     $leaf->expects($this->any())->method('getVars')->will($this->returnValue(array()));
     $leaf->expects($this->any())->method('getValues')->will($this->returnValue(array()));
     $this->command->run(new ArrayInput(array()), new NullOutput());
     $this->assertFileExists($this->writeTo . '/test_asset.css');
     $this->assertFileExists($this->writeTo . '/test_leaf.css');
     $this->assertEquals('/* test_asset */', file_get_contents($this->writeTo . '/test_asset.css'));
     $this->assertEquals('/* test_leaf */', file_get_contents($this->writeTo . '/test_leaf.css'));
 }