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_makePingPong_multipleNumbers()
 {
     $test_PingPongGenerator = new PingPongGenerator();
     $input = "2";
     $result = $test_PingPongGenerator->makePingPong($input);
     $this->assertEquals("1, 2", $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_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_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_oneValue()
 {
     //arrange
     $test_PingPongGenerator = new PingPongGenerator();
     $input = 7;
     //act
     $result = $test_PingPongGenerator->generatePingPongArray($input);
     //Assert
     $this->assertEquals(7, $result);
 }
 function test_pingPong_count()
 {
     //Arrange
     $test_PingPong = new PingPongGenerator();
     $input = 18;
     //Act
     $result = $test_PingPong->pingPong($input);
     //Assert
     $this->assertEquals([1, 2, "ping", 4, "pong", "ping", 7, 8, "ping", "pong", 11, "ping", 13, 14, "ping-pong", 16, 17, "ping"], $result);
 }
 function test_makePingPong_checkThree_Five()
 {
     //Arange
     $test_PingPongGenerator = new PingPongGenerator();
     $input = 15;
     //Act
     $result = $test_PingPongGenerator->makePingPong($input);
     //Assert
     $this->assertEquals("PingPong", $result);
 }
 function test_playPingPong_numberFifteen()
 {
     //Arrange
     $test_PingPongGenerator = new PingPongGenerator();
     $input = "15";
     //Act
     $result = $test_PingPongGenerator->playPingPong($input);
     //Assert
     $this->assertEquals("1, 2, ping, 4, pong, ping, 7, 8, ping, pong, 11, ping, 13, 14, ping pong", $result);
 }
Example #10
0
 function test_printPong()
 {
     //Arrange
     $test_PingPongGenerator = new PingPongGenerator();
     $input = '15';
     //Act
     $result = $test_PingPongGenerator->makeNumberList($input);
     //Assert
     $this->assertEquals('1,2,PING,4,PONG,PING,7,8,PING,PONG,11,PING,13,14,PINGPONG', $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_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_forDivisibleByThreeFive()
 {
     //Arrange
     $test_PingPongGenerator = new PingPongGenerator();
     $input = 15;
     //Act
     $result = $test_PingPongGenerator->makePingPong($input);
     //Assert
     $this->assertEquals("ping-pong", $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);
 }
Example #17
0
<?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;
Example #18
0
<?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;
Example #19
0
<?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;
Example #20
0
<?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;
Example #21
0
<?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;
Example #22
0
<?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('index.html.twig');
});
$app->get("/view_ping_pong", function () use($app) {
    $output_array = array();
    for ($i = 1; $i <= $_GET['number']; $i++) {
        $number = new PingPongGenerator();
        array_push($output_array, $number->makePingPong($i));
    }
    return $app['twig']->render('ping-pong-generator.html.twig', array('result' => $output_array));
});
return $app;
Example #23
0
<?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("/results", function () use($app) {
    $my_PingPongGenerator = new PingPongGenerator();
    $pingPongResult = $my_PingPongGenerator->makePingPong($_GET['input_number']);
    return $app['twig']->render('results.html.twig', array('results' => $pingPongResult));
});
return $app;
Example #24
0
<?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;