Skip to content

Commit cccceee

Browse files
committed
Removing array dereference to be php 5.3 compatible
1 parent 4f7cb52 commit cccceee

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

tests/Entities/HabboTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ public function testGetHabboName() {
3737
}
3838

3939
public function testTwoSelectedBadges() {
40-
$this->assertEquals(2, count($this->habbo->getSelectedBadges()));
41-
$this->assertInstanceOf('HabboAPI\Entities\Badge', $this->habbo->getSelectedBadges()[0]);
40+
$selectedBadges = $this->habbo->getSelectedBadges();
41+
$this->assertEquals(2, count($selectedBadges));
42+
$this->assertInstanceOf('HabboAPI\Entities\Badge', $selectedBadges[0]);
4243
}
4344
}
4445

tests/HabboParserTest.php

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,41 @@
11
<?php
22

3+
use HabboAPI\Entities\Habbo;
4+
use HabboAPI\HabboParser;
5+
36
class HabboParserTest extends PHPUnit_Framework_TestCase {
47
private static $habbo;
58
private static $profile;
9+
/** @var HabboParser|PHPUnit_Framework_MockObject_MockObject $habboParserMock */
10+
private $habboParserMock;
611

712
public static function setUpBeforeClass() {
813
self::$habbo = json_decode(file_get_contents(dirname(__FILE__).'/data/com_koeientemmer_gethabbo.json'), true);
914
self::$profile = json_decode(file_get_contents(dirname(__FILE__).'/data/com_koeientemmer_getprofile.json'), true);
1015
}
1116

17+
public function setUp() {
18+
$this->habboParserMock = $this->getMock('\HabboAPI\HabboParser', array('_callUrl'), array($this->any()));
19+
}
20+
1221
/**
1322
* Testing the parseHabbo method with static input
1423
*/
1524
public function testParseHabbo() {
16-
$habboParserMock = $this->getMock('\HabboAPI\HabboParser', array('_callUrl'), array($this->any()));
17-
$habboParserMock->expects($this->once())->method('_callUrl')->will($this->returnValue(self::$habbo));
25+
$this->habboParserMock->expects($this->once())->method('_callUrl')->will($this->returnValue(self::$habbo));
1826

19-
$habboObject = $habboParserMock->parseHabbo('koeientemmer');
27+
/** @var Habbo $habboObject */
28+
$habboObject = $this->habboParserMock->parseHabbo('koeientemmer');
2029

2130
$this->assertInstanceOf('HabboAPI\Entities\Habbo', $habboObject);
22-
$this->assertInstanceOf('HabboAPI\Entities\Badge', $habboObject->getSelectedBadges()[0]);
31+
$selectedBadges = $habboObject->getSelectedBadges();
32+
$this->assertInstanceOf('HabboAPI\Entities\Badge', $selectedBadges[0]);
2333
}
2434

2535
public function testParseProfile() {
26-
$habboParserMock = $this->getMock('\HabboAPI\HabboParser', array('_callUrl'), array($this->any()));
27-
$habboParserMock->expects($this->once())->method('_callUrl')->will($this->returnValue(self::$profile));
36+
$this->habboParserMock->expects($this->once())->method('_callUrl')->will($this->returnValue(self::$profile));
2837

29-
$profile = $habboParserMock->parseProfile('hhus-9cd61b156972c2eb33a145d69918f965');
38+
$profile = $this->habboParserMock->parseProfile('hhus-9cd61b156972c2eb33a145d69918f965');
3039

3140
$this->assertInstanceOf('HabboAPI\Entities\Habbo', $profile['habbo']);
3241
$this->assertInstanceOf('HabboAPI\Entities\Habbo', $profile['friends'][0]);

0 commit comments

Comments
 (0)