Пример #1
0
 function test_PingPong_pingPong()
 {
     //arrange
     $test_PingPong = new PingPong();
     $input = 15;
     //act
     $result = $test_PingPong->runPingPong($input);
     //assert
     $this->assertEquals(array(1, 2, "ping", 4, "pong", "ping", 7, 8, "ping", "pong", 11, "ping", 13, 14, "pingpong"), $result);
 }
Пример #2
0
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/PingPong.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('index.html.twig');
});
$app->get("/ping-pong", function () use($app) {
    $number_input = $_GET['number'];
    $newPingPong = new PingPong();
    $results = $newPingPong->runPingPong($number_input);
    return $app['twig']->render('index.html.twig', array("results" => $results));
});
return $app;