function test_makeLeet3_0_Caps_I_S() { //Arrange $test_LeetGenerator = new Leet(); $input = 'dog Eat I am i sosks'; //Act $result = $test_LeetGenerator->makeLeet($input); //Assert $this->assertEquals('d0g 3at 1 am i s0zkz', $result); }
protected static function loadIncludePath($includes = null) { self::$base_path = getcwd(); $include_path = ""; if (is_null($includes)) { $includes = array('code', 'fonts', 'php-ga'); } foreach ($includes as $toInclude) { $include_path .= self::$base_path . '/../' . $toInclude . PATH_SEPARATOR; } $include_path = get_include_path() . PATH_SEPARATOR . $include_path; return $include_path; }
// Run Leet require_once 'code/Leet.php'; Leet::run(); $family = Leet::$Request->getParam('family'); $json = Leet::$Request->getParam('json'); // Get the font css if (!empty($family)) { // Get the fonts $names = explode('|', $family); // #36: Set the default charset $fonts = "@charset \"UTF-8\";"; // Get the CSS for each font foreach ($names as $key => $fontname) { $fonts .= Leet::$Fonts->getFamily($fontname); } Leet::track(); // Output is CSS header('Content-type: text/css'); header('Content-Encoding: gzip'); print trim($fonts); exit; } // Get the font JSON if (!empty($json)) { $name = Leet::$Request->getParam('json'); $json = file_get_contents("fonts/{$name}/{$name}-extract.json", FILE_USE_INCLUDE_PATH); $array = json_decode($json, true); $output = array(); foreach ($array as $key => $value) { $output[] = array('name' => $key, 'value' => $value); }
<?php require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/../src/Leet.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("/view_translated_word", function () use($app) { $my_word = new Leet(); $translated_word = $my_word->makeLeet($_GET['phrase']); return $app['twig']->render('new_word.html.twig', array('result' => $translated_word)); }); return $app;