Skip to content

Commit e9a5d5c

Browse files
committed
Add tests
1 parent 6a30629 commit e9a5d5c

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Symfony\Bundle\FrameworkBundle\Tests\Fixtures;
4+
5+
/**
6+
* @deprecated
7+
*/
8+
class DeprecatedClass
9+
{
10+
}

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ContainerDebugCommandTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,22 @@ public function testPrivateAlias()
6969
$this->assertStringContainsString('The "private_alias" service or alias has been removed', $tester->getDisplay());
7070
}
7171

72+
public function testDeprecatedServiceAndAlias()
73+
{
74+
static::bootKernel(['test_case' => 'ContainerDebug', 'root_config' => 'config.yml']);
75+
76+
$application = new Application(static::$kernel);
77+
$application->setAutoExit(false);
78+
79+
$tester = new ApplicationTester($application);
80+
81+
$tester->run(['command' => 'debug:container', 'name' => 'deprecated']);
82+
$this->assertStringContainsString('The "deprecated" service is deprecated since foo/bar 1.9 and will be removed in 2.0. Use "public" service instead.', $tester->getDisplay());
83+
84+
$tester->run(['command' => 'debug:container', 'name' => 'deprecated_alias']);
85+
$this->assertStringContainsString('The "deprecated_alias" alias is deprecated since foo/bar 1.9 and will be removed in 2.0. Use "public" service instead.', $tester->getDisplay());
86+
}
87+
7288
/**
7389
* @dataProvider provideIgnoreBackslashWhenFindingService
7490
*/

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/ContainerDebug/config.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ services:
1111
private_alias:
1212
alias: public
1313
public: false
14+
deprecated:
15+
class: Symfony\Bundle\FrameworkBundle\Tests\Fixtures\DeprecatedClass
16+
deprecated: The "%service_id%" service is deprecated since foo/bar 1.9 and will be removed in 2.0. Use "public" service instead.
17+
deprecated_alias:
18+
alias: deprecated
19+
deprecated:
20+
package: 'foo/bar'
21+
version: '1.9'
22+
message: The "%alias_id%" alias is deprecated since foo/bar 1.9 and will be removed in 2.0. Use "public" service instead.
1423
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\BackslashClass:
1524
class: Symfony\Bundle\FrameworkBundle\Tests\Fixtures\BackslashClass
1625
Symfony\Bundle\FrameworkBundle\Tests\Fixtures\ClassAliasExampleClass: '@public'

0 commit comments

Comments
 (0)