Laravel version update
Laravel version update
This commit is contained in:
4
vendor/doctrine/inflector/.gitignore
vendored
4
vendor/doctrine/inflector/.gitignore
vendored
@@ -1,4 +0,0 @@
|
||||
vendor/
|
||||
composer.lock
|
||||
composer.phar
|
||||
phpunit.xml
|
||||
21
vendor/doctrine/inflector/.travis.yml
vendored
21
vendor/doctrine/inflector/.travis.yml
vendored
@@ -1,21 +0,0 @@
|
||||
language: php
|
||||
|
||||
sudo: false
|
||||
|
||||
cache:
|
||||
directory:
|
||||
- $HOME/.composer/cache
|
||||
|
||||
php:
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
- hhvm
|
||||
|
||||
install:
|
||||
- composer install -n
|
||||
|
||||
script:
|
||||
- phpunit
|
||||
11
vendor/doctrine/inflector/composer.json
vendored
11
vendor/doctrine/inflector/composer.json
vendored
@@ -13,17 +13,20 @@
|
||||
{"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.2"
|
||||
"php": "^7.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.*"
|
||||
"phpunit/phpunit": "^6.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "Doctrine\\Common\\Inflector\\": "lib/" }
|
||||
"psr-4": { "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" }
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": { "Doctrine\\Tests\\Common\\Inflector\\": "tests/Doctrine/Tests/Common/Inflector" }
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1.x-dev"
|
||||
"dev-master": "1.3.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class Inflector
|
||||
/**
|
||||
* Plural inflector rules.
|
||||
*
|
||||
* @var array
|
||||
* @var string[][]
|
||||
*/
|
||||
private static $plural = array(
|
||||
'rules' => array(
|
||||
@@ -49,10 +49,11 @@ class Inflector
|
||||
'/(matr|vert|ind)(ix|ex)$/i' => '\1ices',
|
||||
'/(x|ch|ss|sh)$/i' => '\1es',
|
||||
'/([^aeiouy]|qu)y$/i' => '\1ies',
|
||||
'/(hive)$/i' => '\1s',
|
||||
'/(hive|gulf)$/i' => '\1s',
|
||||
'/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
|
||||
'/sis$/i' => 'ses',
|
||||
'/([ti])um$/i' => '\1a',
|
||||
'/(c)riterion$/i' => '\1riteria',
|
||||
'/(p)erson$/i' => '\1eople',
|
||||
'/(m)an$/i' => '\1en',
|
||||
'/(c)hild$/i' => '\1hildren',
|
||||
@@ -67,7 +68,16 @@ class Inflector
|
||||
'/$/' => 's',
|
||||
),
|
||||
'uninflected' => array(
|
||||
'.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox', '.*sheep', 'people', 'cookie'
|
||||
'.*[nrlm]ese',
|
||||
'.*deer',
|
||||
'.*fish',
|
||||
'.*measles',
|
||||
'.*ois',
|
||||
'.*pox',
|
||||
'.*sheep',
|
||||
'people',
|
||||
'cookie',
|
||||
'police',
|
||||
),
|
||||
'irregular' => array(
|
||||
'atlas' => 'atlases',
|
||||
@@ -76,6 +86,7 @@ class Inflector
|
||||
'brother' => 'brothers',
|
||||
'cafe' => 'cafes',
|
||||
'chateau' => 'chateaux',
|
||||
'niveau' => 'niveaux',
|
||||
'child' => 'children',
|
||||
'cookie' => 'cookies',
|
||||
'corpus' => 'corpuses',
|
||||
@@ -90,11 +101,13 @@ class Inflector
|
||||
'ganglion' => 'ganglions',
|
||||
'genie' => 'genies',
|
||||
'genus' => 'genera',
|
||||
'goose' => 'geese',
|
||||
'graffito' => 'graffiti',
|
||||
'hippopotamus' => 'hippopotami',
|
||||
'hoof' => 'hoofs',
|
||||
'human' => 'humans',
|
||||
'iris' => 'irises',
|
||||
'larva' => 'larvae',
|
||||
'leaf' => 'leaves',
|
||||
'loaf' => 'loaves',
|
||||
'man' => 'men',
|
||||
@@ -112,6 +125,7 @@ class Inflector
|
||||
'octopus' => 'octopuses',
|
||||
'opus' => 'opuses',
|
||||
'ox' => 'oxen',
|
||||
'passerby' => 'passersby',
|
||||
'penis' => 'penises',
|
||||
'person' => 'people',
|
||||
'plateau' => 'plateaux',
|
||||
@@ -126,6 +140,7 @@ class Inflector
|
||||
'tornado' => 'tornadoes',
|
||||
'trilby' => 'trilbys',
|
||||
'turf' => 'turfs',
|
||||
'valve' => 'valves',
|
||||
'volcano' => 'volcanoes',
|
||||
)
|
||||
);
|
||||
@@ -133,7 +148,7 @@ class Inflector
|
||||
/**
|
||||
* Singular inflector rules.
|
||||
*
|
||||
* @var array
|
||||
* @var string[][]
|
||||
*/
|
||||
private static $singular = array(
|
||||
'rules' => array(
|
||||
@@ -161,9 +176,12 @@ class Inflector
|
||||
'/(tive)s$/i' => '\1',
|
||||
'/(hive)s$/i' => '\1',
|
||||
'/(drive)s$/i' => '\1',
|
||||
'/(dive)s$/i' => '\1',
|
||||
'/(olive)s$/i' => '\1',
|
||||
'/([^fo])ves$/i' => '\1fe',
|
||||
'/(^analy)ses$/i' => '\1sis',
|
||||
'/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
|
||||
'/(c)riteria$/i' => '\1riterion',
|
||||
'/([ti])a$/i' => '\1um',
|
||||
'/(p)eople$/i' => '\1\2erson',
|
||||
'/(m)en$/i' => '\1an',
|
||||
@@ -183,17 +201,27 @@ class Inflector
|
||||
'.*pox',
|
||||
'.*sheep',
|
||||
'.*ss',
|
||||
'data',
|
||||
'police',
|
||||
'pants',
|
||||
'clothes',
|
||||
),
|
||||
'irregular' => array(
|
||||
'criteria' => 'criterion',
|
||||
'curves' => 'curve',
|
||||
'emphases' => 'emphasis',
|
||||
'foes' => 'foe',
|
||||
'hoaxes' => 'hoax',
|
||||
'media' => 'medium',
|
||||
'neuroses' => 'neurosis',
|
||||
'waves' => 'wave',
|
||||
'oases' => 'oasis',
|
||||
'abuses' => 'abuse',
|
||||
'avalanches' => 'avalanche',
|
||||
'caches' => 'cache',
|
||||
'criteria' => 'criterion',
|
||||
'curves' => 'curve',
|
||||
'emphases' => 'emphasis',
|
||||
'foes' => 'foe',
|
||||
'geese' => 'goose',
|
||||
'graves' => 'grave',
|
||||
'hoaxes' => 'hoax',
|
||||
'media' => 'medium',
|
||||
'neuroses' => 'neurosis',
|
||||
'waves' => 'wave',
|
||||
'oases' => 'oasis',
|
||||
'valves' => 'valve',
|
||||
)
|
||||
);
|
||||
|
||||
@@ -203,18 +231,18 @@ class Inflector
|
||||
* @var array
|
||||
*/
|
||||
private static $uninflected = array(
|
||||
'Amoyese', 'bison', 'Borghese', 'bream', 'breeches', 'britches', 'buffalo', 'cantus',
|
||||
'carp', 'chassis', 'clippers', 'cod', 'coitus', 'Congoese', 'contretemps', 'corps',
|
||||
'debris', 'diabetes', 'djinn', 'eland', 'elk', 'equipment', 'Faroese', 'flounder',
|
||||
'Foochowese', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'graffiti',
|
||||
'headquarters', 'herpes', 'hijinks', 'Hottentotese', 'information', 'innings',
|
||||
'jackanapes', 'Kiplingese', 'Kongoese', 'Lucchese', 'mackerel', 'Maltese', '.*?media',
|
||||
'mews', 'moose', 'mumps', 'Nankingese', 'news', 'nexus', 'Niasese',
|
||||
'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'pliers', 'Portuguese',
|
||||
'proceedings', 'rabies', 'rice', 'rhinoceros', 'salmon', 'Sarawakese', 'scissors',
|
||||
'sea[- ]bass', 'series', 'Shavese', 'shears', 'siemens', 'species', 'staff', 'swine',
|
||||
'testes', 'trousers', 'trout', 'tuna', 'Vermontese', 'Wenchowese', 'whiting',
|
||||
'wildebeest', 'Yengeese'
|
||||
'.*?media', 'Amoyese', 'audio', 'bison', 'Borghese', 'bream', 'breeches',
|
||||
'britches', 'buffalo', 'cantus', 'carp', 'chassis', 'clippers', 'cod', 'coitus', 'compensation', 'Congoese',
|
||||
'contretemps', 'coreopsis', 'corps', 'data', 'debris', 'deer', 'diabetes', 'djinn', 'education', 'eland',
|
||||
'elk', 'emoji', 'equipment', 'evidence', 'Faroese', 'feedback', 'fish', 'flounder', 'Foochowese',
|
||||
'Furniture', 'furniture', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'gold',
|
||||
'headquarters', 'herpes', 'hijinks', 'Hottentotese', 'information', 'innings', 'jackanapes', 'jedi',
|
||||
'Kiplingese', 'knowledge', 'Kongoese', 'love', 'Lucchese', 'Luggage', 'mackerel', 'Maltese', 'metadata',
|
||||
'mews', 'moose', 'mumps', 'Nankingese', 'news', 'nexus', 'Niasese', 'nutrition', 'offspring',
|
||||
'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'plankton', 'pliers', 'pokemon', 'police', 'Portuguese',
|
||||
'proceedings', 'rabies', 'rain', 'rhinoceros', 'rice', 'salmon', 'Sarawakese', 'scissors', 'sea[- ]bass',
|
||||
'series', 'Shavese', 'shears', 'sheep', 'siemens', 'species', 'staff', 'swine', 'traffic',
|
||||
'trousers', 'trout', 'tuna', 'us', 'Vermontese', 'Wenchowese', 'wheat', 'whiting', 'wildebeest', 'Yengeese'
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -233,36 +261,24 @@ class Inflector
|
||||
|
||||
/**
|
||||
* Converts a word into the format for a Doctrine table name. Converts 'ModelName' to 'model_name'.
|
||||
*
|
||||
* @param string $word The word to tableize.
|
||||
*
|
||||
* @return string The tableized word.
|
||||
*/
|
||||
public static function tableize($word)
|
||||
public static function tableize(string $word) : string
|
||||
{
|
||||
return strtolower(preg_replace('~(?<=\\w)([A-Z])~', '_$1', $word));
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a word into the format for a Doctrine class name. Converts 'table_name' to 'TableName'.
|
||||
*
|
||||
* @param string $word The word to classify.
|
||||
*
|
||||
* @return string The classified word.
|
||||
*/
|
||||
public static function classify($word)
|
||||
public static function classify(string $word) : string
|
||||
{
|
||||
return str_replace(" ", "", ucwords(strtr($word, "_-", " ")));
|
||||
return str_replace([' ', '_', '-'], '', ucwords($word, ' _-'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Camelizes a word. This uses the classify() method and turns the first character to lowercase.
|
||||
*
|
||||
* @param string $word The word to camelize.
|
||||
*
|
||||
* @return string The camelized word.
|
||||
*/
|
||||
public static function camelize($word)
|
||||
public static function camelize(string $word) : string
|
||||
{
|
||||
return lcfirst(self::classify($word));
|
||||
}
|
||||
@@ -271,7 +287,7 @@ class Inflector
|
||||
* Uppercases words with configurable delimeters between words.
|
||||
*
|
||||
* Takes a string and capitalizes all of the words, like PHP's built-in
|
||||
* ucwords function. This extends that behavior, however, by allowing the
|
||||
* ucwords function. This extends that behavior, however, by allowing the
|
||||
* word delimeters to be configured, rather than only separating on
|
||||
* whitespace.
|
||||
*
|
||||
@@ -292,24 +308,16 @@ class Inflector
|
||||
*
|
||||
* @return string The string with all delimeter-separated words capitalized.
|
||||
*/
|
||||
public static function ucwords($string, $delimiters = " \n\t\r\0\x0B-")
|
||||
public static function ucwords(string $string, string $delimiters = " \n\t\r\0\x0B-") : string
|
||||
{
|
||||
return preg_replace_callback(
|
||||
'/[^' . preg_quote($delimiters, '/') . ']+/',
|
||||
function($matches) {
|
||||
return ucfirst($matches[0]);
|
||||
},
|
||||
$string
|
||||
);
|
||||
return ucwords($string, $delimiters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears Inflectors inflected value caches, and resets the inflection
|
||||
* rules to the initial values.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function reset()
|
||||
public static function reset() : void
|
||||
{
|
||||
if (empty(self::$initialState)) {
|
||||
self::$initialState = get_class_vars('Inflector');
|
||||
@@ -318,7 +326,7 @@ class Inflector
|
||||
}
|
||||
|
||||
foreach (self::$initialState as $key => $val) {
|
||||
if ($key != 'initialState') {
|
||||
if ($key !== 'initialState') {
|
||||
self::${$key} = $val;
|
||||
}
|
||||
}
|
||||
@@ -338,14 +346,14 @@ class Inflector
|
||||
* ));
|
||||
* }}}
|
||||
*
|
||||
* @param string $type The type of inflection, either 'plural' or 'singular'
|
||||
* @param array $rules An array of rules to be added.
|
||||
* @param boolean $reset If true, will unset default inflections for all
|
||||
* new rules that are being defined in $rules.
|
||||
* @param string $type The type of inflection, either 'plural' or 'singular'
|
||||
* @param array|iterable $rules An array of rules to be added.
|
||||
* @param boolean $reset If true, will unset default inflections for all
|
||||
* new rules that are being defined in $rules.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function rules($type, $rules, $reset = false)
|
||||
public static function rules(string $type, iterable $rules, bool $reset = false) : void
|
||||
{
|
||||
foreach ($rules as $rule => $pattern) {
|
||||
if ( ! is_array($pattern)) {
|
||||
@@ -383,7 +391,7 @@ class Inflector
|
||||
*
|
||||
* @return string The word in plural form.
|
||||
*/
|
||||
public static function pluralize($word)
|
||||
public static function pluralize(string $word) : string
|
||||
{
|
||||
if (isset(self::$cache['pluralize'][$word])) {
|
||||
return self::$cache['pluralize'][$word];
|
||||
@@ -403,8 +411,8 @@ class Inflector
|
||||
}
|
||||
|
||||
if (preg_match('/(.*)\\b(' . self::$plural['cacheIrregular'] . ')$/i', $word, $regs)) {
|
||||
self::$cache['pluralize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$plural['merged']['irregular'][strtolower($regs[2])], 1);
|
||||
|
||||
self::$cache['pluralize'][$word] = $regs[1] . $word[0] . substr(self::$plural['merged']['irregular'][strtolower($regs[2])], 1);
|
||||
|
||||
return self::$cache['pluralize'][$word];
|
||||
}
|
||||
|
||||
@@ -430,7 +438,7 @@ class Inflector
|
||||
*
|
||||
* @return string The word in singular form.
|
||||
*/
|
||||
public static function singularize($word)
|
||||
public static function singularize(string $word) : string
|
||||
{
|
||||
if (isset(self::$cache['singularize'][$word])) {
|
||||
return self::$cache['singularize'][$word];
|
||||
@@ -451,13 +459,13 @@ class Inflector
|
||||
}
|
||||
|
||||
if (!isset(self::$singular['cacheUninflected']) || !isset(self::$singular['cacheIrregular'])) {
|
||||
self::$singular['cacheUninflected'] = '(?:' . join('|', self::$singular['merged']['uninflected']) . ')';
|
||||
self::$singular['cacheIrregular'] = '(?:' . join('|', array_keys(self::$singular['merged']['irregular'])) . ')';
|
||||
self::$singular['cacheUninflected'] = '(?:' . implode('|', self::$singular['merged']['uninflected']) . ')';
|
||||
self::$singular['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$singular['merged']['irregular'])) . ')';
|
||||
}
|
||||
|
||||
if (preg_match('/(.*)\\b(' . self::$singular['cacheIrregular'] . ')$/i', $word, $regs)) {
|
||||
self::$cache['singularize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$singular['merged']['irregular'][strtolower($regs[2])], 1);
|
||||
|
||||
self::$cache['singularize'][$word] = $regs[1] . $word[0] . substr(self::$singular['merged']['irregular'][strtolower($regs[2])], 1);
|
||||
|
||||
return self::$cache['singularize'][$word];
|
||||
}
|
||||
|
||||
|
||||
31
vendor/doctrine/inflector/phpunit.xml.dist
vendored
31
vendor/doctrine/inflector/phpunit.xml.dist
vendored
@@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false"
|
||||
bootstrap="./tests/Doctrine/Tests/TestInit.php"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Doctrine Inflector Test Suite">
|
||||
<directory>./tests/Doctrine/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory>./lib/Doctrine/</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
|
||||
<groups>
|
||||
<exclude>
|
||||
<group>performance</group>
|
||||
</exclude>
|
||||
</groups>
|
||||
</phpunit>
|
||||
@@ -1,309 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Common\Inflector;
|
||||
|
||||
use Doctrine\Tests\DoctrineTestCase;
|
||||
use Doctrine\Common\Inflector\Inflector;
|
||||
|
||||
class InflectorTest extends DoctrineTestCase
|
||||
{
|
||||
/**
|
||||
* Singular & Plural test data. Returns an array of sample words.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function dataSampleWords()
|
||||
{
|
||||
Inflector::reset();
|
||||
|
||||
// In the format array('singular', 'plural')
|
||||
return array(
|
||||
array('', ''),
|
||||
array('Alias', 'Aliases'),
|
||||
array('alumnus', 'alumni'),
|
||||
array('analysis', 'analyses'),
|
||||
array('aquarium', 'aquaria'),
|
||||
array('arch', 'arches'),
|
||||
array('atlas', 'atlases'),
|
||||
array('axe', 'axes'),
|
||||
array('baby', 'babies'),
|
||||
array('bacillus', 'bacilli'),
|
||||
array('bacterium', 'bacteria'),
|
||||
array('bureau', 'bureaus'),
|
||||
array('bus', 'buses'),
|
||||
array('Bus', 'Buses'),
|
||||
array('cactus', 'cacti'),
|
||||
array('cafe', 'cafes'),
|
||||
array('calf', 'calves'),
|
||||
array('categoria', 'categorias'),
|
||||
array('chateau', 'chateaux'),
|
||||
array('cherry', 'cherries'),
|
||||
array('child', 'children'),
|
||||
array('church', 'churches'),
|
||||
array('circus', 'circuses'),
|
||||
array('city', 'cities'),
|
||||
array('cod', 'cod'),
|
||||
array('cookie', 'cookies'),
|
||||
array('copy', 'copies'),
|
||||
array('crisis', 'crises'),
|
||||
array('criterion', 'criteria'),
|
||||
array('curriculum', 'curricula'),
|
||||
array('curve', 'curves'),
|
||||
array('deer', 'deer'),
|
||||
array('demo', 'demos'),
|
||||
array('dictionary', 'dictionaries'),
|
||||
array('domino', 'dominoes'),
|
||||
array('dwarf', 'dwarves'),
|
||||
array('echo', 'echoes'),
|
||||
array('elf', 'elves'),
|
||||
array('emphasis', 'emphases'),
|
||||
array('family', 'families'),
|
||||
array('fax', 'faxes'),
|
||||
array('fish', 'fish'),
|
||||
array('flush', 'flushes'),
|
||||
array('fly', 'flies'),
|
||||
array('focus', 'foci'),
|
||||
array('foe', 'foes'),
|
||||
array('food_menu', 'food_menus'),
|
||||
array('FoodMenu', 'FoodMenus'),
|
||||
array('foot', 'feet'),
|
||||
array('fungus', 'fungi'),
|
||||
array('glove', 'gloves'),
|
||||
array('half', 'halves'),
|
||||
array('hero', 'heroes'),
|
||||
array('hippopotamus', 'hippopotami'),
|
||||
array('hoax', 'hoaxes'),
|
||||
array('house', 'houses'),
|
||||
array('human', 'humans'),
|
||||
array('identity', 'identities'),
|
||||
array('index', 'indices'),
|
||||
array('iris', 'irises'),
|
||||
array('kiss', 'kisses'),
|
||||
array('knife', 'knives'),
|
||||
array('leaf', 'leaves'),
|
||||
array('life', 'lives'),
|
||||
array('loaf', 'loaves'),
|
||||
array('man', 'men'),
|
||||
array('matrix', 'matrices'),
|
||||
array('matrix_row', 'matrix_rows'),
|
||||
array('medium', 'media'),
|
||||
array('memorandum', 'memoranda'),
|
||||
array('menu', 'menus'),
|
||||
array('Menu', 'Menus'),
|
||||
array('mess', 'messes'),
|
||||
array('moose', 'moose'),
|
||||
array('motto', 'mottoes'),
|
||||
array('mouse', 'mice'),
|
||||
array('neurosis', 'neuroses'),
|
||||
array('news', 'news'),
|
||||
array('NodeMedia', 'NodeMedia'),
|
||||
array('nucleus', 'nuclei'),
|
||||
array('oasis', 'oases'),
|
||||
array('octopus', 'octopuses'),
|
||||
array('pass', 'passes'),
|
||||
array('person', 'people'),
|
||||
array('plateau', 'plateaux'),
|
||||
array('potato', 'potatoes'),
|
||||
array('powerhouse', 'powerhouses'),
|
||||
array('quiz', 'quizzes'),
|
||||
array('radius', 'radii'),
|
||||
array('reflex', 'reflexes'),
|
||||
array('roof', 'roofs'),
|
||||
array('runner-up', 'runners-up'),
|
||||
array('scarf', 'scarves'),
|
||||
array('scratch', 'scratches'),
|
||||
array('series', 'series'),
|
||||
array('sheep', 'sheep'),
|
||||
array('shelf', 'shelves'),
|
||||
array('shoe', 'shoes'),
|
||||
array('son-in-law', 'sons-in-law'),
|
||||
array('species', 'species'),
|
||||
array('splash', 'splashes'),
|
||||
array('spy', 'spies'),
|
||||
array('stimulus', 'stimuli'),
|
||||
array('stitch', 'stitches'),
|
||||
array('story', 'stories'),
|
||||
array('syllabus', 'syllabi'),
|
||||
array('tax', 'taxes'),
|
||||
array('terminus', 'termini'),
|
||||
array('thesis', 'theses'),
|
||||
array('thief', 'thieves'),
|
||||
array('tomato', 'tomatoes'),
|
||||
array('tooth', 'teeth'),
|
||||
array('tornado', 'tornadoes'),
|
||||
array('try', 'tries'),
|
||||
array('vertex', 'vertices'),
|
||||
array('virus', 'viri'),
|
||||
array('volcano', 'volcanoes'),
|
||||
array('wash', 'washes'),
|
||||
array('watch', 'watches'),
|
||||
array('wave', 'waves'),
|
||||
array('wharf', 'wharves'),
|
||||
array('wife', 'wives'),
|
||||
array('woman', 'women'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* testInflectingSingulars method
|
||||
*
|
||||
* @dataProvider dataSampleWords
|
||||
* @return void
|
||||
*/
|
||||
public function testInflectingSingulars($singular, $plural)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$singular,
|
||||
Inflector::singularize($plural),
|
||||
"'$plural' should be singularized to '$singular'"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* testInflectingPlurals method
|
||||
*
|
||||
* @dataProvider dataSampleWords
|
||||
* @return void
|
||||
*/
|
||||
public function testInflectingPlurals($singular, $plural)
|
||||
{
|
||||
$this->assertEquals(
|
||||
$plural,
|
||||
Inflector::pluralize($singular),
|
||||
"'$singular' should be pluralized to '$plural'"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* testCustomPluralRule method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomPluralRule()
|
||||
{
|
||||
Inflector::reset();
|
||||
Inflector::rules('plural', array('/^(custom)$/i' => '\1izables'));
|
||||
|
||||
$this->assertEquals(Inflector::pluralize('custom'), 'customizables');
|
||||
|
||||
Inflector::rules('plural', array('uninflected' => array('uninflectable')));
|
||||
|
||||
$this->assertEquals(Inflector::pluralize('uninflectable'), 'uninflectable');
|
||||
|
||||
Inflector::rules('plural', array(
|
||||
'rules' => array('/^(alert)$/i' => '\1ables'),
|
||||
'uninflected' => array('noflect', 'abtuse'),
|
||||
'irregular' => array('amaze' => 'amazable', 'phone' => 'phonezes')
|
||||
));
|
||||
|
||||
$this->assertEquals(Inflector::pluralize('noflect'), 'noflect');
|
||||
$this->assertEquals(Inflector::pluralize('abtuse'), 'abtuse');
|
||||
$this->assertEquals(Inflector::pluralize('alert'), 'alertables');
|
||||
$this->assertEquals(Inflector::pluralize('amaze'), 'amazable');
|
||||
$this->assertEquals(Inflector::pluralize('phone'), 'phonezes');
|
||||
}
|
||||
|
||||
/**
|
||||
* testCustomSingularRule method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomSingularRule()
|
||||
{
|
||||
Inflector::reset();
|
||||
Inflector::rules('singular', array('/(eple)r$/i' => '\1', '/(jente)r$/i' => '\1'));
|
||||
|
||||
$this->assertEquals(Inflector::singularize('epler'), 'eple');
|
||||
$this->assertEquals(Inflector::singularize('jenter'), 'jente');
|
||||
|
||||
Inflector::rules('singular', array(
|
||||
'rules' => array('/^(bil)er$/i' => '\1', '/^(inflec|contribu)tors$/i' => '\1ta'),
|
||||
'uninflected' => array('singulars'),
|
||||
'irregular' => array('spins' => 'spinor')
|
||||
));
|
||||
|
||||
$this->assertEquals(Inflector::singularize('inflectors'), 'inflecta');
|
||||
$this->assertEquals(Inflector::singularize('contributors'), 'contributa');
|
||||
$this->assertEquals(Inflector::singularize('spins'), 'spinor');
|
||||
$this->assertEquals(Inflector::singularize('singulars'), 'singulars');
|
||||
}
|
||||
|
||||
/**
|
||||
* test that setting new rules clears the inflector caches.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testRulesClearsCaches()
|
||||
{
|
||||
Inflector::reset();
|
||||
|
||||
$this->assertEquals(Inflector::singularize('Bananas'), 'Banana');
|
||||
$this->assertEquals(Inflector::pluralize('Banana'), 'Bananas');
|
||||
|
||||
Inflector::rules('singular', array(
|
||||
'rules' => array('/(.*)nas$/i' => '\1zzz')
|
||||
));
|
||||
|
||||
$this->assertEquals('Banazzz', Inflector::singularize('Bananas'), 'Was inflected with old rules.');
|
||||
|
||||
Inflector::rules('plural', array(
|
||||
'rules' => array('/(.*)na$/i' => '\1zzz'),
|
||||
'irregular' => array('corpus' => 'corpora')
|
||||
));
|
||||
|
||||
$this->assertEquals(Inflector::pluralize('Banana'), 'Banazzz', 'Was inflected with old rules.');
|
||||
$this->assertEquals(Inflector::pluralize('corpus'), 'corpora', 'Was inflected with old irregular form.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test resetting inflection rules.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCustomRuleWithReset()
|
||||
{
|
||||
Inflector::reset();
|
||||
|
||||
$uninflected = array('atlas', 'lapis', 'onibus', 'pires', 'virus', '.*x');
|
||||
$pluralIrregular = array('as' => 'ases');
|
||||
|
||||
Inflector::rules('singular', array(
|
||||
'rules' => array('/^(.*)(a|e|o|u)is$/i' => '\1\2l'),
|
||||
'uninflected' => $uninflected,
|
||||
), true);
|
||||
|
||||
Inflector::rules('plural', array(
|
||||
'rules' => array(
|
||||
'/^(.*)(a|e|o|u)l$/i' => '\1\2is',
|
||||
),
|
||||
'uninflected' => $uninflected,
|
||||
'irregular' => $pluralIrregular
|
||||
), true);
|
||||
|
||||
$this->assertEquals(Inflector::pluralize('Alcool'), 'Alcoois');
|
||||
$this->assertEquals(Inflector::pluralize('Atlas'), 'Atlas');
|
||||
$this->assertEquals(Inflector::singularize('Alcoois'), 'Alcool');
|
||||
$this->assertEquals(Inflector::singularize('Atlas'), 'Atlas');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test basic ucwords functionality.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testUcwords()
|
||||
{
|
||||
$this->assertSame('Top-O-The-Morning To All_of_you!', Inflector::ucwords( 'top-o-the-morning to all_of_you!'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test ucwords functionality with custom delimeters.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testUcwordsWithCustomDelimeters()
|
||||
{
|
||||
$this->assertSame('Top-O-The-Morning To All_Of_You!', Inflector::ucwords( 'top-o-the-morning to all_of_you!', '-_ '));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests;
|
||||
|
||||
/**
|
||||
* Base testcase class for all Doctrine testcases.
|
||||
*/
|
||||
abstract class DoctrineTestCase extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file bootstraps the test environment.
|
||||
*/
|
||||
namespace Doctrine\Tests;
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
||||
// register silently failing autoloader
|
||||
spl_autoload_register(function($class)
|
||||
{
|
||||
if (0 === strpos($class, 'Doctrine\Tests\\')) {
|
||||
$path = __DIR__.'/../../'.strtr($class, '\\', '/').'.php';
|
||||
if (is_file($path) && is_readable($path)) {
|
||||
require_once $path;
|
||||
|
||||
return true;
|
||||
}
|
||||
} else if (0 === strpos($class, 'Doctrine\Common\\')) {
|
||||
$path = __DIR__.'/../../../lib/'.($class = strtr($class, '\\', '/')).'.php';
|
||||
if (is_file($path) && is_readable($path)) {
|
||||
require_once $path;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user