Skip to content

Commit c8fc14a

Browse files
committed
Fixed some dev dependencies and tests for PHP 8
1 parent c816992 commit c8fc14a

File tree

5 files changed

+29
-28
lines changed

5 files changed

+29
-28
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
- ubuntu-latest
77
strategy:
88
matrix:
9-
php: ['7.2', '7.3', '7.4']
9+
php: ['7.2', '7.3', '7.4', '8.0', '8.1']
1010
steps:
1111
- name: Configure Git
1212
if: ${{ matrix.os == 'windows-latest' }}

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535
"guzzlehttp/guzzle": "~6.0|~7.0"
3636
},
3737
"require-dev": {
38-
"phpunit/phpunit": "^7.4",
39-
"php-http/mock-client": "^0.3.0",
40-
"estahn/phpunit-json-assertions": "^3.0.0",
38+
"phpunit/phpunit": "^7.4|^8.0",
39+
"php-http/mock-client": "^1.4",
40+
"helmich/phpunit-json-assert": "^3.0.0",
4141
"squizlabs/php_codesniffer": "^3.1",
42-
"php-http/guzzle6-adapter": "^1.0",
43-
"phpstan/phpstan": "^0.11",
44-
"rector/rector": "^0.5.23",
42+
"php-http/guzzle7-adapter": "^1.0",
43+
"phpstan/phpstan": "^0.12",
44+
"rector/rector": "^0.8",
4545
"phing/phing": "~2.16.0"
4646
},
4747
"autoload": {

tests/OpenTokTest/ArchiveTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ArchiveTest extends TestCase
2222

2323
protected static $mockBasePath;
2424

25-
public static function setUpBeforeClass()
25+
public static function setUpBeforeClass(): void
2626
{
2727
self::$mockBasePath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'mock' . DIRECTORY_SEPARATOR;
2828
}
@@ -98,7 +98,7 @@ public function testInitializes()
9898
$this->setupArchives();
9999
// Act
100100
// Assert
101-
$this->assertInstanceOf('OpenTok\Archive', $this->archive);
101+
$this->assertInstanceOf(Archive::class, $this->archive);
102102
}
103103

104104
public function testReadsProperties()
@@ -294,7 +294,7 @@ public function testSerializesToJson()
294294
$archiveJson = $this->archive->toJson();
295295

296296
// Assert
297-
$this->assertInternalType('string', $archiveJson);
297+
$this->assertIsString($archiveJson);
298298
$this->assertNotNull(json_encode($archiveJson));
299299
}
300300

@@ -308,7 +308,7 @@ public function testSerializedToArray()
308308
$archiveArray = $this->archive->toArray();
309309

310310
// Assert
311-
$this->assertInternalType('array', $archiveArray);
311+
$this->assertIsArray($archiveArray);
312312
$this->assertEquals($this->archiveData, $archiveArray);
313313
}
314314
}

tests/OpenTokTest/OpenTokTest.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class OpenTokTest extends TestCase
3131

3232
protected static $mockBasePath;
3333

34-
public static function setUpBeforeClass()
34+
public static function setUpBeforeClass(): void
3535
{
3636
self::$mockBasePath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'mock' . DIRECTORY_SEPARATOR;
3737
}
@@ -326,7 +326,7 @@ public function testGeneratesToken()
326326
$token = $opentok->generateToken($sessionId);
327327

328328
// Assert
329-
$this->assertInternalType('string', $token);
329+
$this->assertIsString($token);
330330

331331
$decodedToken = TestHelpers::decodeToken($token);
332332
$this->assertEquals($sessionId, $decodedToken['session_id']);
@@ -357,7 +357,7 @@ public function testGeneratesTokenWithRole()
357357
$token = $opentok->generateToken($sessionId, array('role' => Role::MODERATOR));
358358

359359
// Assert
360-
$this->assertInternalType('string', $token);
360+
$this->assertIsString($token);
361361

362362
$decodedToken = TestHelpers::decodeToken($token);
363363
$this->assertEquals($sessionId, $decodedToken['session_id']);
@@ -389,7 +389,7 @@ public function testGeneratesTokenWithExpireTime()
389389
$token = $opentok->generateToken($sessionId, array('expireTime' => $inOneHour ));
390390

391391
// Assert
392-
$this->assertInternalType('string', $token);
392+
$this->assertIsString($token);
393393

394394
$decodedToken = TestHelpers::decodeToken($token);
395395
$this->assertEquals($sessionId, $decodedToken['session_id']);
@@ -419,7 +419,7 @@ public function testGeneratesTokenWithData()
419419
$token = $opentok->generateToken($sessionId, array('data' => $userStatus ));
420420

