Пример #1
0
 public function testManageFriends()
 {
     $snapchat = new Snapchat($this->users[1]['name'], $this->users[1]['pass']);
     $this->assertNotEquals($snapchat->auth_token, FALSE, 'Login failed for test user 1.');
     $this->assertEquals($snapchat->addFriend(PHPSnapchatTest::STRANGE_USERNAME), FALSE, 'User 1 added a strange username.');
     $this->assertEquals($snapchat->deleteFriend($this->users[3]['name']), TRUE, 'User 1 deleted an unknown friend.');
     $this->assertEquals($snapchat->addFriend($this->users[3]['name']), TRUE, 'User 1 added user 3 as friend.');
     $this->assertEquals($snapchat->deleteFriend($this->users[3]['name']), TRUE, 'User 1 removed user 3 from friends.');
     $this->assertEquals($snapchat->addFriends(array($this->users[4]['name'], $this->users[5]['name'])), TRUE, 'User 1 added multiple friends.');
     $this->assertEquals($snapchat->deleteFriend($this->users[4]['name']), TRUE, 'User 1 removed user 4 from friends.');
     $this->assertEquals($snapchat->deleteFriend($this->users[5]['name']), TRUE, 'User 1 removed user 5 from friends.');
     $friends = $snapchat->getFriends();
     $this->assertEquals(count($friends) > 0, TRUE);
     $friends = $snapchat->getAddedFriends();
     $this->assertEquals(count($friends) > 0, TRUE);
     $bestFriends = $snapchat->getBests(array($this->users[2]['name']));
     $this->assertEquals(is_int($bestFriends[$this->users[2]['name']]['score']), TRUE);
 }