Пример #1
0
 function test_findAnagram_multipleWord()
 {
     //Arrange
     $test_Anagram = new Anagram();
     $input = "hey there";
     //Act
     $result = $test_Anagram->findAnagram($input);
     //Assert
     $this->assertEquals("Please enter a single word.", $result);
 }
Пример #2
0
 function test_findAnagram_partialWordMatch()
 {
     //Arrage
     $test_Anagram = new Anagram();
     $word = "sa";
     $test = "sag, sta, tas, abc, fun, sit";
     //Act
     $result = $test_Anagram->findAnagram($word, $test);
     //Assert
     $this->assertEquals("sag, sta, tas", $result);
 }
Пример #3
0
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/Anagram.php";
use Symfony\Component\Debug\Debug;
Debug::enable();
$app = new Silex\Application();
$app['debug'] = true;
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
//Routes
$app->get("/", function () use($app) {
    return $app['twig']->render('anagram_input.html.twig');
});
$app->get("/anagram_results", function () use($app) {
    $new_anagram = new Anagram();
    $anagram_return = $new_anagram->findAnagram($_GET['input_word']);
    return $app['twig']->render('anagram_results.html.twig', array('result' => $anagram_return));
});
return $app;
Пример #4
0
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/Anagram.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('anagram.html.twig');
});
$app->get("/anagram", function () use($app) {
    $anagram = new Anagram();
    $anagram_list = $anagram->findAnagram($_GET['word'], $_GET['test']);
    return $app['twig']->render('anagram_list.html.twig', array('result' => $anagram_list));
});
// $app->get("/anagram", function() use($app){
//     $my_Anagram = new Anagram;
//     $my_anagram_list = $my_Anagram->findAnagram($_GET['word']);
//     return $app['twig']->render('anagram_list.html.twig', array('result' => $anagram_result));
// });
return $app;