function test_translate_replaceS() { //Arange $test_LeetspeakGenerator = new LeetspeakGenerator(); $input = "access"; $input2 = "success"; $input3 = "I love success not 'strings'"; //Act $result = $test_LeetspeakGenerator->translate($input); $result2 = $test_LeetspeakGenerator->translate($input2); $result3 = $test_LeetspeakGenerator->translate($input3); //Assert $this->assertEquals("acc3zz", $result); $this->assertEquals("succ3zz", $result2); $this->assertEquals("1 l0v3 succ3zz n0t 'stringz'", $result3); }
<?php require_once __DIR__ . "/../vendor/autoload.php"; require_once __DIR__ . "/../src/LeetspeakGenerator.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('index.html.twig'); }); $app->get("/translate_submit", function () use($app) { $my_LeetspeakGenerator = new LeetspeakGenerator(); $result = $my_LeetspeakGenerator->translate($_GET['phrase']); return $app['twig']->render('index.html.twig', array('result' => $result)); }); return $app;