diff --git a/UPGRADE-2.8.md b/UPGRADE-2.8.md index 655acee0de..ce8a51c261 100644 --- a/UPGRADE-2.8.md +++ b/UPGRADE-2.8.md @@ -325,8 +325,11 @@ DependencyInjection ``` -Web Development Toolbar ------------------------ +WebProfiler +----------- + +The `profiler:import` and `profiler:export` commands have been deprecated and +will be removed in 3.0. The web development toolbar has been completely redesigned. This update has introduced some changes in the HTML markup of the toolbar items. diff --git a/src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md b/src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md index 3ccdf96b86..5a319e7eff 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +2.8.0 +----- + + * deprecated profiler:import and profiler:export commands + 2.7.0 ----- diff --git a/src/Symfony/Bundle/WebProfilerBundle/Command/ExportCommand.php b/src/Symfony/Bundle/WebProfilerBundle/Command/ExportCommand.php index cf405530e2..57e201e32b 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Command/ExportCommand.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Command/ExportCommand.php @@ -20,6 +20,8 @@ use Symfony\Component\HttpKernel\Profiler\Profiler; /** * Exports a profile. * + * @deprecated since version 2.8, to be removed in 3.0. + * * @author Fabien Potencier */ class ExportCommand extends Command @@ -49,7 +51,7 @@ class ExportCommand extends Command { $this ->setName('profiler:export') - ->setDescription('Exports a profile') + ->setDescription('[DEPRECATED] Exports a profile') ->setDefinition(array( new InputArgument('token', InputArgument::REQUIRED, 'The profile token'), )) @@ -64,6 +66,10 @@ EOF protected function execute(InputInterface $input, OutputInterface $output) { + $formatter = $this->getHelper('formatter'); + + $output->writeln($formatter->formatSection('warning', 'The profiler:export command is deprecated since version 2.8 and will be removed in 3.0', 'comment')); + $token = $input->getArgument('token'); if (!$profile = $this->profiler->loadProfile($token)) { diff --git a/src/Symfony/Bundle/WebProfilerBundle/Command/ImportCommand.php b/src/Symfony/Bundle/WebProfilerBundle/Command/ImportCommand.php index 4862e9c27a..850d79c051 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Command/ImportCommand.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Command/ImportCommand.php @@ -20,6 +20,8 @@ use Symfony\Component\HttpKernel\Profiler\Profiler; /** * Imports a profile. * + * @deprecated since version 2.8, to be removed in 3.0. + * * @author Fabien Potencier */ class ImportCommand extends Command @@ -49,7 +51,7 @@ class ImportCommand extends Command { $this ->setName('profiler:import') - ->setDescription('Imports a profile') + ->setDescription('[DEPRECATED] Imports a profile') ->setDefinition(array( new InputArgument('filename', InputArgument::OPTIONAL, 'The profile path'), )) @@ -68,6 +70,10 @@ EOF protected function execute(InputInterface $input, OutputInterface $output) { + $formatter = $this->getHelper('formatter'); + + $output->writeln($formatter->formatSection('warning', 'The profiler:import command is deprecated since version 2.8 and will be removed in 3.0', 'comment')); + $data = ''; if ($input->getArgument('filename')) { $data = file_get_contents($input->getArgument('filename')); diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/Command/ExportCommandTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/Command/ExportCommandTest.php index 70267ecc9e..17564941ec 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/Command/ExportCommandTest.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/Command/ExportCommandTest.php @@ -12,6 +12,7 @@ namespace Symfony\Bundle\WebProfilerBundle\Tests\Command; use Symfony\Bundle\WebProfilerBundle\Command\ExportCommand; +use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\HttpKernel\Profiler\Profile; @@ -28,7 +29,14 @@ class ExportCommandTest extends \PHPUnit_Framework_TestCase ->getMock() ; + $helperSet = new HelperSet(); + $helper = $this->getMock('Symfony\Component\Console\Helper\FormatterHelper'); + $helper->expects($this->any())->method('formatSection'); + $helperSet->set($helper, 'formatter'); + $command = new ExportCommand($profiler); + $command->setHelperSet($helperSet); + $commandTester = new CommandTester($command); $commandTester->execute(array('token' => 'TOKEN')); } @@ -44,7 +52,14 @@ class ExportCommandTest extends \PHPUnit_Framework_TestCase $profile = new Profile('TOKEN'); $profiler->expects($this->once())->method('loadProfile')->with('TOKEN')->will($this->returnValue($profile)); + $helperSet = new HelperSet(); + $helper = $this->getMock('Symfony\Component\Console\Helper\FormatterHelper'); + $helper->expects($this->any())->method('formatSection'); + $helperSet->set($helper, 'formatter'); + $command = new ExportCommand($profiler); + $command->setHelperSet($helperSet); + $commandTester = new CommandTester($command); $commandTester->execute(array('token' => 'TOKEN')); $this->assertEquals($profiler->export($profile), $commandTester->getDisplay());