function test_makeTitleCase_multipleWords()
 {
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "beowulf is great";
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     $this->assertEquals("Beowulf Is Great", $result);
 }
 function test_TitleCase_multipleWords()
 {
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "the little mermaid";
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     $this->assertEquals("The Little Mermaid", $result);
 }
 function test_makeTitleCase_designatedWords()
 {
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "i am legend from the future";
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     $this->assertEquals("I Am Legend from the Future", $result);
 }
예제 #4
0
 function test_makeTitleCase_multipleWords()
 {
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "dark lord ganon";
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     $this->assertEquals("Dark Lord Ganon", $result);
 }
예제 #5
0
 function test_makeTitleCase_conjuctionWords()
 {
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "the little mermaid And friends";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("The Little Mermaid and Friends", $result);
 }
예제 #6
0
 function test_makeTitleCase_designated_words()
 {
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "of 1234 of retuRn Of tHe jedi";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("Of 1234 of Return of the Jedi", $result);
 }
 function test_makeTitleCase_firstWord()
 {
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "the little mermaid";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("The Little Mermaid", $result);
 }
 function test_makeTitleCase_mixedCaps()
 {
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "BeoWolf aNd mE";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("Beowolf and Me", $result);
 }
 function test_makeTitleCase_mixedCase()
 {
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "THe TwO ToWErS";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("The Two Towers", $result);
 }
 function test_makeTitleCase_mixedCase()
 {
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "lIvE AnD LeT dIe";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("Live and Let Die", $result);
 }
 function test_makeTitleCase_handleMixed()
 {
     //Arrange
     $test = new TitleCaseGenerator();
     $input = "BeOWuLF On ThE RoCkS";
     //Act
     $result = $test->makeTitleCase($input);
     //Assert
     $this->assertEquals("Beowulf on the Rocks", $result);
 }
 function test_makeTitleCase_mixedCaseCharacters()
 {
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "tHe sHiNiNG";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("The Shining", $result);
 }
예제 #13
0
 function test_makeTitleCase_unusualNames()
 {
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "here's to beowulf and McDuff and O'Malley";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("Here's to Beowulf and McDuff and O'Malley", $result);
 }
 function test_makeTitleCase_uniqueName()
 {
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "the car went to o'malley's";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("The Car Went to O'Malley's", $result);
 }
예제 #15
0
 function test_makeTitleCase_lowerCase()
 {
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "Father OF The Bride";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("Father of the Bride", $result);
 }
 function test_makeTitleCase_mixedCapsWords()
 {
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "from tAcO to buRRito";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("From Taco to Burrito", $result);
 }
예제 #17
0
 function test_makeTitleCase_multipleWords()
 {
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "the wisest tribble";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("The Wisest Tribble", $result);
 }
 function test_makeTitleCase_upperCaseCharacters()
 {
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "THE 57 BEOWULF ALTERNATIVE ENDINGS WERE TERRIBLE";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("The 57 Beowulf Alternative Endings Were Terrible", $result);
 }
 function test_makeTitleCase_upCaseWords()
 {
     // Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "THE JUNGLE BOOK";
     // Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     // Assert
     $this->assertEquals("The Jungle Book", $result);
 }
 function test_makeTitleCase_firstLetterLastWord()
 {
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "where the wild things are";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("Where the Wild Things Are", $result);
 }
예제 #21
0
파일: app.php 프로젝트: bborealis/TitleCase
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/TitleCaseGenerator.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('create_title.html.twig');
});
$app->get("/titles", function () use($app) {
    $titles = new TitleCaseGenerator();
    $title_cased_phrase = $titles->makeTitleCase($_GET['format']);
    //$formatted_title = function makeTitleCase($title);
    return $app['twig']->render('output.html.twig', array('title' => $title_cased_phrase));
});
return $app;
 function test_makeTitleCase_prepositionsFirst()
 {
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "from the bay to the seaside";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("From the Bay to the Seaside", $result);
 }
 function test_makeTitleCase_mc()
 {
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "mcdonald";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("McDonald", $result);
 }
예제 #24
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../src/TitleCaseGenerator.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.html.twig");
});
$app->get('/view_title_case', function () use($app) {
    $new_title_case = new TitleCaseGenerator();
    $user_input_title_case = $new_title_case->makeTitleCase($_GET['phrase']);
    return $user_input_title_case;
});
return $app;
 function test_makeTitleCase_mixedCase()
 {
     /* TCG takes a string of mixed-case words and returns a properly capitalized title. */
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "BeoWulf aNd mE";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("Beowulf and Me", $result);
 }
예제 #26
0
 function test_makeTitleCase_intrawordExceptions()
 {
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "george maccloud";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("George MacCloud", $result);
 }
 function test_makeTitleCase_uniqueStrings()
 {
     //It handles unique strings like "O'Malley" or "McCool"
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "here's to beowulf and McDuff and O'Malley";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("Here's to Beowulf and McDuff and O'Malley", $result);
 }
예제 #28
0
 function test_makeTitleCase_acronymCap()
 {
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "i love PHP";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("I Love PHP", $result);
 }
예제 #29
0
<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/TitleCaseGenerator.php";
//require_once __DIR__."/../vendor/bin/phpunit";
$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("/view_title_case", function () use($app) {
    $my_TitleCaseGenerator = new TitleCaseGenerator();
    $title_cased_phrase = $my_TitleCaseGenerator->makeTitleCase($_GET['phrase']);
    return $app['twig']->render('title_cased.html.twig', array('result' => $title_cased_phrase));
});
return $app;
 function test_makeUniqueCaseTitleCase()
 {
     //Arrange
     $test_TitleCaseGenerator = new TitleCaseGenerator();
     $input = "My last name is mckenney and o'brian";
     //Act
     $result = $test_TitleCaseGenerator->makeTitleCase($input);
     //Assert
     $this->assertEquals("My Last Name is McKenney and O'Brian", $result);
 }