8000 [HtppKernel] deprecated Profiler::import/export · symfony/symfony@943fec9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 943fec9

Browse files
committed
[HtppKernel] deprecated Profiler::import/export
1 parent 17e00b9 commit 943fec9

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

src/Symfony/Bundle/WebProfilerBundle/Tests/Command/ExportCommandTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
use Symfony\Component\Console\Tester\CommandTester;
1717
use Symfony\Component\HttpKernel\Profiler\Profile;
1818

19+
/**
20+
* @group legacy
21+
*/
1922
class ExportCommandTest extends \PHPUnit_Framework_TestCase
2023
{
2124
/**

src/Symfony/Bundle/WebProfilerBundle/Tests/Command/ImportCommandTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@
1212
namespace Symfony\Bundle\WebProfilerBundle\Tests\Command;
1313

1414
use Symfony\Bundle\WebProfilerBundle\Command\ImportCommand;
15+
use Symfony\Component\Console\Helper\HelperSet;
1516
use Symfony\Component\Console\Tester\CommandTester;
1617
use Symfony\Component\HttpKernel\Profiler\Profile;
1718

19+
/**
20+
* @group legacy
21+
*/
1822
class ImportCommandTest extends \PHPUnit_Framework_TestCase
1923
{
2024
public function testExecute()
@@ -27,7 +31,14 @@ public function testExecute()
2731

2832
$profiler->expects($this->once())->method('import')->will($this->returnValue(new Profile('TOKEN')));
2933

34+
$helperSet = new HelperSet();
35+
$helper = $this->getMock('Symfony\Component\Console\Helper\FormatterHelper');
36+
$helper->expects($this->any())->method('formatSection');
37+
$helperSet->set($helper, 'formatter');
38+
3039
$command = new ImportCommand($profiler);
40+
$command->setHelperSet($helperSet);
41+
3142
$commandTester = new CommandTester($command);
3243
$commandTester->execute(array('filename' => __DIR__.'/../Fixtures/profile.data'));
3344
$this->assertRegExp('/Profile "TOKEN" has been successfully imported\./', $commandTester->getDisplay());

src/Symfony/Component/HttpKernel/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
2.8.0
5+
-----
6+
7+
* deprecated `Profiler::import` and `Profiler::export`
8+
49
2.7.0
510
-----
611

src/Symfony/Component/HttpKernel/Profiler/Profiler.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,13 @@ public function purge()
137137
* @param Profile $profile A Profile instance
138138
*
139139
* @return string The exported data
140+
*
141+
* @deprecated since Symfony 2.8, to be removed in 3.0.
140142
*/
141143
public function export(Profile $profile)
142144
{
145+
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
146+
143147
return base64_encode(serialize($profile));
144148
}
145149

@@ -149,9 +153,13 @@ public function export(Profile $profile)
149153
* @param string $data A data string as exported by the export() method
150154
*
151155
* @return Profile A Profile instance
156+
*
157+
* @deprecated since Symfony 2.8, to be removed in 3.0.
152158
*/
153159
public function import($data)
154160
{
161+
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
162+
155163
$profile = unserialize(base64_decode($data));
156164

157165
if ($this->storage->read($profile->getToken())) {

0 commit comments

Comments
 (0)
0