function test_Anagram_compare_words()
 {
     //arrange
     $test_Anagram = new Anagram();
     $input = 'bread';
     $input2 = 'beard';
     $input3 = 'zoo';
     $input4 = 'berd';
     //act
     $result = $test_Anagram->compareWords($input, $input2);
     $result2 = $test_Anagram->compareWords($input3, $input4);
     //assert
     $this->assertEquals(true, $result);
     $this->assertEquals(false, $result2);
 }
Beispiel #2
0
 function test_compareWords_threeInputsMixedOutput()
 {
     //Arrange
     $test_Anagram = new Anagram();
     $input1 = 'abc';
     $input2 = 'cab,def';
     //Act
     $result = $test_Anagram->compareWords($input1, $input2);
     //Assert
     $this->assertEquals('cab', $result);
 }
Beispiel #3
0
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/Anagram.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('anagram_form.html.twig');
});
$app->get("/results", function () use($app) {
    $new = new Anagram();
    // $letters = array();
    // $test_Anagram->compareWords($letters);
    $output = $new->compareWords($_GET['master'], $_GET['words']);
    return $app['twig']->render('anagram_results.html.twig', array('array' => $output));
});
return $app;