Skip to content

Commit 05eb4c5

Browse files
committed
Upgrade tests for newer PhpUnit
1 parent 055e85b commit 05eb4c5

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

tests/BaseTester.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class BaseTester extends TestCase {
2323

2424
protected $steamClient;
2525

26-
public function setUp()
26+
protected function setUp(): void
2727
{
2828
parent::setUp();
2929
$this->steamClient = new Client();
@@ -32,6 +32,7 @@ public function setUp()
3232
/** @test */
3333
public function empty_test()
3434
{
35+
$this->assertTrue(true);
3536
}
3637

3738
protected function assertObjectHasAttributes($attributes, $object)

tests/PlayerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public function it_gets_the_steam_level_by_user_id()
88
{
99
$steamLevel = $this->steamClient->player($this->id64)->GetSteamLevel();
1010

11-
$this->assertInternalType('int', $steamLevel);
11+
$this->assertIsInt($steamLevel);
1212
}
1313

1414
/** @test */

tests/UserTest.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ public function it_accepts_an_array_of_steam_ids()
1919
*/
2020
public function it_throws_an_exception_when_no_display_name_is_provided()
2121
{
22-
$this->setExpectedException('Syntax\SteamApi\Exceptions\UnrecognizedId');
22+
if (\method_exists($this, 'setExpectedException')) {
23+
$this->setExpectedException('Syntax\SteamApi\Exceptions\UnrecognizedId');
24+
} else {
25+
$this->expectException('Syntax\SteamApi\Exceptions\UnrecognizedId');
26+
}
27+
2328
$steamObject = $this->steamClient->user($this->id64)->ResolveVanityURL();
2429

2530
$this->assertEquals('No match', $steamObject);
@@ -88,7 +93,14 @@ public function it_gets_friend_users_in_friend_list()
8893
/** @test */
8994
public function it_throws_exception_to_invalid_relationship_types()
9095
{
91-
$this->setExpectedException('InvalidArgumentException', 'Provided relationship [nonFriend] is not valid. Please select from: all, friend');
96+
$expectedMessage = 'Provided relationship [nonFriend] is not valid. Please select from: all, friend';
97+
98+
if (\method_exists($this, 'setExpectedException')) {
99+
$this->setExpectedException('InvalidArgumentException', $expectedMessage);
100+
} else {
101+
$this->expectException('InvalidArgumentException');
102+
$this->expectExceptionMessage($expectedMessage);
103+
}
92104

93105
$this->steamClient->user($this->id64)->GetFriendList('nonFriend');
94106
}

0 commit comments

Comments
 (0)