function test_generatePingPongArray_printPingPong() { $test_PingPongGenerator = new PingPongGenerator(); $input = 15; $result = $test_PingPongGenerator->generatePingPongArray($input); $this->assertEquals([1, 2, "ping", 4, "pong", "ping", 7, 8, "ping", "pong", 11, "ping", 13, 14, "ping-pong"], $result); }
function test_generatePingPongArray() { $test_PingPongGenerator = new PingPongGenerator(); $input = 15; //Act $result = $test_PingPongGenerator->generatePingPongArray($input); //Assert $this->assertEquals(array(1, 2, "ping", 4, "pong", "ping", 7, 8, "ping", "pong", 11, "ping", 13, 14, "ping-pong"), $result); }
function test_generatePingPongArray_count() { //Arrange $test_PingPongGenerator = new PingPongGenerator(); $input = 16; //Act $result = $test_PingPongGenerator->generatePingPongArray($input); //Assert $this->assertEquals(array(1, 2, 'ping', 4, 'pong', 'ping', 7, 8, 'ping', 'pong', 11, 'ping', 13, 14, 'ping-pong', 16), $result); }
function test_makePingPong_numberArray() { //Arrange $test_PingPongGenerator = new PingPongGenerator(); $input = 4; //Act $result = $test_PingPongGenerator->generatePingPongArray($input); //Assert $this->assertEquals(array(1, 2, 3, 4), $result); }
function test_forReplaceFifteen() { //Arrange $test_PingPongGenerator = new PingPongGenerator(); $input = 16; //Act $result = $test_PingPongGenerator->generatePingPongArray($input); //Assert $this->assertEquals([1, 2, "ping", 4, "pong", "ping", 7, 8, "ping", "pong", 11, "ping", 13, 14, "ping pong", 16], $result); }
function test_checkPingPong_true() { // Arrange $test_PingPongGenerator = new PingPongGenerator(); $input = 15; // Act $result = $test_PingPongGenerator->generatePingPongArray($input); // Assert $this->assertEquals(array(1, 2, 'ping', 4, 'pong', 'ping', 7, 8, 'ping', 'pong', 11, 'ping', 13, 14, 'ping pong'), $result); }
function test_makePingPong_oneValue() { //arrange $test_PingPongGenerator = new PingPongGenerator(); $input = 7; //act $result = $test_PingPongGenerator->generatePingPongArray($input); //Assert $this->assertEquals(7, $result); }
function test_pingTestTo15() { //ARRANGE $test_array1 = array("0", "1", "2", "ping", "4", "5", "ping", "7", "8", "ping", "10", "11", "ping", "13", "14", "ping"); $test_pingTest = new PingPongGenerator(); $input = 15; //ACT $results = $test_pingTest->generatePingPongArray($input); //ASSERT $this->assertEquals($test_array1, $results); }
function test_makePingPong_returnPing() { //User Inputs the first number divisable by 3 input: 3 output: [1, 2, "ping"] //Arrange $test_PingPongGenerator = new PingPongGenerator(); $input = 3; //Act $result = $test_PingPongGenerator->generatePingPongArray($input); //Assert $this->assertEquals([1, 2, 'ping'], $result); }
function test_makePingPong_countPingPong() { //Arrange $test_PingPongGenerator = new PingPongGenerator(); $input = 15; //Act $result = $test_PingPongGenerator->generatePingPongArray($input); //Assert $test_array = [1, 2, 'ping', 4, 'pong', 'ping', 7, 8, 'ping', 'pong', 11, 'ping', 13, 14, 'ping-pong']; $this->assertEquals($test_array, $result); }
<?php require_once __DIR__ . "/../vendor/autoload.php"; require_once __DIR__ . "/../src/PingPongGenerator.php"; $app = new Silex\Application(); $app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views')); $app->get("/", function () use($app) { return $app['twig']->render('form.html.twig'); }); $app->get("/ping_pong", function () use($app) { $input = $_GET['number']; $my_PingPongGenerator = new PingPongGenerator(); $results = $my_PingPongGenerator->generatePingPongArray($input); return $app['twig']->render('results.html.twig', array('results' => $results)); }); return $app;
<?php require_once __DIR__ . "/../vendor/autoload.php"; require_once __DIR__ . "/../src/PingPongGenerator.php"; $app = new Silex\Application(); $app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views')); // Root route directs to form.html.twig $app->get("/", function () use($app) { return $app['twig']->render('form.html.twig'); }); // Render ping_pong.html.twig // pass $ping_pong_number as a variable called result $app->get("/view_ping_pong", function () use($app) { $my_PingPongGenerator = new PingPongGenerator(); $ping_pong_number = $my_PingPongGenerator->generatePingPongArray($_GET['number']); return $app['twig']->render('ping_pong.html.twig', array('result' => $ping_pong_number)); }); return $app;
<?php require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/../src/PingPongGenerator.php'; $app = new Silex\Application(); $app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views')); $app->get('/', function () use($app) { return $app['twig']->render('home.html.twig'); }); $app->get('/view_ping_pong', function () use($app) { $inputted_number = $_GET['ending_number']; $new_PingPongGenerator = new PingPongGenerator(); $results = $new_PingPongGenerator->generatePingPongArray($inputted_number); return $app['twig']->render('results.html.twig', array('results' => $results)); }); return $app;
<?php require_once __DIR__ . "/../vendor/autoload.php"; require_once __DIR__ . "/../src/PingPongGenerator.php"; $app = new Silex\Application(); $app['debug'] = true; $app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views')); $app->get("/", function () use($app) { return $app['twig']->render('pong.twig'); }); $app->get("/result", function () use($app) { $pingPong = new PingPongGenerator(); $pingPongResult = $pingPong->generatePingPongArray($_GET['number']); return $app['twig']->render('result.twig', array('results' => $pingPongResult)); }); return $app;
<?php require_once __DIR__ . "/../vendor/autoload.php"; require_once __DIR__ . "/../src/pingpong.php"; $app = new Silex\Application(); $app['debug'] = true; $app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views')); $app->get("/", function () use($app) { return $app['twig']->render('pphome.html.twig'); }); $app->get("/results", function () use($app) { $new_PingPong = new PingPongGenerator(); $output_result = $new_PingPong->generatePingPongArray($_GET['number']); return $app['twig']->render('results.html.twig', array('result' => $output_result)); }); return $app;
<?php require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/../src/PingPongGenerator.php'; $app = new Silex\Application(); $app['debug'] = true; $app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views')); $app->get("/", function () use($app) { return $app['twig']->render('ping-pong-form.html.twig'); }); $app->get("/view_ping_pong", function () use($app) { $new_generator = new PingPongGenerator(); $ping_pong_array = $new_generator->generatePingPongArray($_GET['number']); return $app['twig']->render('ping-pong-result.html.twig', array('results' => $ping_pong_array)); }); return $app;