1313
1414use FOS \UserBundle \DependencyInjection \FOSUserExtension ;
1515use PHPUnit \Framework \TestCase ;
16+ use Symfony \Component \Config \Definition \Exception \InvalidConfigurationException ;
1617use Symfony \Component \DependencyInjection \ContainerBuilder ;
1718use Symfony \Component \Yaml \Parser ;
1819
@@ -26,68 +27,63 @@ protected function tearDown()
2627 $ this ->configuration = null ;
2728 }
2829
29- /**
30- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
31- */
3230 public function testUserLoadThrowsExceptionUnlessDatabaseDriverSet ()
3331 {
32+ $ this ->expectException (InvalidConfigurationException::class);
33+
3434 $ loader = new FOSUserExtension ();
3535 $ config = $ this ->getEmptyConfig ();
3636 unset($ config ['db_driver ' ]);
3737 $ loader ->load ([$ config ], new ContainerBuilder ());
3838 }
3939
40- /**
41- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
42- */
4340 public function testUserLoadThrowsExceptionUnlessDatabaseDriverIsValid ()
4441 {
42+ $ this ->expectException (InvalidConfigurationException::class);
43+
4544 $ loader = new FOSUserExtension ();
4645 $ config = $ this ->getEmptyConfig ();
4746 $ config ['db_driver ' ] = 'foo ' ;
4847 $ loader ->load ([$ config ], new ContainerBuilder ());
4948 }
5049
51- /**
52- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
53- */
5450 public function testUserLoadThrowsExceptionUnlessFirewallNameSet ()
5551 {
52+ $ this ->expectException (InvalidConfigurationException::class);
53+
5654 $ loader = new FOSUserExtension ();
5755 $ config = $ this ->getEmptyConfig ();
5856 unset($ config ['firewall_name ' ]);
5957 $ loader ->load ([$ config ], new ContainerBuilder ());
6058 }
6159
6260 /**
63- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
64- *
6561 * @group legacy
6662 */
6763 public function testUserLoadThrowsExceptionUnlessGroupModelClassSet ()
6864 {
65+ $ this ->expectException (InvalidConfigurationException::class);
66+
6967 $ loader = new FOSUserExtension ();
7068 $ config = $ this ->getFullConfig ();
7169 unset($ config ['group ' ]['group_class ' ]);
7270 $ loader ->load ([$ config ], new ContainerBuilder ());
7371 }
7472
75- /**
76- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
77- */
7873 public function testUserLoadThrowsExceptionUnlessUserModelClassSet ()
7974 {
75+ $ this ->expectException (InvalidConfigurationException::class);
76+
8077 $ loader = new FOSUserExtension ();
8178 $ config = $ this ->getEmptyConfig ();
8279 unset($ config ['user_class ' ]);
8380 $ loader ->load ([$ config ], new ContainerBuilder ());
8481 }
8582
86- /**
87- * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
88- */
8983 public function testCustomDriverWithoutManager ()
9084 {
85+ $ this ->expectException (InvalidConfigurationException::class);
86+
9187 $ loader = new FOSUserExtension ();
9288 $ config = $ this ->getEmptyConfig ();
9389 $ config ['db_driver ' ] = 'custom ' ;
0 commit comments