Example #1
0
<?php

use Anastaszor\Slugify\Slugifier;
use Anastaszor\Slugify\RangeFactory;
use Anastaszor\Slugify\RangeScript;
echo "This is a test script to tests the slugification results of a given string.\n";
echo "Give a string :\n";
$input = fgets(STDIN);
echo "You gave : " . $input . "\n";
require __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
$slugifier = new Slugifier();
$factory = new RangeFactory();
foreach ($factory->getRangesFromScript(RangeScript::ALL()) as $range) {
    $slugifier->handleRange($range, true);
}
echo "Result: " . $slugifier->slugify($input);
echo "\n";
echo "Script ending.";
Example #2
0
 /**
  * Specific test method. This slugifies the $actual value and compares it
  * to the expected value.
  *
  * @param string $expected
  * @param string $actual
  */
 public function assertSlug($expected, $actual)
 {
     $slug = $this->_slugifier->slugify($actual);
     $this->assertEquals($expected, $slug);
 }