Skip to content

Commit 27676ea

Browse files
author
Dave
committed
tests
1 parent c156345 commit 27676ea

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

build/tests/phpunit/RPSNewControllerGameClassTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,23 @@ public function testExecuteReturnsAnArrayWithGameIntroWhenActionIsNotHomeOrChoos
6161
$this->assertTrue( $returnRay["view"]=="gameIntro" );
6262
}
6363

64+
public function testExecuteReturnsAnArrayWithGameCompleteWhenActionIsChoosePlayersAndRunIsSet() {
65+
$mockPageVars = array();
66+
$mockPageVars["route"] = array();
67+
$mockPageVars["route"]["action"] = "choosePlayers";
68+
$control = new \Controller\Game();
69+
$_REQUEST["run"] = "run";
70+
$_REQUEST["p1type"] = "human";
71+
$_REQUEST["p1choice"] = "rock";
72+
$_REQUEST["p2type"] = "human";
73+
$_REQUEST["p2choice"] = "scissors";
74+
$returnRay = $control->execute($mockPageVars);
75+
$this->assertTrue( array_key_exists("type", $returnRay) );
76+
$this->assertTrue( $returnRay["type"]=="view" );
77+
$this->assertTrue( array_key_exists("view", $returnRay) );
78+
$this->assertTrue( $returnRay["view"]=="gameComplete" );
79+
}
80+
6481
public function testGetRandomPlayerChoiceReturnsValue() {
6582
$control = new \Controller\Game();
6683
$reflector = new ReflectionMethod($control, "getRandomPlayerChoice");

0 commit comments

Comments
 (0)