Author: Kris Wallsmith (kris@symfony.com)
Inheritance: extends Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand
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());
 }
 /**
  * {@inheritdoc}
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     // save properties
     GzipProperties::$use = $this->getContainer()->getParameter('assetic_static_gzip.use');
     GzipProperties::$level = $this->getContainer()->getParameter('assetic_static_gzip.level');
     GzipProperties::$output = $output;
     parent::initialize($input, $output);
 }
Example #3
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $styles = $this->getContainer()->get('symedit_stylizer.styles');
     $injector = $this->getContainer()->get('symedit_stylizer.injector');
     $injector->inject($styles->getVariables());
     parent::execute($input, $output);
     // Bump version
     $versionManager = $this->getContainer()->get('symedit_stylizer.version_manager');
     $versionManager->bumpVersion();
 }
Example #4
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'));
 }