function test_counterRepeat_userInputsNothingSentence()
 {
     $test_RepeatCounter = new RepeatCounter();
     $user_word = "taco";
     $user_string = "";
     $result = $test_RepeatCounter->counterRepeat($user_word, $user_string);
     $this->assertEquals(-1, $result);
 }
Esempio n. 2
0
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/RepeatCounter.php";
$app = new Silex\Application();
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
//Form route
$app->get("/", function () use($app) {
    return $app['twig']->render('form.html.twig');
});
//Result route
$app->get("/count", function () use($app) {
    $my_RepeatCounter = new RepeatCounter();
    $the_count = $my_RepeatCounter->counterRepeat($_GET['input_word'], $_GET['input_string']);
    return $app['twig']->render('count.html.twig', array('count' => $the_count));
});
return $app;