Created
April 19, 2014 03:21
-
-
Save nsanden/11073008 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function testGetVotedFor() | |
{ | |
$contestant1 = new stdClass; | |
$contestant1->name = 'Michael Jordan'; | |
$contestant1->id = 1; | |
$contestant2 = new stdClass; | |
$contestant2->name = 'Patrick Ewing'; | |
$contestant2->id = 2; | |
$comment['message'] = 'I really like Michael Jordan'; | |
$this-assertEquals(getVotedFor($comment, $contestant1, $contestant2), 1); | |
$comment['message'] = 'Micshael is cool!'; | |
$this-assertFalse(getVotedFor($comment, $contestant1, $contestant2)); | |
$comment['message'] = 'patrick ewing is better!'; | |
$this-assertEquals(getVotedFor($comment, $contestant1, $contestant2), 2); | |
$comment['message'] = 'patrickewing is better!'; | |
$this-assertEquals(getVotedFor($comment, $contestant1, $contestant2), 2); | |
$comment['message'] = 'Michael patrickewing is better!'; | |
$this-assertEquals(getVotedFor($comment, $contestant1, $contestant2), 1); | |
$contestant3 = new stdClass; | |
$contestant3->name = 'Kevin Levrone'; | |
$contestant3->id = 1; | |
$contestant4 = new stdClass; | |
$contestant4->name = 'Tom Platz'; | |
$contestant4->id = 2; | |
$comment['message'] = 'Kevin Levrone - I think Tom Platz is awesome, but not in the same league ( partly because of the era)'; | |
$this-assertEquals(getVotedFor($comment, $contestant3, $contestant4), 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment