Beispiel #1
0
 function test_invalid_input()
 {
     $test = new Scrabble();
     $input = "encycl2";
     $result = $test->score($input);
     $this->assertEquals("Error not valid input", $result);
 }
 function test_multiple_words()
 {
     $test_Scrabble = new Scrabble();
     $input = "Hello World";
     $result = $test_Scrabble->scrabbleGame($input);
     $this->assertEquals("Error Message", $result);
 }
Beispiel #3
0
 function test_wordValue_word()
 {
     $test_Scrabble = new Scrabble();
     $word = "egchkxz";
     $result = $test_Scrabble->wordValue($word);
     $this->assertEquals(33, $result);
 }
 function testPass_verifyDictionary()
 {
     $test_Scrabble = new Scrabble();
     $input = "understanding";
     $result = $test_Scrabble->verifyDictionary($input);
     $this->AssertEquals(true, $result);
 }
 function test_scrabbleScore_differentMultipleLetterValue()
 {
     //Arrange
     $test_Scrabble = new Scrabble();
     $input = "AppLe";
     //Act
     $result = $test_Scrabble->scrabbleScore($input);
     //Assert
     $this->assertEquals(9, $result);
 }
Beispiel #6
0
 function test_scrabbleScore_multiple_letters()
 {
     //Arrange
     $test_Scrabble = new Scrabble();
     $input = "word";
     //Act
     $calculatedScore = $test_Scrabble->scrabbleScore($input);
     //Assert
     $this->assertEquals("8", $calculatedScore);
 }
 function test_findScore_invalidCharacters()
 {
     //Arrange
     $test_Scrabble = new Scrabble();
     $user_word = "zjkypgt!!";
     //Act
     $result = $test_Scrabble->findScore($user_word);
     //Assert
     $this->assertEquals('This is not a word', $result);
 }
Beispiel #8
0
 function test_scoreScrabble_numberInput()
 {
     //Arrange
     $test_Scrabble = new Scrabble();
     $input = "beg1";
     //Act
     $result = $test_Scrabble->scoreScrabble($input);
     //Assert
     $this->assertEquals("please enter a word", $result);
 }
 function test_mix_character()
 {
     //Arrange
     $test_case = new Scrabble();
     $user_input = "c!@#a%\$#t";
     //Act
     $result = $test_case->scoreCal($user_input);
     //Assert
     $this->assertEquals(5, $result);
 }
Beispiel #10
0
 function test_scoreWord_ignore_nonword()
 {
     //Arrange
     $test_Scrabble = new Scrabble();
     $input = 'ink7er';
     //Act
     $result = $test_Scrabble->scoreWord($input);
     //Assert
     $this->assertEquals("That's not a real, cheater!", $result);
 }
Beispiel #11
0
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/Scrabble.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('scrabble_form.html.twig');
});
$app->get('/score', function () use($app) {
    $new = new Scrabble();
    $output_score = $new->scoreWord($_GET['word']);
    $word = $_GET['word'];
    return $app['twig']->render('score.html.twig', array('score' => $output_score, 'word' => $word));
});
return $app;
Beispiel #12
0
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/Scrabble.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('scrabble.html.twig');
});
$app->get('/scrabble_calculate', function () use($app) {
    $my_Scrabble = new Scrabble();
    $score = $my_Scrabble->wordValue($_GET['input_word']);
    return $app['twig']->render('calculate.html.twig', array('score' => $score));
});
return $app;
Beispiel #13
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../src/Scrabble.php';
$app = new Silex\Application();
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
// Home twig link
$app->get("/", function () use($app) {
    return $app['twig']->render('index.html.twig');
});
$app->post("/results", function () use($app) {
    $new_Scrabble = new Scrabble();
    $results = $new_Scrabble->scoreCal($_POST['input']);
    return $app['twig']->render('results.html.twig', array('result' => $results));
});
return $app;
Beispiel #14
0
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/Scrabble.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('Scrabble.html.twig');
});
$app->get("/score", function () use($app) {
    $new_scrabble = new Scrabble();
    $game_word = $new_scrabble->findScore($_GET['word']);
    return $app['twig']->render('Scrabble.html.twig', array('result' => $game_word));
});
return $app;
Beispiel #15
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../src/Scrabble.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("/score", function () use($app) {
    $my_Score = new Scrabble();
    $your_score = $my_Score->scrabbleScore($_GET['word']);
    return $app['twig']->render('score.html.twig', array('score' => $your_score));
});
return $app;
Beispiel #16
0
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/Scrabble.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_page.html.twig');
});
$app->get("/scrabble_score", function () use($app) {
    $game = new Scrabble();
    $scra_score = $game->score($_GET['word']);
    return $app['twig']->render('scrabble_score.html.twig', array('score' => $scra_score));
});
return $app;
Beispiel #17
0
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/Scrabble.php";
$app = new Silex\Application();
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
//Main Page
$app->get("/", function () use($app) {
    return $app['twig']->render('scrabblehome.html.twig');
});
$app->get("/score_check", function () use($app) {
    $new_Scrabble = new Scrabble();
    $score = $new_Scrabble->scrabbleGame($_GET['word']);
    return $app['twig']->render('scrabblehome.html.twig', array('result' => $score));
});
return $app;
Beispiel #18
0
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/Scrabble.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('scrabble.html.twig');
});
$app->get("/results", function () use($app) {
    $results = new Scrabble();
    $outcome = $results->scrabbleScore($_GET['word_form']);
    return $app['twig']->render('results.html.twig', array('result' => $outcome));
});
return $app;
Beispiel #19
0
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/Scrabble.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('scrabble.html.twig');
});
$app->get("/results", function () use($app) {
    $new_scrabble = new Scrabble();
    $scrabble_result = $new_scrabble->scoreScrabble($_GET['input']);
    return $app['twig']->render('results.html.twig', array('result' => $scrabble_result));
});
return $app;
Beispiel #20
0
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/Scrabble.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('form.html.twig');
});
$app->get("/results", function () use($app) {
    $new_Scrabble = new Scrabble();
    $result = $new_Scrabble->mainMethod($_GET['word']);
    return $app['twig']->render('results.html.twig', array('result' => $result));
});
return $app;