@@ -10,7 +10,10 @@ class EncoderTest extends TestCase
1010 private $ output ;
1111 private $ encoder ;
1212
13- public function setUp ()
13+ /**
14+ * @before
15+ */
16+ public function setUpEncoder ()
1417 {
1518 $ stream = fopen ('php://temp ' , 'r+ ' );
1619 $ loop = $ this ->getMockBuilder ('React\EventLoop\LoopInterface ' )->getMock ();
@@ -19,15 +22,13 @@ public function setUp()
1922 $ this ->encoder = new Encoder ($ this ->output );
2023 }
2124
22- /**
23- * @expectedException InvalidArgumentException
24- */
2525 public function testPrettyPrintDoesNotMakeSenseForNDJson ()
2626 {
2727 if (!defined ('JSON_PRETTY_PRINT ' )) {
2828 $ this ->markTestSkipped ('Const JSON_PRETTY_PRINT only available in PHP 5.4+ ' );
2929 }
3030
31+ $ this ->setExpectedException ('InvalidArgumentException ' );
3132 $ this ->encoder = new Encoder ($ this ->output , JSON_PRETTY_PRINT );
3233 }
3334
@@ -77,11 +78,11 @@ public function testWriteInfiniteWillEmitErrorAndClose()
7778 $ this ->assertInstanceOf ('RuntimeException ' , $ error );
7879 if (PHP_VERSION_ID >= 50500 ) {
7980 // PHP 5.5+ reports error with proper code
80- $ this ->assertContains ('Inf and NaN cannot be JSON encoded ' , $ error ->getMessage ());
81+ $ this ->assertContainsString ('Inf and NaN cannot be JSON encoded ' , $ error ->getMessage ());
8182 $ this ->assertEquals (JSON_ERROR_INF_OR_NAN , $ error ->getCode ());
8283 } else {
8384 // PHP < 5.5 reports error message without code
84- $ this ->assertContains ('double INF does not conform to the JSON spec ' , $ error ->getMessage ());
85+ $ this ->assertContainsString ('double INF does not conform to the JSON spec ' , $ error ->getMessage ());
8586 $ this ->assertEquals (0 , $ error ->getCode ());
8687 }
8788 }
@@ -109,7 +110,7 @@ public function testWriteInvalidUtf8WillEmitErrorAndClose()
109110 $ this ->assertInstanceOf ('RuntimeException ' , $ error );
110111 if (PHP_VERSION_ID >= 50500 ) {
111112 // PHP 5.5+ reports error with proper code
112- $ this ->assertContains ('Malformed UTF-8 characters, possibly incorrectly encoded ' , $ error ->getMessage ());
113+ $ this ->assertContainsString ('Malformed UTF-8 characters, possibly incorrectly encoded ' , $ error ->getMessage ());
113114 $ this ->assertEquals (JSON_ERROR_UTF8 , $ error ->getCode ());
114115 } elseif (PHP_VERSION_ID >= 50303 ) {
115116 // PHP 5.3.3+ reports error with proper code (const JSON_ERROR_UTF8 added in PHP 5.3.3)
0 commit comments