44
55use \ConvertApi \ConvertApi ;
66
7- class ConvertApiTest extends \PHPUnit_Framework_TestCase
7+ class ConvertApiTest extends \PHPUnit \ Framework \TestCase
88{
99 protected $ origApiSecret ;
1010
11- protected function setUp ()
11+ protected function setUp (): void
1212 {
1313 // Save original values so that we can restore them after running tests
1414 $ this ->origApiSecret = ConvertApi::getApiSecret ();
@@ -18,7 +18,7 @@ protected function setUp()
1818 ConvertApi::setApiSecret (getenv ('CONVERT_API_SECRET ' ));
1919 }
2020
21- protected function tearDown ()
21+ protected function tearDown (): void
2222 {
2323 // Restore original values
2424 ConvertApi::setApiSecret ($ this ->origApiSecret );
@@ -44,7 +44,7 @@ public function testGetUser()
4444 {
4545 $ user_info = ConvertApi::getUser ();
4646
47- $ this ->assertInternalType ( ' array ' , $ user_info );
47+ $ this ->assertIsArray ( $ user_info );
4848 $ this ->assertArrayHasKey ('SecondsLeft ' , $ user_info );
4949 }
5050
@@ -56,7 +56,7 @@ public function testConvertWithFileUrl()
5656
5757 $ this ->assertInstanceOf ('\ConvertApi\Result ' , $ result );
5858
59- $ this ->assertInternalType ( ' int ' , $ result ->getConversionCost ());
59+ $ this ->assertIsInt ( $ result ->getConversionCost ());
6060
6161 $ files = $ result ->saveFiles (sys_get_temp_dir ());
6262
@@ -65,7 +65,7 @@ public function testConvertWithFileUrl()
6565 foreach ($ files as $ file )
6666 unlink ($ file );
6767
68- $ this ->assertInternalType ( ' string ' , $ result ->getFile ()->getContents ());
68+ $ this ->assertIsString ( $ result ->getFile ()->getContents ());
6969 }
7070
7171 public function testConvertWithFilePath ()
@@ -123,7 +123,7 @@ public function testConvertWithSpecifiedSourceFormatAndTimeout()
123123
124124 $ result = ConvertApi::convert ('pdf ' , $ params , 'web ' , 100 );
125125
126- $ this ->assertInternalType ( ' int ' , $ result ->getFile ()->getFileSize ());
126+ $ this ->assertIsInt ( $ result ->getFile ()->getFileSize ());
127127 }
128128
129129 public function testConvertWithMultipleFiles ()
@@ -143,7 +143,7 @@ public function testConvertWithUrl()
143143
144144 $ result = ConvertApi::convert ('pdf ' , $ params , 'web ' );
145145
146- $ this ->assertInternalType ( ' int ' , $ result ->getFile ()->getFileSize ());
146+ $ this ->assertIsInt ( $ result ->getFile ()->getFileSize ());
147147 }
148148
149149 public function testChainedConversion ()
@@ -180,7 +180,7 @@ public function testApiError()
180180
181181 $ this ->fail ('Expected exception has not been raised. ' );
182182 } catch (\ConvertApi \Error \Api $ e ) {
183- $ this ->assertContains ('Parameter validation error. ' , $ e ->getMessage ());
183+ $ this ->assertStringContainsString ('Parameter validation error. ' , $ e ->getMessage ());
184184 $ this ->assertEquals (4000 , $ e ->getCode ());
185185 }
186186 }
@@ -196,7 +196,7 @@ public function testClientError()
196196
197197 $ this ->fail ('Expected exception has not been raised. ' );
198198 } catch (\ConvertApi \Error \Client $ e ) {
199- $ this ->assertContains ('timed out ' , $ e ->getMessage ());
199+ $ this ->assertStringContainsString ('timed out ' , $ e ->getMessage ());
200200 $ this ->assertEquals (28 , $ e ->getCode ());
201201 }
202202 }
0 commit comments