function test_game_playerTwoRock() { $test_RockPaperScissors = new RockPaperScissors(); $player_one = "rock"; $result = $test_RockPaperScissors->game($player_one); $this->assertTrue($result == "DRAW!" || $result == "Player One Wins!" || $result == "Computer Wins!"); }
function test_game_playerOneScissorsWin() { $test_RockPaperScissors = new RockPaperScissors(); $player_one = "ScIssorS"; $player_two = "paper"; $result = $test_RockPaperScissors->game($player_one, $player_two); $this->assertEquals("Player One Wins!", $result); }
<?php require_once __DIR__ . "/../vendor/autoload.php"; require_once __DIR__ . "/../src/RockPaperScissors.php"; session_start(); $app = new Silex\Application(); $app->register(new Silex\Provider\TwigServiceProvider(), array("twig.path" => __DIR__ . "/../views")); $app->get("/", function () use($app) { return $app["twig"]->render("game.twig"); }); $app->get("/results", function () use($app) { $this_RockPaperScissors = new RockPaperScissors(); $this_game = $this_RockPaperScissors->game($_GET["player_one"]); return $app["twig"]->render("results.twig", array("gameinfo" => $this_game)); }); return $app;