Example #1
0
 public function testParsePublicPhotos()
 {
     // Replace Habbo Parser mock with static data
     $this->habboParserMock->expects($this->once())->method('_callUrl')->will($this->returnValue(array(self::$public_photos)));
     $photos = $this->habboParserMock->parsePhotos();
     $this->assertEquals(200, count($photos), "Should contain 200 photos");
     foreach ($photos as $photo) {
         $this->assertInstanceOf('HabboAPI\\Entities\\Photo', $photo);
     }
 }
Example #2
0
 /** getPhotos returns all 200 public photos or all the users photos if an id is given
  *
  * @param string|null $id The unique ID Habbo uses for their api. Starts with "hh<country code>-" (i.e. "hhus-")
  * @return array Array of Photo objects
  */
 public function getPhotos($id = null)
 {
     return $this->parser->parsePhotos($id);
 }
Example #3
0
 /** Based on a unique ID, get a full Habbo profile object
  *
  * @param string $id The unique ID Habbo uses for their api. Starts with "hh<country code>-" (i.e. "hhus-")
  * @return array
  */
 public function getProfile($id)
 {
     return $this->parser->parseProfile($id);
 }
 /**
  * @expectedException Exception
  */
 public function testErrorHabbo()
 {
     // Replace parseHabbo with static data
     $this->habboParserMock->expects($this->once())->method('_callUrl')->will($this->throwException(new Exception('Some kind of exception')));
     $this->habboParserMock->parseHabbo('someHabboNameThatDoesNotExist');
 }