|
11 | 11 |
|
12 | 12 | namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
|
13 | 13 |
|
| 14 | +use Symfony\Bridge\PhpUnit\ErrorAssert; |
14 | 15 | use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
15 | 16 | use Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser;
|
16 | 17 | use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
|
@@ -88,26 +89,13 @@ public function testParseValidNameWithNotFoundBundle()
|
88 | 89 | */
|
89 | 90 | public function testAbsolutePathsAreDeprecated($name, $logicalName, $path, $ref)
|
90 | 91 | {
|
91 |
| - $deprecations = array(); |
92 |
| - set_error_handler(function ($type, $msg) use (&$deprecations) { |
93 |
| - if (E_USER_DEPRECATED !== $type) { |
94 |
| - restore_error_handler(); |
| 92 | + ErrorAssert::assertDeprecationsAreTriggered('Absolute template path support is deprecated since Symfony 3.1 and will be removed in 4.0.', function () use ($name, $logicalName, $path, $ref) { |
| 93 | + $template = $this->parser->parse($name); |
95 | 94 |
|
96 |
| - return call_user_func_array('PHPUnit_Util_ErrorHandler::handleError', func_get_args()); |
97 |
| - } |
98 |
| - |
99 |
| - $deprecations[] = $msg; |
| 95 | + $this->assertSame($ref->getLogicalName(), $template->getLogicalName()); |
| 96 | + $this->assertSame($logicalName, $template->getLogicalName()); |
| 97 | + $this->assertSame($path, $template->getPath()); |
100 | 98 | });
|
101 |
| - |
102 |
| - $template = $this->parser->parse($name); |
103 |
| - |
104 |
| - restore_error_handler(); |
105 |
| - |
106 |
| - $this->assertSame($ref->getLogicalName(), $template->getLogicalName()); |
107 |
| - $this->assertSame($logicalName, $template->getLogicalName()); |
108 |
| - $this->assertSame($path, $template->getPath()); |
109 |
| - $this->assertCount(1, $deprecations); |
110 |
| - $this->assertContains('Absolute template path support is deprecated since Symfony 3.1 and will be removed in 4.0.', $deprecations[0]); |
111 | 99 | }
|
112 | 100 |
|
113 | 101 | public function provideAbsolutePaths()
|
|
0 commit comments