@@ -21,7 +21,7 @@ class DumpCommandTest extends TestCase
2121 protected $ router ;
2222 private $ serializer ;
2323
24- public function setUp ()
24+ public function setUp (): void
2525 {
2626 $ this ->extractor = $ this ->getMockBuilder ('FOS\JsRoutingBundle\Extractor\ExposedRoutesExtractor ' )
2727 ->disableOriginalConstructor ()
@@ -47,8 +47,8 @@ public function testExecute()
4747 $ tester = new CommandTester ($ command );
4848 $ tester ->execute (array ('--target ' => '/tmp/dump-command-test ' ));
4949
50- $ this ->assertContains ('Dumping exposed routes. ' , $ tester ->getDisplay ());
51- $ this ->assertContains ('[file+] /tmp/dump-command-test ' , $ tester ->getDisplay ());
50+ $ this ->assertStringContainsString ('Dumping exposed routes. ' , $ tester ->getDisplay ());
51+ $ this ->assertStringContainsString ('[file+] /tmp/dump-command-test ' , $ tester ->getDisplay ());
5252
5353 $ this ->assertEquals ('fos.Router.setData({"base_url":"","routes":{"literal":{"tokens":[["text","\/homepage"]],"defaults":[],"requirements":[],"hosttokens":[]},"blog":{"tokens":[["variable","\/","[^\/]++","slug"],["text","\/blog-post"]],"defaults":[],"requirements":[],"hosttokens":[["text","localhost"]]}},"prefix":"","host":"","scheme":""}); ' , file_get_contents ('/tmp/dump-command-test ' ));
5454 }
@@ -67,8 +67,8 @@ public function testExecuteCallbackOption()
6767 '--callback ' => 'test ' ,
6868 ));
6969
70- $ this ->assertContains ('Dumping exposed routes. ' , $ tester ->getDisplay ());
71- $ this ->assertContains ('[file+] /tmp/dump-command-test ' , $ tester ->getDisplay ());
70+ $ this ->assertStringContainsString ('Dumping exposed routes. ' , $ tester ->getDisplay ());
71+ $ this ->assertStringContainsString ('[file+] /tmp/dump-command-test ' , $ tester ->getDisplay ());
7272
7373 $ this ->assertEquals ('test({"base_url":"","routes":{"literal":{"tokens":[["text","\/homepage"]],"defaults":[],"requirements":[],"hosttokens":[]},"blog":{"tokens":[["variable","\/","[^\/]++","slug"],["text","\/blog-post"]],"defaults":[],"requirements":[],"hosttokens":[["text","localhost"]]}},"prefix":"","host":"","scheme":""}); ' , file_get_contents ('/tmp/dump-command-test ' ));
7474 }
@@ -89,30 +89,26 @@ public function testExecuteFormatOption()
8989 '--format ' => 'json ' ,
9090 ));
9191
92- $ this ->assertContains ('Dumping exposed routes. ' , $ tester ->getDisplay ());
93- $ this ->assertContains ('[file+] /tmp/dump-command-test ' , $ tester ->getDisplay ());
92+ $ this ->assertStringContainsString ('Dumping exposed routes. ' , $ tester ->getDisplay ());
93+ $ this ->assertStringContainsString ('[file+] /tmp/dump-command-test ' , $ tester ->getDisplay ());
9494
9595 $ this ->assertEquals ($ json , file_get_contents ('/tmp/dump-command-test ' ));
9696 }
9797
98- /**
99- * @expectedException \RuntimeException
100- * @expectedExceptionMessage Unable to create directory /root/dir/../web/js
101- */
10298 public function testExecuteUnableToCreateDirectory ()
10399 {
100+ $ this ->expectException (\RuntimeException::class);
101+ $ this ->expectExceptionMessage ('Unable to create directory /root/dir/../web/js ' );
104102 $ command = new DumpCommand ($ this ->extractor , $ this ->serializer , '/root/dir ' );
105103
106104 $ tester = new CommandTester ($ command );
107105 $ tester ->execute (array ());
108106 }
109107
110- /**
111- * @expectedException \RuntimeException
112- * @expectedExceptionMessage Unable to write file /tmp
113- */
114108 public function testExecuteUnableToWriteFile ()
115109 {
110+ $ this ->expectException (\RuntimeException::class);
111+ $ this ->expectExceptionMessage ('Unable to write file /tmp ' );
116112 $ this ->serializer ->expects ($ this ->once ())
117113 ->method ('serialize ' )
118114 ->will ($ this ->returnValue ('{"base_url":"","routes":{"literal":{"tokens":[["text","\/homepage"]],"defaults":[],"requirements":[],"hosttokens":[]},"blog":{"tokens":[["variable","\/","[^\/]++","slug"],["text","\/blog-post"]],"defaults":[],"requirements":[],"hosttokens":[["text","localhost"]]}},"prefix":"","host":"","scheme":""} ' ));
0 commit comments