421421
// Assert
422-
$this->assertInternalType('string', $token);
422+
$this->assertIsString($token);
423423

424424
$decodedToken = TestHelpers::decodeToken($token);
425425
$this->assertEquals($sessionId, $decodedToken['session_id']);
@@ -456,7 +456,7 @@ public function testGeneratesTokenWithInitialLayoutClassList()
456456
));
457457

458458
// Assert
459-
$this->assertInternalType('string', $token);
459+
$this->assertIsString($token);
460460

461461
$decodedToken = TestHelpers::decodeToken($token);
462462
$this->assertEquals($sessionId, $decodedToken['session_id']);
@@ -1193,12 +1193,12 @@ public function testStartsBroadcast()
11931193
$this->assertStringStartsWith('OpenTok-PHP-SDK/4.6.3', $userAgent);
11941194

11951195
$this->assertInstanceOf('OpenTok\Broadcast', $broadcast);
1196-
$this->assertInternalType('string', $broadcast->id);
1196+
$this->assertIsString($broadcast->id);
11971197
$this->assertEquals($sessionId, $broadcast->sessionId);
1198-
$this->assertInternalType('array', $broadcast->broadcastUrls);
1198+
$this->assertIsArray($broadcast->broadcastUrls);
11991199
$this->assertArrayHasKey('hls', $broadcast->broadcastUrls);
1200-
$this->assertInternalType('string', $broadcast->broadcastUrls['hls']);
1201-
$this->assertInternalType('string', $broadcast->hlsUrl);
1200+
$this->assertIsString($broadcast->broadcastUrls['hls']);
1201+
$this->assertIsString($broadcast->hlsUrl);
12021202
$this->assertFalse($broadcast->isStopped);
12031203
}
12041204

@@ -1249,14 +1249,14 @@ public function testStartBroadcastWithOptions()
12491249
$this->assertStringStartsWith('OpenTok-PHP-SDK/4.6.3', $userAgent);
12501250

12511251
$this->assertInstanceOf('OpenTok\Broadcast', $broadcast);
1252-
$this->assertInternalType('string', $broadcast->id);
1252+
$this->assertIsString($broadcast->id);
12531253
$this->assertEquals($sessionId, $broadcast->sessionId);
12541254
$this->assertEquals($maxDuration, $broadcast->maxDuration);
12551255
$this->assertEquals($resolution, $broadcast->resolution);
1256-
$this->assertInternalType('array', $broadcast->broadcastUrls);
1256+
$this->assertIsArray($broadcast->broadcastUrls);
12571257
$this->assertArrayHasKey('hls', $broadcast->broadcastUrls);
1258-
$this->assertInternalType('string', $broadcast->broadcastUrls['hls']);
1259-
$this->assertInternalType('string', $broadcast->hlsUrl);
1258+
$this->assertIsString($broadcast->broadcastUrls['hls']);
1259+
$this->assertIsString($broadcast->hlsUrl);
12601260
$this->assertFalse($broadcast->isStopped);
12611261
}
12621262

@@ -1738,6 +1738,7 @@ public function testSignalWithEmptyPayload()
17381738
// Act
17391739
try {
17401740
$this->opentok->signal($sessionId, $payload);
1741+
$this->assertTrue(true);
17411742
} catch (\Exception $e) {
17421743
}
17431744
}

tests/OpenTokTest/SessionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ class SessionTest extends TestCase
2020

2121
protected static $mockBasePath;
2222

23-
public static function setUpBeforeClass()
23+
public static function setUpBeforeClass(): void
2424
{
2525
self::$mockBasePath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'mock' . DIRECTORY_SEPARATOR;
2626
}
2727

28-
public function setUp()
28+
public function setUp(): void
2929
{
3030
$this->API_KEY = defined('API_KEY') ? API_KEY : '12345678';
3131
$this->API_SECRET = defined('API_SECRET') ? API_SECRET : '0123456789abcdef0123456789abcdef0123456789';
@@ -148,7 +148,7 @@ public function testGeneratesToken()
148148

149149
$token = $session->generateToken();
150150

151-
$this->assertInternalType('string', $token);
151+
$this->assertIsString($token);
152152
$decodedToken = TestHelpers::decodeToken($token);
153153
$this->assertEquals($sessionId, $decodedToken['session_id']);
154154
$this->assertEquals($bogusApiKey, $decodedToken['partner_id']);

0 commit comments

Comments
 (0)