1010
1111namespace phpbb \pages \tests \routing ;
1212
13- use ReflectionMethod ;
14- use Symfony \Component \Config \Loader \LoaderInterface ;
13+ use Symfony \Component \HttpKernel \Kernel ;
1514
1615class page_loader_version_detection_test extends \phpbb_test_case
1716{
@@ -27,33 +26,28 @@ public function test_page_loader_class_exists()
2726
2827 public function test_page_loader_extends_correct_adapter ()
2928 {
30- $ method = new ReflectionMethod (LoaderInterface::class, 'load ' );
31-
32- if ($ method ->hasReturnType ())
29+ if (version_compare (Kernel::VERSION , '7.0.0 ' , '>= ' ))
3330 {
3431 self ::assertInstanceOf (\phpbb \pages \routing \page_loader_phpbb4::class,
3532 new \phpbb \pages \routing \page_loader ($ this ->createMock (\phpbb \db \driver \driver_interface::class), 'test_table ' ),
36- 'page_loader should extend page_loader_phpbb4 when LoaderInterface::load() has return type (Symfony 7/ phpBB4) '
33+ 'page_loader should extend page_loader_phpbb4 when Symfony >= 7.0 ( phpBB4) '
3734 );
3835 }
3936 else
4037 {
4138 self ::assertInstanceOf (\phpbb \pages \routing \page_loader_phpbb3::class,
4239 new \phpbb \pages \routing \page_loader ($ this ->createMock (\phpbb \db \driver \driver_interface::class), 'test_table ' ),
43- 'page_loader should extend page_loader_phpbb3 when LoaderInterface::load() has no return type (Symfony 3-6/ phpBB3) '
40+ 'page_loader should extend page_loader_phpbb3 when Symfony < 7.0 ( phpBB3) '
4441 );
4542 }
4643 }
4744
4845 public function test_version_detection_logic ()
4946 {
50- $ method = new ReflectionMethod (LoaderInterface::class, 'load ' );
51- $ hasReturnType = $ method ->hasReturnType ();
52-
5347 $ reflection = new \ReflectionClass (\phpbb \pages \routing \page_loader::class);
5448 $ parent = $ reflection ->getParentClass ();
5549
56- if ($ hasReturnType )
50+ if (version_compare (Kernel:: VERSION , ' 7.0.0 ' , ' >= ' ) )
5751 {
5852 self ::assertSame (\phpbb \pages \routing \page_loader_phpbb4::class, $ parent ->getName (),
5953 'Symfony 7+ detected: page_loader must extend page_loader_phpbb4 '
0 commit comments