@@ -68,11 +68,6 @@ public function parseProvider()
6868 array ('FooBundle:Post:foo.bar.index.html.php ' , 'FooBundle:Post:foo.bar.index.html.php ' , '@FooBundle/Resources/views/Post/foo.bar.index.html.php ' , new TemplateReference ('FooBundle ' , 'Post ' , 'foo.bar.index ' , 'html ' , 'php ' )),
6969 array ('@FooBundle/Resources/views/layout.html.twig ' , '@FooBundle/Resources/views/layout.html.twig ' , '@FooBundle/Resources/views/layout.html.twig ' , new BaseTemplateReference ('@FooBundle/Resources/views/layout.html.twig ' , 'twig ' )),
7070 array ('@FooBundle/Foo/layout.html.twig ' , '@FooBundle/Foo/layout.html.twig ' , '@FooBundle/Foo/layout.html.twig ' , new BaseTemplateReference ('@FooBundle/Foo/layout.html.twig ' , 'twig ' )),
71- array ('/path/to/section/index.html.php ' , '/path/to/section/index.html.php ' , '/path/to/section/index.html.php ' , new BaseTemplateReference ('/path/to/section/index.html.php ' , 'php ' )),
72- array ('C: \\path \\to \\section \\name.html.php ' , 'C:path/to/section/name.html.php ' , 'C:path/to/section/name.html.php ' , new BaseTemplateReference ('C:path/to/section/name.html.php ' , 'php ' )),
73- array ('C: \\path \\to \\section \\name:foo.html.php ' , 'C:path/to/section/name:foo.html.php ' , 'C:path/to/section/name:foo.html.php ' , new BaseTemplateReference ('C:path/to/section/name:foo.html.php ' , 'php ' )),
74- array ('\\path \\to \\section \\name.html.php ' , '/path/to/section/name.html.php ' , '/path/to/section/name.html.php ' , new BaseTemplateReference ('/path/to/section/name.html.php ' , 'php ' )),
75- array ('/path/to/section/name.php ' , '/path/to/section/name.php ' , '/path/to/section/name.php ' , new BaseTemplateReference ('/path/to/section/name.php ' , 'php ' )),
7671 array ('name.twig ' , 'name.twig ' , 'name.twig ' , new BaseTemplateR
628C
eference ('name.twig ' , 'twig ' )),
7772 array ('name ' , 'name ' , 'name ' , new BaseTemplateReference ('name ' )),
7873 array ('default/index.html.php ' , '::default/index.html.php ' , 'views/default/index.html.php ' , new TemplateReference (null , null , 'default/index ' , 'html ' , 'php ' )),
@@ -86,4 +81,41 @@ public function testParseValidNameWithNotFoundBundle()
8681 {
8782 $ this ->parser ->parse ('BarBundle:Post:index.html.php ' );
8883 }
84+
85+ /**
86+ * @group legacy
87+ * @dataProvider provideAbsolutePaths
88+ */
89+ public function testAbsolutePathsAreDeprecated ($ name , $ logicalName , $ path , $ ref )
90+ {
91+ $ deprecations = array ();
92+ set_error_handler (function ($ type , $ msg ) use (&$ deprecations ) {
93+ if (E_USER_DEPRECATED !== $ type ) {
94+ throw new \LogicException (sprintf ('Unexpected error: "%s". ' , $ msg ));
95+ }
96+
97+ $ deprecations [] = $ msg ;
98+ });
99+
100+ $ template = $ this ->parser ->parse ($ name );
101+
102+ restore_error_handler ();
103+
104+ $ this ->assertSame ($ ref ->getLogicalName (), $ template ->getLogicalName ());
105+ $ this ->assertSame ($ logicalName , $ template ->getLogicalName ());
106+ $ this ->assertSame ($ path , $ template ->getPath ());
107+ $ this ->assertCount (1 , $ deprecations );
108+ $ this ->assertContains ('Absolute template path support is deprecated since Symfony 3.1 and will be removed in 4.0. ' , $ deprecations [0 ]);
109+ }
110+
111+ public function provideAbsolutePaths ()
112+ {
113+ return array (
114+ array ('/path/to/section/index.html.php ' , '/path/to/section/index.html.php ' , '/path/to/section/index.html.php ' , new BaseTemplateReference ('/path/to/section/index.html.php ' , 'php ' )),
115+ array ('C: \\path \\to \\section \\name.html.php ' , 'C:path/to/section/name.html.php ' , 'C:path/to/section/name.html.php ' , new BaseTemplateReference ('C:path/to/section/name.html.php ' , 'php ' )),
116+ array ('C: \\path \\to \\section \\name:foo.html.php ' , 'C:path/to/section/name:foo.html.php ' , 'C:path/to/section/name:foo.html.php ' , new BaseTemplateReference ('C:path/to/section/name:foo.html.php ' , 'php ' )),
117+ array ('\\path \\to \\section \\name.html.php ' , '/path/to/section/name.html.php ' , '/path/to/section/name.html.php ' , new BaseTemplateReference ('/path/to/section/name.html.php ' , 'php ' )),
118+ array ('/path/to/section/name.php ' , '/path/to/section/name.php ' , '/path/to/section/name.php ' , new BaseTemplateReference ('/path/to/section/name.php ' , 'php ' )),
119+ );
120+ }
89121}
0 commit comm 31F4 ents