Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Cake\Test\TestCase\Utility; use Cake\TestSuite\TestCase; use Cake\Utilit..
Decoded Output download
<?php
namespace Cake\Test\TestCase\Utility; use Cake\TestSuite\TestCase; use Cake\Utility\Inflector; class InflectorTest extends TestCase { public static $maps = array("de" => array("\303\x84" => "Ae", "\xc3\x96" => "Oe", "\xc3\234" => "Ue", "\303\244" => "ae", "\xc3\266" => "oe", "\303\xbc" => "ue", "\303\x9f" => "ss", "\xe1\272\236" => "SS"), "latin" => array("\303\200" => "A", "\303\201" => "A", "\xc3\x82" => "A", "\xc3\203" => "A", "\xc3\x85" => "A", "\xc4\202" => "A", "\xc3\x86" => "AE", "\303\x87" => "C", "\xc3\210" => "E", "\303\x89" => "E", "\xc3\x8a" => "E", "\303\x8b" => "E", "\303\x8c" => "I", "\303\x8d" => "I", "\303\x8e" => "I", "\303\217" => "I", "\303\x90" => "D", "\xc3\x91" => "N", "\303\x92" => "O", "\xc3\223" => "O", "\303\x94" => "O", "\xc3\225" => "O", "\305\220" => "O", "\303\x98" => "O", "\xc8\230" => "S", "\xc8\x9a" => "T", "\xc3\x99" => "U", "\xc3\232" => "U", "\303\x9b" => "U", "\305\xb0" => "U", "\xc3\235" => "Y", "\xc3\236" => "TH", "\303\xa0" => "a", "\303\241" => "a", "\xc3\xa2" => "a", "\xc3\243" => "a", "\303\xa5" => "a", "\xc4\x83" => "a", "\xc3\246" => "ae", "\303\xa7" => "c", "\xc3\xa8" => "e", "\303\xa9" => "e", "\xc3\252" => "e", "\303\xab" => "e", "\xc3\254" => "i", "\303\255" => "i", "\303\xae" => "i", "\xc3\257" => "i", "\xc3\260" => "d", "\303\xb1" => "n", "\xc3\xb2" => "o", "\303\xb3" => "o", "\303\264" => "o", "\303\265" => "o", "\305\221" => "o", "\xc3\xb8" => "o", "\310\x99" => "s", "\xc8\233" => "t", "\303\xb9" => "u", "\303\272" => "u", "\303\273" => "u", "\xc5\261" => "u", "\xc3\275" => "y", "\xc3\276" => "th", "\303\277" => "y"), "tr" => array("\xc5\237" => "s", "\305\x9e" => "S", "\304\261" => "i", "\304\260" => "I", "\xc3\xa7" => "c", "\xc3\x87" => "C", "\xc4\237" => "g", "\xc4\236" => "G"), "uk" => array("\xd0\204" => "Ye", "\320\206" => "I", "\xd0\207" => "Yi", "\xd2\220" => "G", "\321\224" => "ye", "\xd1\226" => "i", "\321\227" => "yi", "\322\221" => "g"), "cs" => array("\xc4\215" => "c", "\xc4\217" => "d", "\304\233" => "e", "\305\210" => "n", "\xc5\x99" => "r", "\xc5\xa1" => "s", "\xc5\xa5" => "t", "\305\xaf" => "u", "\305\xbe" => "z", "\xc4\214" => "C", "\304\216" => "D", "\304\x9a" => "E", "\305\207" => "N", "\305\230" => "R", "\xc5\xa0" => "S", "\xc5\244" => "T", "\xc5\xae" => "U", "\305\xbd" => "Z"), "pl" => array("\xc4\x85" => "a", "\304\207" => "c", "\xc4\x99" => "e", "\xc5\x82" => "l", "\xc5\x84" => "n", "\xc3\263" => "o", "\305\233" => "s", "\305\272" => "z", "\xc5\xbc" => "z", "\xc4\x84" => "A", "\304\x86" => "C", "\305\201" => "L", "\305\x83" => "N", "\303\223" => "O", "\xc5\232" => "S", "\xc5\271" => "Z", "\xc5\xbb" => "Z"), "ro" => array("\304\203" => "a", "\xc3\242" => "a", "\xc3\256" => "i", "\xc8\231" => "s", "\xc8\x9b" => "t", "\xc5\xa2" => "T", "\xc5\243" => "t"), "lv" => array("\304\201" => "a", "\xc4\x8d" => "c", "\xc4\223" => "e", "\304\243" => "g", "\xc4\253" => "i", "\xc4\267" => "k", "\304\274" => "l", "\305\206" => "n", "\305\241" => "s", "\305\253" => "u", "\305\276" => "z", "\304\200" => "A", "\xc4\x8c" => "C", "\304\x92" => "E", "\xc4\xa2" => "G", "\304\xaa" => "I", "\304\266" => "K", "\304\xbb" => "L", "\xc5\x85" => "N", "\xc5\240" => "S", "\xc5\xaa" => "U", "\xc5\275" => "Z"), "lt" => array("\xc4\205" => "a", "\xc4\x8d" => "c", "\xc4\x99" => "e", "\xc4\x97" => "e", "\304\xaf" => "i", "\305\241" => "s", "\xc5\xb3" => "u", "\xc5\xab" => "u", "\305\276" => "z", "\xc4\x84" => "A", "\304\214" => "C", "\xc4\x98" => "E", "\xc4\226" => "E", "\xc4\256" => "I", "\xc5\xa0" => "S", "\305\262" => "U", "\305\xaa" => "U", "\305\xbd" => "Z")); public function tearDown() : void { parent::tearDown(); Inflector::reset(); } public function testInflectingSingulars(string $singular, string $plural) : void { $this->assertSame($singular, Inflector::singularize($plural)); $singular = Inflector::camelize($singular); $plural = Inflector::camelize($plural); $this->assertSame($singular, Inflector::singularize($plural)); } public static function singularizeProvider() : array { return array(array("categoria", "categorias"), array("menu", "menus"), array("news", "news"), array("food_menu", "food_menus"), array("Menu", "Menus"), array("FoodMenu", "FoodMenus"), array("house", "houses"), array("powerhouse", "powerhouses"), array("quiz", "quizzes"), array("Bus", "Buses"), array("bus", "buses"), array("matrix_row", "matrix_rows"), array("matrix", "matrices"), array("vertex", "vertices"), array("index", "indices"), array("index", "indexes"), array("Alias", "Aliases"), array("Alias", "Alias"), array("Media", "Media"), array("NodeMedia", "NodeMedia"), array("alumnus", "alumni"), array("bacillus", "bacilli"), array("cactus", "cacti"), array("focus", "foci"), array("fungus", "fungi"), array("nucleus", "nuclei"), array("octopus", "octopuses"), array("radius", "radii"), array("stimulus", "stimuli"), array("syllabus", "syllabi"), array("terminus", "termini"), array("virus", "viruses"), array("person", "people"), array("glove", "gloves"), array("dove", "doves"), array("life", "lives"), array("knife", "knives"), array("wolf", "wolves"), array("slave", "slaves"), array("shelf", "shelves"), array("taxi", "taxis"), array("tax", "taxes"), array("Tax", "Taxes"), array("AwesomeTax", "AwesomeTaxes"), array("fax", "faxes"), array("wax", "waxes"), array("niche", "niches"), array("cave", "caves"), array("grave", "graves"), array("wave", "waves"), array("bureau", "bureaus"), array("genetic_analysis", "genetic_analyses"), array("doctor_diagnosis", "doctor_diagnoses"), array("paranthesis", "parantheses"), array("Cause", "Causes"), array("colossus", "colossuses"), array("diagnosis", "diagnoses"), array("basis", "bases"), array("analysis", "analyses"), array("curve", "curves"), array("cafe", "cafes"), array("roof", "roofs"), array("foe", "foes"), array("database", "databases"), array("cookie", "cookies"), array("thief", "thieves"), array("potato", "potatoes"), array("hero", "heroes"), array("buffalo", "buffaloes"), array("baby", "babies"), array("tooth", "teeth"), array("goose", "geese"), array("foot", "feet"), array("objective", "objectives"), array("archive", "archives"), array("brief", "briefs"), array("quota", "quotas"), array("curve", "curves"), array("body_curve", "body_curves"), array("metadata", "metadata"), array("files_metadata", "files_metadata"), array("address", "addresses"), array("sieve", "sieves"), array("blue_octopus", "blue_octopuses"), array("chef", "chefs"), array('', ''), array("cache", "caches"), array("lens", "lenses"), array("species", "species"), array("animal_species", "animal_species")); } public function testSingularizeMultiWordIrregular() : void { Inflector::rules("irregular", array("pregunta_frecuente" => "preguntas_frecuentes", "categoria_pregunta_frecuente" => "categorias_preguntas_frecuentes")); $this->assertSame("pregunta_frecuente", Inflector::singularize("preguntas_frecuentes")); $this->assertSame("categoria_pregunta_frecuente", Inflector::singularize("categorias_preguntas_frecuentes")); $this->assertSame("faq_categoria_pregunta_frecuente", Inflector::singularize("faq_categorias_preguntas_frecuentes")); } public function testInflectingPlurals(string $plural, string $singular) : void { $this->assertSame($plural, Inflector::pluralize($singular)); $plural = Inflector::camelize($plural); $singular = Inflector::camelize($singular); $this->assertSame($plural, Inflector::pluralize($singular)); } public static function pluralizeProvider() : array { return array(array("axmen", "axman"), array("men", "man"), array("women", "woman"), array("humans", "human"), array("axmen", "axman"), array("men", "man"), array("women", "woman"), array("humans", "human"), array("categorias", "categoria"), array("houses", "house"), array("powerhouses", "powerhouse"), array("Buses", "Bus"), array("buses", "bus"), array("menus", "menu"), array("news", "news"), array("food_menus", "food_menu"), array("Menus", "Menu"), array("FoodMenus", "FoodMenu"), array("quizzes", "quiz"), array("matrix_rows", "matrix_row"), array("matrices", "matrix"), array("vertices", "vertex"), array("indexes", "index"), array("Aliases", "Alias"), array("Aliases", "Aliases"), array("Media", "Media"), array("NodeMedia", "NodeMedia"), array("alumni", "alumnus"), array("bacilli", "bacillus"), array("cacti", "cactus"), array("foci", "focus"), array("fungi", "fungus"), array("nuclei", "nucleus"), array("octopuses", "octopus"), array("radii", "radius"), array("stimuli", "stimulus"), array("syllabi", "syllabus"), array("termini", "terminus"), array("viruses", "virus"), array("people", "person"), array("people", "people"), array("gloves", "glove"), array("crises", "crisis"), array("taxes", "tax"), array("waves", "wave"), array("bureaus", "bureau"), array("cafes", "cafe"), array("roofs", "roof"), array("foes", "foe"), array("cookies", "cookie"), array("wolves", "wolf"), array("thieves", "thief"), array("potatoes", "potato"), array("heroes", "hero"), array("buffaloes", "buffalo"), array("teeth", "tooth"), array("geese", "goose"), array("feet", "foot"), array("objectives", "objective"), array("briefs", "brief"), array("quotas", "quota"), array("curves", "curve"), array("body_curves", "body_curve"), array("metadata", "metadata"), array("files_metadata", "files_metadata"), array("stadia", "stadia"), array("Addresses", "Address"), array("sieves", "sieve"), array("blue_octopuses", "blue_octopus"), array("chefs", "chef"), array('', ''), array("pokemon", "pokemon")); } public function testPluralizeMultiWordIrregular() : void { Inflector::rules("irregular", array("pregunta_frecuente" => "preguntas_frecuentes", "categoria_pregunta_frecuente" => "categorias_preguntas_frecuentes")); $this->assertSame("preguntas_frecuentes", Inflector::pluralize("pregunta_frecuente")); $this->assertSame("categorias_preguntas_frecuentes", Inflector::pluralize("categoria_pregunta_frecuente")); $this->assertSame("faq_categorias_preguntas_frecuentes", Inflector::pluralize("faq_categoria_pregunta_frecuente")); } public function testInflectingMultiWordIrregulars() : void { Inflector::rules("plural", array("rules" => array())); Inflector::rules("singular", array("rules" => array())); $this->assertSame("wisdom tooth", Inflector::singularize("wisdom teeth")); $this->assertSame("wisdom-tooth", Inflector::singularize("wisdom-teeth")); $this->assertSame("wisdom_tooth", Inflector::singularize("wisdom_teeth")); $this->assertSame("sweet potatoes", Inflector::pluralize("sweet potato")); $this->assertSame("sweet-potatoes", Inflector::pluralize("sweet-potato")); $this->assertSame("sweet_potatoes", Inflector::pluralize("sweet_potato")); } public function testUnderscore() : void { $this->assertSame("test_thing", Inflector::underscore("TestThing")); $this->assertSame("test_thing", Inflector::underscore("testThing")); $this->assertSame("test_thing_extra", Inflector::underscore("TestThingExtra")); $this->assertSame("test_thing_extra", Inflector::underscore("testThingExtra")); $this->assertSame("test_this_thing", Inflector::underscore("test-this-thing")); $this->assertSame("test_thing_extr\xc3\245", Inflector::underscore("testThingExtr\303\xa5")); $this->assertSame("test_thing", Inflector::underscore("TestThing")); $this->assertSame("test_thing", Inflector::underscore("testThing")); $this->assertSame("test_thing_extra", Inflector::underscore("TestThingExtra")); $this->assertSame("test_thing_extra", Inflector::underscore("testThingExtra")); $this->assertSame("test_thing_extr\303\xa5", Inflector::underscore("testThingExtr\303\xa5")); $this->assertSame("0", Inflector::underscore("0")); } public function testDasherized() : void { $this->assertSame("test-thing", Inflector::dasherize("TestThing")); $this->assertSame("test-thing", Inflector::dasherize("testThing")); $this->assertSame("test-thing-extra", Inflector::dasherize("TestThingExtra")); $this->assertSame("test-thing-extra", Inflector::dasherize("testThingExtra")); $this->assertSame("test-this-thing", Inflector::dasherize("test_this_thing")); $this->assertSame('', Inflector::dasherize('')); $this->assertSame("0", Inflector::dasherize("0")); } public function testCamelize() : void { $this->assertSame("TestThing", Inflector::camelize("test_thing")); $this->assertSame("Test-thing", Inflector::camelize("test-thing")); $this->assertSame("TestThing", Inflector::camelize("test thing")); $this->assertSame("Test_thing", Inflector::camelize("test_thing", "-")); $this->assertSame("TestThing", Inflector::camelize("test-thing", "-")); $this->assertSame("TestThing", Inflector::camelize("test thing", "-")); $this->assertSame("Test_thing", Inflector::camelize("test_thing", " ")); $this->assertSame("Test-thing", Inflector::camelize("test-thing", " ")); $this->assertSame("TestThing", Inflector::camelize("test thing", " ")); $this->assertSame("TestPlugin.TestPluginComments", Inflector::camelize("TestPlugin.TestPluginComments")); } public function testVariableNaming() : void { $this->assertSame("testField", Inflector::variable("test_field")); $this->assertSame("testFieLd", Inflector::variable("test_fieLd")); $this->assertSame("testField", Inflector::variable("test field")); $this->assertSame("testField", Inflector::variable("Test_field")); } public function testClassNaming() : void { $this->assertSame("ArtistsGenre", Inflector::classify("artists_genres")); $this->assertSame("FileSystem", Inflector::classify("file_systems")); $this->assertSame("News", Inflector::classify("news")); $this->assertSame("Bureau", Inflector::classify("bureaus")); } public function testTableNaming() : void { $this->assertSame("artists_genres", Inflector::tableize("ArtistsGenre")); $this->assertSame("file_systems", Inflector::tableize("FileSystem")); $this->assertSame("news", Inflector::tableize("News")); $this->assertSame("bureaus", Inflector::tableize("Bureau")); } public function testHumanization() : void { $this->assertSame("Posts", Inflector::humanize("posts")); $this->assertSame("Posts Tags", Inflector::humanize("posts_tags")); $this->assertSame("File Systems", Inflector::humanize("file_systems")); $this->assertSame("Hello W\303\266rld", Inflector::humanize("hello_w\303\xb6rld")); $this->assertSame("\347\xa6\x8f\345\262\xa1 City", Inflector::humanize("\347\246\x8f\345\xb2\xa1_city")); } public function testCustomPluralRule() : void { Inflector::rules("plural", array("/^(custom)$/i" => "\1izables")); Inflector::rules("uninflected", array("uninflectable")); $this->assertSame("customizables", Inflector::pluralize("custom")); $this->assertSame("uninflectable", Inflector::pluralize("uninflectable")); Inflector::rules("plural", array("/^(alert)$/i" => "\1ables")); Inflector::rules("irregular", array("amaze" => "amazable", "phone" => "phonezes")); Inflector::rules("uninflected", array("noflect", "abtuse")); $this->assertSame("noflect", Inflector::pluralize("noflect")); $this->assertSame("abtuse", Inflector::pluralize("abtuse")); $this->assertSame("alertables", Inflector::pluralize("alert")); $this->assertSame("amazable", Inflector::pluralize("amaze")); $this->assertSame("phonezes", Inflector::pluralize("phone")); $this->assertSame("criteria", Inflector::pluralize("criterion")); $this->assertSame("test_criteria", Inflector::pluralize("test_criterion")); $this->assertSame("Criteria", Inflector::pluralize("Criterion")); $this->assertSame("TestCriteria", Inflector::pluralize("TestCriterion")); $this->assertSame("Test Criteria", Inflector::pluralize("Test Criterion")); } public function testCustomSingularRule() : void { Inflector::rules("uninflected", array("singulars")); Inflector::rules("singular", array("/(eple)r$/i" => "\1", "/(jente)r$/i" => "\1")); $this->assertSame("eple", Inflector::singularize("epler")); $this->assertSame("jente", Inflector::singularize("jenter")); Inflector::rules("singular", array("/^(bil)er$/i" => "\1", "/^(inflec|contribu)tors$/i" => "\1ta")); Inflector::rules("irregular", array("spinor" => "spins")); $this->assertSame("spinor", Inflector::singularize("spins")); $this->assertSame("inflecta", Inflector::singularize("inflectors")); $this->assertSame("contributa", Inflector::singularize("contributors")); $this->assertSame("singulars", Inflector::singularize("singulars")); $this->assertSame("criterion", Inflector::singularize("criteria")); $this->assertSame("test_criterion", Inflector::singularize("test_criteria")); $this->assertSame("Criterion", Inflector::singularize("Criteria")); $this->assertSame("TestCriterion", Inflector::singularize("TestCriteria")); $this->assertSame("Test Criterion", Inflector::singularize("Test Criteria")); } public function testRulesClearsCaches() : void { $this->assertSame("Banana", Inflector::singularize("Bananas")); $this->assertSame("bananas", Inflector::tableize("Banana")); $this->assertSame("Bananas", Inflector::pluralize("Banana")); Inflector::rules("singular", array("/(.*)nas$/i" => "\1zzz")); $this->assertSame("Banazzz", Inflector::singularize("Bananas"), "Was inflected with old rules."); Inflector::rules("plural", array("/(.*)na$/i" => "\1zzz")); Inflector::rules("irregular", array("corpus" => "corpora")); $this->assertSame("Banazzz", Inflector::pluralize("Banana"), "Was inflected with old rules."); $this->assertSame("corpora", Inflector::pluralize("corpus"), "Was inflected with old irregular form."); } public function testCustomRuleWithReset() : void { $uninflected = array("atlas", "lapis", "onibus", "pires", "virus", ".*x"); $pluralIrregular = array("as" => "ases"); Inflector::rules("singular", array("/^(.*)(a|e|o|u)is$/i" => "\1\2l"), true); Inflector::rules("plural", array("/^(.*)(a|e|o|u)l$/i" => "\1\2is"), true); Inflector::rules("uninflected", $uninflected, true); Inflector::rules("irregular", $pluralIrregular, true); $this->assertSame("Alcoois", Inflector::pluralize("Alcool")); $this->assertSame("Atlas", Inflector::pluralize("Atlas")); $this->assertSame("Alcool", Inflector::singularize("Alcoois")); $this->assertSame("Atlas", Inflector::singularize("Atlas")); } } ?>
Did this file decode correctly?
Original Code
<?php
namespace Cake\Test\TestCase\Utility; use Cake\TestSuite\TestCase; use Cake\Utility\Inflector; class InflectorTest extends TestCase { public static $maps = array("\144\145" => array("\303\x84" => "\101\145", "\xc3\x96" => "\x4f\145", "\xc3\234" => "\x55\x65", "\303\244" => "\x61\145", "\xc3\266" => "\x6f\145", "\303\xbc" => "\165\x65", "\303\x9f" => "\163\x73", "\xe1\272\236" => "\x53\123"), "\154\141\164\x69\156" => array("\303\200" => "\x41", "\303\201" => "\101", "\xc3\x82" => "\x41", "\xc3\203" => "\101", "\xc3\x85" => "\101", "\xc4\202" => "\x41", "\xc3\x86" => "\101\105", "\303\x87" => "\103", "\xc3\210" => "\x45", "\303\x89" => "\x45", "\xc3\x8a" => "\x45", "\303\x8b" => "\x45", "\303\x8c" => "\x49", "\303\x8d" => "\111", "\303\x8e" => "\x49", "\303\217" => "\x49", "\303\x90" => "\104", "\xc3\x91" => "\x4e", "\303\x92" => "\x4f", "\xc3\223" => "\x4f", "\303\x94" => "\117", "\xc3\225" => "\117", "\305\220" => "\117", "\303\x98" => "\x4f", "\xc8\230" => "\x53", "\xc8\x9a" => "\x54", "\xc3\x99" => "\125", "\xc3\232" => "\125", "\303\x9b" => "\x55", "\305\xb0" => "\x55", "\xc3\235" => "\131", "\xc3\236" => "\x54\110", "\303\xa0" => "\x61", "\303\241" => "\141", "\xc3\xa2" => "\x61", "\xc3\243" => "\x61", "\303\xa5" => "\141", "\xc4\x83" => "\x61", "\xc3\246" => "\x61\x65", "\303\xa7" => "\x63", "\xc3\xa8" => "\x65", "\303\xa9" => "\x65", "\xc3\252" => "\145", "\303\xab" => "\x65", "\xc3\254" => "\151", "\303\255" => "\x69", "\303\xae" => "\x69", "\xc3\257" => "\x69", "\xc3\260" => "\144", "\303\xb1" => "\x6e", "\xc3\xb2" => "\x6f", "\303\xb3" => "\x6f", "\303\264" => "\x6f", "\303\265" => "\x6f", "\305\221" => "\157", "\xc3\xb8" => "\x6f", "\310\x99" => "\x73", "\xc8\233" => "\x74", "\303\xb9" => "\165", "\303\272" => "\x75", "\303\273" => "\x75", "\xc5\261" => "\165", "\xc3\275" => "\171", "\xc3\276" => "\164\x68", "\303\277" => "\171"), "\x74\162" => array("\xc5\237" => "\x73", "\305\x9e" => "\123", "\304\261" => "\x69", "\304\260" => "\111", "\xc3\xa7" => "\x63", "\xc3\x87" => "\x43", "\xc4\237" => "\147", "\xc4\236" => "\107"), "\x75\x6b" => array("\xd0\204" => "\131\x65", "\320\206" => "\x49", "\xd0\207" => "\131\151", "\xd2\220" => "\107", "\321\224" => "\x79\145", "\xd1\226" => "\x69", "\321\227" => "\x79\x69", "\322\221" => "\147"), "\143\163" => array("\xc4\215" => "\143", "\xc4\217" => "\x64", "\304\233" => "\x65", "\305\210" => "\x6e", "\xc5\x99" => "\x72", "\xc5\xa1" => "\x73", "\xc5\xa5" => "\164", "\305\xaf" => "\165", "\305\xbe" => "\x7a", "\xc4\214" => "\x43", "\304\216" => "\104", "\304\x9a" => "\x45", "\305\207" => "\116", "\305\230" => "\122", "\xc5\xa0" => "\123", "\xc5\244" => "\124", "\xc5\xae" => "\x55", "\305\xbd" => "\x5a"), "\160\x6c" => array("\xc4\x85" => "\x61", "\304\207" => "\143", "\xc4\x99" => "\145", "\xc5\x82" => "\154", "\xc5\x84" => "\x6e", "\xc3\263" => "\x6f", "\305\233" => "\x73", "\305\272" => "\172", "\xc5\xbc" => "\x7a", "\xc4\x84" => "\101", "\304\x86" => "\103", "\305\201" => "\x4c", "\305\x83" => "\116", "\303\223" => "\117", "\xc5\232" => "\123", "\xc5\271" => "\132", "\xc5\xbb" => "\132"), "\162\157" => array("\304\203" => "\141", "\xc3\242" => "\141", "\xc3\256" => "\x69", "\xc8\231" => "\x73", "\xc8\x9b" => "\x74", "\xc5\xa2" => "\124", "\xc5\243" => "\164"), "\x6c\x76" => array("\304\201" => "\x61", "\xc4\x8d" => "\x63", "\xc4\223" => "\145", "\304\243" => "\x67", "\xc4\253" => "\x69", "\xc4\267" => "\153", "\304\274" => "\x6c", "\305\206" => "\x6e", "\305\241" => "\x73", "\305\253" => "\x75", "\305\276" => "\x7a", "\304\200" => "\x41", "\xc4\x8c" => "\x43", "\304\x92" => "\x45", "\xc4\xa2" => "\107", "\304\xaa" => "\111", "\304\266" => "\x4b", "\304\xbb" => "\114", "\xc5\x85" => "\x4e", "\xc5\240" => "\x53", "\xc5\xaa" => "\125", "\xc5\275" => "\132"), "\154\x74" => array("\xc4\205" => "\x61", "\xc4\x8d" => "\x63", "\xc4\x99" => "\145", "\xc4\x97" => "\145", "\304\xaf" => "\151", "\305\241" => "\x73", "\xc5\xb3" => "\165", "\xc5\xab" => "\165", "\305\276" => "\172", "\xc4\x84" => "\101", "\304\214" => "\103", "\xc4\x98" => "\x45", "\xc4\226" => "\105", "\xc4\256" => "\111", "\xc5\xa0" => "\123", "\305\262" => "\125", "\305\xaa" => "\x55", "\305\xbd" => "\x5a")); public function tearDown() : void { parent::tearDown(); Inflector::reset(); } public function testInflectingSingulars(string $singular, string $plural) : void { $this->assertSame($singular, Inflector::singularize($plural)); $singular = Inflector::camelize($singular); $plural = Inflector::camelize($plural); $this->assertSame($singular, Inflector::singularize($plural)); } public static function singularizeProvider() : array { return array(array("\143\141\x74\145\147\x6f\162\x69\141", "\x63\x61\164\x65\x67\157\162\x69\141\x73"), array("\x6d\x65\156\165", "\x6d\x65\x6e\x75\163"), array("\156\x65\x77\x73", "\156\x65\x77\x73"), array("\146\x6f\157\x64\x5f\155\145\156\x75", "\146\157\x6f\x64\x5f\155\145\x6e\x75\x73"), array("\x4d\145\x6e\x75", "\115\x65\156\165\163"), array("\x46\157\x6f\144\x4d\145\x6e\165", "\106\x6f\157\x64\x4d\145\156\x75\x73"), array("\x68\x6f\165\x73\145", "\x68\157\x75\x73\x65\163"), array("\160\157\x77\x65\162\x68\x6f\165\163\x65", "\x70\157\x77\145\162\x68\x6f\x75\163\x65\x73"), array("\x71\165\x69\x7a", "\161\x75\x69\x7a\x7a\x65\163"), array("\102\165\163", "\x42\x75\x73\x65\x73"), array("\142\165\x73", "\x62\165\163\x65\x73"), array("\x6d\141\x74\x72\x69\x78\137\162\157\167", "\155\141\164\162\151\170\x5f\162\157\x77\x73"), array("\x6d\x61\164\x72\151\170", "\155\x61\164\x72\x69\x63\145\x73"), array("\166\145\162\164\x65\x78", "\x76\x65\162\x74\x69\x63\145\x73"), array("\151\x6e\144\x65\170", "\151\156\144\x69\143\x65\163"), array("\x69\156\144\x65\170", "\151\156\144\x65\170\x65\163"), array("\x41\x6c\x69\141\163", "\x41\154\151\x61\163\x65\x73"), array("\101\154\x69\x61\163", "\x41\154\151\141\x73"), array("\115\x65\x64\151\x61", "\x4d\145\144\x69\141"), array("\x4e\157\144\145\115\x65\144\x69\141", "\116\x6f\x64\145\x4d\145\x64\x69\x61"), array("\x61\x6c\165\x6d\156\x75\163", "\141\x6c\165\155\x6e\x69"), array("\x62\x61\143\151\x6c\x6c\x75\x73", "\x62\141\143\151\154\x6c\151"), array("\143\141\x63\164\165\163", "\x63\x61\143\164\x69"), array("\x66\157\x63\165\x73", "\x66\157\143\x69"), array("\x66\x75\156\147\x75\x73", "\x66\x75\x6e\x67\x69"), array("\156\x75\x63\x6c\145\165\x73", "\x6e\x75\143\154\145\x69"), array("\157\143\x74\x6f\160\x75\x73", "\157\x63\164\157\x70\165\x73\145\x73"), array("\x72\141\144\151\x75\x73", "\162\141\x64\x69\151"), array("\163\164\151\155\165\154\165\x73", "\163\164\x69\x6d\x75\x6c\151"), array("\163\171\x6c\x6c\141\x62\x75\163", "\163\171\x6c\154\x61\x62\x69"), array("\x74\x65\x72\155\151\x6e\x75\163", "\164\x65\x72\155\x69\156\x69"), array("\166\x69\x72\x75\163", "\x76\151\162\x75\163\145\163"), array("\160\145\162\x73\x6f\x6e", "\160\x65\x6f\160\154\x65"), array("\x67\154\x6f\166\x65", "\x67\x6c\x6f\x76\145\163"), array("\x64\157\x76\x65", "\x64\x6f\166\x65\x73"), array("\x6c\151\x66\145", "\x6c\x69\x76\145\163"), array("\x6b\x6e\151\146\145", "\153\x6e\151\x76\145\x73"), array("\x77\157\x6c\x66", "\x77\x6f\x6c\x76\145\163"), array("\163\x6c\x61\x76\145", "\163\154\141\166\x65\x73"), array("\x73\150\x65\154\x66", "\163\150\x65\154\166\x65\163"), array("\x74\141\x78\151", "\164\141\x78\x69\163"), array("\164\141\x78", "\164\141\170\x65\163"), array("\x54\x61\x78", "\124\141\170\x65\163"), array("\101\x77\145\163\157\155\x65\x54\x61\x78", "\x41\167\x65\163\x6f\155\x65\x54\x61\170\145\x73"), array("\x66\x61\170", "\146\141\170\x65\163"), array("\x77\141\170", "\x77\141\x78\x65\163"), array("\156\x69\143\150\145", "\x6e\151\143\x68\145\163"), array("\143\x61\x76\145", "\x63\x61\166\x65\163"), array("\x67\162\x61\166\x65", "\x67\162\x61\166\x65\163"), array("\167\141\x76\x65", "\x77\x61\166\145\163"), array("\x62\165\x72\145\141\x75", "\142\x75\162\145\141\165\163"), array("\147\x65\156\145\164\x69\x63\137\x61\x6e\x61\154\x79\163\151\163", "\147\x65\x6e\145\164\x69\143\137\x61\x6e\141\154\171\x73\x65\x73"), array("\x64\x6f\143\x74\157\162\137\144\x69\x61\147\156\x6f\x73\x69\x73", "\x64\157\x63\x74\x6f\162\x5f\144\151\141\x67\x6e\x6f\163\145\163"), array("\160\141\x72\141\156\164\150\145\x73\x69\163", "\x70\x61\x72\x61\156\164\x68\x65\163\x65\163"), array("\x43\x61\x75\163\145", "\103\141\x75\x73\x65\x73"), array("\143\157\x6c\x6f\163\163\x75\x73", "\143\157\x6c\157\163\163\165\x73\x65\163"), array("\x64\151\141\x67\x6e\x6f\163\151\x73", "\x64\x69\141\147\156\x6f\x73\x65\x73"), array("\x62\141\163\x69\x73", "\x62\x61\163\145\x73"), array("\141\x6e\141\154\171\x73\151\163", "\x61\x6e\x61\154\x79\163\x65\163"), array("\143\x75\162\166\x65", "\143\165\x72\166\x65\x73"), array("\x63\x61\146\145", "\x63\141\146\145\163"), array("\x72\157\x6f\146", "\x72\157\x6f\146\x73"), array("\x66\x6f\145", "\146\x6f\x65\x73"), array("\144\141\164\141\142\x61\163\145", "\x64\x61\164\x61\x62\x61\163\x65\x73"), array("\x63\x6f\157\x6b\x69\145", "\143\x6f\157\153\x69\x65\163"), array("\x74\150\x69\x65\146", "\x74\x68\x69\x65\166\x65\x73"), array("\x70\x6f\164\x61\x74\x6f", "\x70\x6f\164\x61\x74\157\x65\163"), array("\x68\x65\x72\157", "\x68\145\162\x6f\x65\x73"), array("\142\165\x66\146\x61\x6c\x6f", "\142\x75\146\146\x61\154\157\145\163"), array("\142\x61\142\x79", "\x62\x61\142\151\145\x73"), array("\164\157\157\x74\150", "\164\145\145\164\150"), array("\x67\x6f\x6f\x73\145", "\x67\x65\145\163\145"), array("\x66\x6f\157\164", "\x66\x65\x65\x74"), array("\x6f\142\x6a\x65\x63\x74\151\x76\x65", "\x6f\142\152\145\x63\164\151\x76\145\x73"), array("\141\162\x63\x68\x69\166\x65", "\141\162\143\x68\151\166\145\163"), array("\142\x72\x69\145\146", "\x62\162\x69\145\146\163"), array("\x71\x75\157\x74\141", "\161\x75\157\164\141\x73"), array("\143\165\162\166\145", "\143\165\162\x76\x65\163"), array("\x62\x6f\x64\x79\x5f\x63\165\x72\166\x65", "\142\x6f\x64\171\137\143\165\162\166\145\x73"), array("\155\x65\x74\x61\x64\141\x74\x61", "\x6d\145\x74\x61\144\141\164\x61"), array("\146\151\x6c\145\163\x5f\155\x65\164\141\x64\x61\x74\x61", "\146\151\154\x65\163\137\155\x65\164\x61\144\141\x74\141"), array("\x61\144\144\x72\x65\x73\163", "\141\x64\x64\162\x65\163\x73\x65\x73"), array("\x73\x69\145\x76\145", "\163\x69\x65\x76\x65\163"), array("\x62\x6c\x75\145\x5f\157\143\x74\x6f\x70\x75\x73", "\x62\154\x75\x65\137\x6f\x63\164\x6f\160\165\163\x65\163"), array("\x63\150\145\146", "\143\150\x65\146\163"), array('', ''), array("\143\141\143\150\x65", "\143\141\x63\x68\145\163"), array("\x6c\x65\x6e\163", "\x6c\x65\156\x73\x65\163"), array("\163\x70\x65\x63\x69\145\x73", "\163\x70\x65\143\x69\x65\x73"), array("\141\x6e\x69\x6d\x61\x6c\137\x73\x70\145\x63\151\x65\163", "\x61\x6e\x69\x6d\141\x6c\137\x73\160\x65\143\x69\145\x73")); } public function testSingularizeMultiWordIrregular() : void { Inflector::rules("\151\162\162\x65\147\x75\x6c\141\x72", array("\x70\x72\x65\147\x75\x6e\164\141\137\x66\x72\145\x63\x75\145\156\164\145" => "\160\162\x65\x67\165\x6e\164\x61\163\x5f\x66\x72\x65\143\165\x65\156\x74\145\163", "\x63\141\164\145\x67\x6f\x72\151\141\137\160\x72\145\147\x75\156\164\141\x5f\146\x72\145\143\165\145\156\164\145" => "\x63\x61\x74\145\x67\x6f\x72\151\x61\163\x5f\x70\162\x65\147\x75\156\164\x61\x73\137\x66\162\145\x63\165\145\x6e\x74\x65\x73")); $this->assertSame("\160\162\145\147\165\156\x74\141\137\x66\162\x65\x63\x75\145\x6e\164\x65", Inflector::singularize("\160\x72\x65\147\x75\x6e\164\x61\163\137\146\162\x65\143\x75\x65\x6e\x74\x65\x73")); $this->assertSame("\x63\x61\x74\x65\x67\157\162\x69\141\x5f\x70\162\145\x67\165\156\x74\141\137\146\x72\145\x63\165\x65\156\164\x65", Inflector::singularize("\x63\141\x74\x65\147\x6f\162\x69\x61\x73\x5f\x70\162\x65\147\165\156\164\x61\163\x5f\x66\162\x65\143\165\145\x6e\164\x65\163")); $this->assertSame("\x66\x61\161\137\143\141\164\x65\x67\157\x72\x69\141\x5f\x70\162\145\x67\165\156\164\x61\x5f\146\x72\145\143\165\145\156\x74\x65", Inflector::singularize("\x66\x61\x71\137\143\x61\164\x65\x67\x6f\162\151\141\163\137\160\x72\145\x67\165\156\164\x61\x73\137\x66\162\145\143\x75\x65\156\x74\145\163")); } public function testInflectingPlurals(string $plural, string $singular) : void { $this->assertSame($plural, Inflector::pluralize($singular)); $plural = Inflector::camelize($plural); $singular = Inflector::camelize($singular); $this->assertSame($plural, Inflector::pluralize($singular)); } public static function pluralizeProvider() : array { return array(array("\x61\170\x6d\x65\x6e", "\x61\x78\155\141\156"), array("\155\x65\x6e", "\155\141\x6e"), array("\x77\157\x6d\x65\156", "\167\x6f\155\x61\x6e"), array("\x68\165\x6d\141\x6e\163", "\150\165\155\x61\156"), array("\x61\170\x6d\x65\x6e", "\x61\x78\x6d\141\x6e"), array("\x6d\x65\x6e", "\155\x61\156"), array("\x77\x6f\x6d\x65\156", "\x77\157\155\141\156"), array("\x68\x75\x6d\x61\156\163", "\x68\165\x6d\x61\156"), array("\143\x61\164\145\147\x6f\162\151\141\x73", "\143\141\164\x65\147\157\162\151\x61"), array("\150\x6f\165\x73\x65\x73", "\x68\x6f\x75\163\x65"), array("\x70\157\x77\x65\x72\x68\157\165\163\145\x73", "\x70\x6f\167\x65\162\150\x6f\165\x73\145"), array("\102\x75\163\x65\163", "\102\x75\163"), array("\142\x75\163\145\x73", "\142\x75\x73"), array("\x6d\145\156\165\163", "\155\145\156\x75"), array("\156\145\167\x73", "\156\x65\167\163"), array("\x66\x6f\x6f\x64\137\x6d\x65\x6e\165\x73", "\x66\x6f\157\x64\137\x6d\x65\156\165"), array("\x4d\145\156\165\163", "\x4d\x65\156\165"), array("\106\157\x6f\144\115\145\x6e\x75\x73", "\106\157\x6f\144\115\145\156\x75"), array("\161\165\151\172\172\x65\163", "\x71\x75\151\172"), array("\155\141\164\162\x69\x78\x5f\x72\x6f\167\x73", "\155\141\164\x72\x69\x78\x5f\162\x6f\167"), array("\155\x61\x74\162\151\x63\x65\163", "\x6d\x61\164\162\151\x78"), array("\166\x65\162\x74\x69\143\x65\163", "\x76\x65\162\164\x65\x78"), array("\151\x6e\x64\x65\170\x65\x73", "\151\156\x64\x65\170"), array("\101\154\x69\x61\163\x65\163", "\x41\154\x69\141\163"), array("\101\x6c\x69\x61\163\x65\163", "\x41\154\x69\141\x73\x65\163"), array("\x4d\145\x64\x69\x61", "\x4d\145\x64\151\x61"), array("\x4e\157\x64\x65\x4d\x65\x64\151\141", "\116\157\x64\x65\x4d\145\x64\151\x61"), array("\x61\154\x75\155\x6e\151", "\x61\x6c\x75\x6d\x6e\165\x73"), array("\142\x61\x63\x69\154\x6c\151", "\142\141\x63\x69\x6c\154\x75\x73"), array("\143\141\143\x74\151", "\143\x61\x63\x74\165\163"), array("\x66\x6f\x63\x69", "\x66\157\x63\165\x73"), array("\146\x75\156\x67\x69", "\x66\x75\156\147\165\x73"), array("\156\x75\143\x6c\x65\151", "\x6e\x75\x63\154\x65\165\163"), array("\x6f\143\164\x6f\x70\165\x73\x65\x73", "\157\x63\164\x6f\160\165\x73"), array("\x72\x61\x64\151\x69", "\x72\x61\x64\151\165\x73"), array("\163\164\151\x6d\165\x6c\151", "\163\164\151\x6d\x75\x6c\x75\163"), array("\163\171\x6c\154\x61\142\x69", "\163\171\154\x6c\x61\142\165\163"), array("\x74\145\162\155\151\156\x69", "\x74\145\162\x6d\x69\x6e\165\163"), array("\166\x69\162\165\x73\145\163", "\x76\151\162\165\x73"), array("\160\145\157\x70\x6c\x65", "\160\145\162\163\157\x6e"), array("\x70\145\x6f\x70\154\x65", "\x70\x65\157\x70\154\145"), array("\x67\x6c\x6f\x76\145\x73", "\147\154\157\x76\x65"), array("\x63\162\151\x73\x65\x73", "\x63\162\x69\x73\151\x73"), array("\164\x61\x78\x65\163", "\x74\x61\x78"), array("\x77\141\166\x65\x73", "\167\141\x76\x65"), array("\142\165\162\145\141\x75\163", "\142\165\x72\145\141\x75"), array("\143\x61\x66\x65\x73", "\x63\x61\x66\x65"), array("\x72\157\157\x66\x73", "\162\157\x6f\146"), array("\146\x6f\x65\x73", "\146\x6f\x65"), array("\143\x6f\157\153\151\x65\163", "\x63\157\157\x6b\151\145"), array("\167\x6f\x6c\166\x65\x73", "\167\x6f\x6c\146"), array("\x74\x68\x69\145\x76\x65\163", "\164\x68\x69\145\x66"), array("\160\x6f\164\x61\x74\x6f\x65\x73", "\x70\157\164\141\x74\157"), array("\150\145\162\157\145\163", "\x68\145\162\x6f"), array("\x62\165\x66\146\141\154\157\x65\x73", "\142\165\x66\x66\141\x6c\157"), array("\164\145\x65\164\150", "\x74\157\157\x74\x68"), array("\147\145\145\x73\145", "\147\x6f\157\x73\145"), array("\x66\145\145\x74", "\x66\157\x6f\164"), array("\x6f\142\152\145\x63\164\x69\166\x65\163", "\x6f\142\x6a\x65\143\x74\x69\166\x65"), array("\x62\162\151\x65\146\x73", "\142\x72\x69\145\x66"), array("\161\165\157\164\x61\163", "\161\165\157\x74\141"), array("\143\165\x72\x76\145\x73", "\143\x75\x72\166\145"), array("\x62\157\144\x79\137\x63\165\162\166\145\x73", "\x62\157\144\171\x5f\143\x75\x72\x76\x65"), array("\x6d\x65\164\141\144\141\x74\141", "\155\x65\164\141\x64\x61\x74\x61"), array("\x66\x69\154\145\x73\137\x6d\145\164\x61\144\x61\x74\141", "\x66\151\154\145\x73\137\x6d\145\164\x61\x64\141\164\141"), array("\163\x74\x61\x64\151\x61", "\x73\164\x61\x64\151\141"), array("\x41\144\144\x72\145\x73\163\145\x73", "\x41\144\144\x72\145\163\x73"), array("\163\151\x65\x76\x65\163", "\x73\x69\145\x76\x65"), array("\x62\154\x75\145\x5f\157\143\164\x6f\160\165\x73\145\163", "\x62\154\165\x65\137\157\x63\164\x6f\x70\x75\163"), array("\x63\150\x65\146\163", "\x63\150\145\146"), array('', ''), array("\x70\157\x6b\x65\x6d\x6f\156", "\x70\157\x6b\x65\x6d\157\x6e")); } public function testPluralizeMultiWordIrregular() : void { Inflector::rules("\151\x72\x72\x65\147\x75\x6c\141\x72", array("\160\x72\145\x67\x75\156\164\141\x5f\146\162\145\143\165\x65\156\x74\x65" => "\160\x72\145\147\165\x6e\164\x61\163\137\x66\162\x65\x63\x75\x65\x6e\164\x65\x73", "\x63\x61\164\x65\147\157\x72\151\141\137\x70\162\x65\147\165\156\164\141\x5f\146\162\145\x63\165\145\x6e\x74\x65" => "\x63\x61\x74\145\x67\157\162\151\x61\x73\137\160\x72\145\147\165\156\x74\141\x73\x5f\x66\x72\x65\143\165\x65\156\x74\x65\163")); $this->assertSame("\x70\162\x65\147\165\x6e\x74\x61\x73\137\x66\162\145\143\165\145\x6e\x74\145\x73", Inflector::pluralize("\160\162\x65\x67\x75\156\164\141\x5f\146\x72\x65\143\165\145\156\164\145")); $this->assertSame("\x63\x61\164\x65\x67\x6f\x72\151\141\x73\x5f\160\162\145\x67\x75\x6e\x74\x61\x73\x5f\x66\162\145\143\x75\x65\156\x74\145\x73", Inflector::pluralize("\143\x61\x74\145\x67\157\162\x69\141\x5f\x70\x72\145\x67\165\x6e\164\141\x5f\146\162\145\143\165\x65\156\x74\x65")); $this->assertSame("\146\141\x71\137\143\x61\164\145\x67\x6f\x72\151\x61\163\x5f\160\x72\x65\x67\x75\156\x74\141\163\x5f\x66\x72\x65\x63\165\x65\156\x74\145\163", Inflector::pluralize("\146\x61\161\137\x63\x61\x74\145\x67\x6f\x72\151\141\137\x70\x72\x65\x67\165\156\164\141\137\146\162\145\x63\x75\145\x6e\164\145")); } public function testInflectingMultiWordIrregulars() : void { Inflector::rules("\160\154\x75\x72\x61\x6c", array("\x72\x75\154\145\x73" => array())); Inflector::rules("\163\151\x6e\147\x75\x6c\x61\x72", array("\162\x75\x6c\145\x73" => array())); $this->assertSame("\x77\151\x73\x64\x6f\155\40\164\157\x6f\164\150", Inflector::singularize("\167\151\x73\x64\x6f\155\40\x74\x65\145\164\x68")); $this->assertSame("\x77\x69\x73\x64\157\x6d\55\x74\157\x6f\164\150", Inflector::singularize("\x77\x69\163\144\x6f\155\55\164\145\x65\164\150")); $this->assertSame("\x77\151\x73\144\x6f\155\137\164\157\157\x74\150", Inflector::singularize("\x77\x69\163\x64\x6f\x6d\x5f\164\x65\x65\164\x68")); $this->assertSame("\x73\167\x65\145\x74\x20\160\157\164\x61\x74\157\145\163", Inflector::pluralize("\x73\x77\145\145\x74\40\160\157\x74\x61\164\x6f")); $this->assertSame("\163\167\145\145\164\x2d\160\157\x74\x61\164\x6f\x65\163", Inflector::pluralize("\163\x77\145\x65\x74\55\x70\x6f\164\141\x74\x6f")); $this->assertSame("\163\x77\145\145\164\137\x70\x6f\x74\x61\x74\x6f\x65\x73", Inflector::pluralize("\163\167\145\x65\x74\137\160\x6f\x74\141\164\x6f")); } public function testUnderscore() : void { $this->assertSame("\x74\145\163\x74\x5f\x74\150\151\x6e\147", Inflector::underscore("\124\145\163\x74\124\x68\151\156\147")); $this->assertSame("\x74\x65\x73\x74\x5f\164\x68\x69\x6e\x67", Inflector::underscore("\x74\x65\163\x74\124\150\151\156\147")); $this->assertSame("\x74\145\163\164\137\x74\x68\151\x6e\x67\137\x65\x78\x74\162\141", Inflector::underscore("\x54\145\163\164\124\150\151\156\x67\x45\170\164\x72\141")); $this->assertSame("\x74\145\163\x74\137\x74\x68\x69\x6e\147\x5f\145\170\164\162\x61", Inflector::underscore("\164\x65\x73\164\124\x68\151\x6e\x67\x45\170\x74\x72\x61")); $this->assertSame("\x74\145\163\x74\137\164\x68\151\163\x5f\164\x68\151\156\x67", Inflector::underscore("\164\145\x73\164\x2d\x74\x68\x69\x73\55\x74\150\x69\x6e\147")); $this->assertSame("\164\145\163\x74\137\x74\150\x69\x6e\x67\137\x65\x78\x74\162\xc3\245", Inflector::underscore("\x74\145\x73\164\124\150\151\x6e\x67\105\170\x74\162\303\xa5")); $this->assertSame("\164\x65\x73\x74\x5f\x74\x68\151\x6e\147", Inflector::underscore("\124\x65\163\164\x54\x68\151\156\147")); $this->assertSame("\x74\145\x73\164\x5f\x74\150\151\156\147", Inflector::underscore("\164\145\x73\164\124\150\151\x6e\x67")); $this->assertSame("\164\145\163\x74\137\164\150\x69\x6e\147\137\145\x78\164\162\141", Inflector::underscore("\x54\145\163\164\x54\x68\151\156\147\105\x78\x74\x72\141")); $this->assertSame("\x74\145\x73\164\137\x74\x68\x69\x6e\x67\137\x65\170\164\162\141", Inflector::underscore("\164\145\x73\164\124\x68\151\x6e\x67\x45\170\164\162\x61")); $this->assertSame("\164\145\163\164\x5f\164\150\151\156\147\x5f\x65\170\x74\162\303\xa5", Inflector::underscore("\164\145\163\x74\x54\150\x69\x6e\147\x45\170\164\x72\303\xa5")); $this->assertSame("\60", Inflector::underscore("\x30")); } public function testDasherized() : void { $this->assertSame("\164\x65\x73\164\x2d\x74\x68\x69\156\147", Inflector::dasherize("\124\145\163\x74\x54\150\x69\156\x67")); $this->assertSame("\x74\x65\163\164\55\164\x68\x69\156\147", Inflector::dasherize("\x74\x65\x73\164\124\150\151\156\147")); $this->assertSame("\164\x65\163\x74\x2d\x74\x68\151\x6e\x67\x2d\145\x78\164\x72\x61", Inflector::dasherize("\124\145\163\x74\x54\150\x69\156\x67\x45\170\x74\162\x61")); $this->assertSame("\164\145\x73\x74\55\x74\150\x69\156\x67\x2d\x65\x78\164\162\141", Inflector::dasherize("\x74\145\x73\x74\124\150\151\156\147\105\x78\164\x72\x61")); $this->assertSame("\x74\x65\163\x74\55\x74\x68\x69\163\x2d\164\150\151\x6e\x67", Inflector::dasherize("\x74\145\x73\x74\x5f\x74\x68\x69\x73\137\164\150\151\x6e\147")); $this->assertSame('', Inflector::dasherize('')); $this->assertSame("\x30", Inflector::dasherize("\x30")); } public function testCamelize() : void { $this->assertSame("\124\145\x73\164\x54\x68\x69\156\x67", Inflector::camelize("\x74\145\x73\x74\x5f\x74\150\151\156\x67")); $this->assertSame("\124\x65\163\164\x2d\164\x68\151\156\147", Inflector::camelize("\164\x65\163\x74\55\164\150\x69\x6e\147")); $this->assertSame("\x54\x65\163\164\x54\150\151\156\x67", Inflector::camelize("\164\x65\163\164\40\164\150\x69\x6e\x67")); $this->assertSame("\124\x65\x73\x74\x5f\x74\150\151\156\147", Inflector::camelize("\x74\145\163\164\x5f\x74\x68\151\156\147", "\x2d")); $this->assertSame("\x54\x65\x73\x74\124\150\151\156\147", Inflector::camelize("\x74\x65\163\x74\x2d\x74\150\151\x6e\x67", "\55")); $this->assertSame("\124\x65\163\x74\124\x68\x69\156\x67", Inflector::camelize("\164\145\x73\x74\40\164\x68\x69\156\x67", "\55")); $this->assertSame("\124\145\x73\x74\137\x74\150\151\156\x67", Inflector::camelize("\x74\145\163\164\x5f\x74\150\x69\x6e\x67", "\x20")); $this->assertSame("\124\x65\163\x74\x2d\164\150\x69\156\x67", Inflector::camelize("\164\x65\x73\x74\x2d\x74\x68\x69\156\x67", "\x20")); $this->assertSame("\124\145\163\164\124\x68\151\156\x67", Inflector::camelize("\164\x65\x73\x74\x20\x74\150\x69\156\147", "\x20")); $this->assertSame("\124\x65\163\164\120\x6c\165\147\151\156\56\124\x65\163\164\120\154\165\x67\x69\156\103\157\x6d\x6d\x65\156\x74\163", Inflector::camelize("\124\145\163\x74\120\154\165\x67\x69\x6e\56\x54\145\163\x74\x50\x6c\165\147\x69\156\103\x6f\155\155\x65\156\164\x73")); } public function testVariableNaming() : void { $this->assertSame("\164\x65\163\164\x46\151\145\x6c\144", Inflector::variable("\x74\x65\163\x74\137\146\151\x65\154\x64")); $this->assertSame("\x74\145\163\164\106\151\x65\x4c\x64", Inflector::variable("\x74\145\163\x74\x5f\x66\151\145\114\144")); $this->assertSame("\x74\145\163\x74\x46\151\x65\154\x64", Inflector::variable("\x74\145\x73\x74\x20\x66\x69\x65\x6c\x64")); $this->assertSame("\x74\x65\163\x74\106\151\x65\x6c\144", Inflector::variable("\x54\145\x73\x74\x5f\x66\x69\145\x6c\x64")); } public function testClassNaming() : void { $this->assertSame("\x41\162\164\151\163\x74\x73\x47\x65\156\x72\x65", Inflector::classify("\x61\x72\164\151\x73\164\163\x5f\147\145\x6e\x72\145\x73")); $this->assertSame("\106\151\x6c\145\123\171\163\x74\145\x6d", Inflector::classify("\x66\x69\154\145\x5f\163\x79\163\x74\145\x6d\x73")); $this->assertSame("\116\x65\x77\163", Inflector::classify("\156\x65\167\x73")); $this->assertSame("\x42\x75\x72\x65\x61\165", Inflector::classify("\x62\x75\x72\145\x61\x75\163")); } public function testTableNaming() : void { $this->assertSame("\141\162\164\x69\x73\x74\163\x5f\147\145\156\x72\145\163", Inflector::tableize("\x41\162\164\151\163\164\x73\107\x65\156\x72\x65")); $this->assertSame("\x66\151\x6c\145\137\x73\171\x73\x74\x65\155\x73", Inflector::tableize("\x46\x69\x6c\x65\123\171\x73\x74\145\155")); $this->assertSame("\156\x65\x77\x73", Inflector::tableize("\x4e\145\167\x73")); $this->assertSame("\x62\x75\x72\145\x61\165\163", Inflector::tableize("\102\165\162\145\141\x75")); } public function testHumanization() : void { $this->assertSame("\x50\x6f\x73\164\163", Inflector::humanize("\x70\x6f\163\x74\163")); $this->assertSame("\120\157\x73\x74\163\40\x54\x61\x67\x73", Inflector::humanize("\160\x6f\163\164\x73\137\164\x61\x67\x73")); $this->assertSame("\x46\x69\x6c\145\x20\123\171\163\164\x65\155\163", Inflector::humanize("\146\151\x6c\145\x5f\x73\171\163\164\145\155\163")); $this->assertSame("\x48\x65\x6c\154\x6f\x20\x57\303\266\x72\x6c\x64", Inflector::humanize("\150\145\154\x6c\x6f\137\x77\303\xb6\162\x6c\x64")); $this->assertSame("\347\xa6\x8f\345\262\xa1\40\x43\x69\164\x79", Inflector::humanize("\347\246\x8f\345\xb2\xa1\x5f\x63\x69\164\171")); } public function testCustomPluralRule() : void { Inflector::rules("\160\x6c\x75\x72\x61\154", array("\57\x5e\x28\x63\165\x73\164\x6f\155\x29\44\57\151" => "\x5c\x31\x69\172\141\x62\154\145\x73")); Inflector::rules("\165\156\x69\156\146\154\x65\x63\x74\145\x64", array("\165\x6e\151\156\x66\x6c\145\143\164\x61\x62\154\145")); $this->assertSame("\143\165\x73\x74\x6f\x6d\x69\172\x61\x62\154\145\163", Inflector::pluralize("\143\165\163\x74\157\x6d")); $this->assertSame("\x75\x6e\151\156\x66\154\145\x63\164\141\x62\154\x65", Inflector::pluralize("\x75\x6e\151\x6e\146\x6c\x65\x63\x74\141\142\154\x65")); Inflector::rules("\x70\154\165\x72\x61\x6c", array("\57\x5e\50\x61\154\145\162\164\51\44\57\x69" => "\x5c\x31\x61\x62\x6c\x65\163")); Inflector::rules("\x69\162\x72\145\147\x75\154\x61\162", array("\141\155\141\x7a\x65" => "\141\155\x61\x7a\141\142\x6c\145", "\x70\150\x6f\156\x65" => "\160\x68\157\156\145\x7a\145\x73")); Inflector::rules("\165\156\x69\x6e\146\x6c\145\x63\164\x65\144", array("\156\x6f\x66\x6c\x65\143\x74", "\x61\x62\164\165\x73\145")); $this->assertSame("\x6e\157\146\x6c\145\143\x74", Inflector::pluralize("\x6e\x6f\146\154\145\x63\164")); $this->assertSame("\x61\x62\x74\x75\163\x65", Inflector::pluralize("\x61\142\x74\x75\x73\x65")); $this->assertSame("\x61\154\145\162\164\x61\142\x6c\x65\x73", Inflector::pluralize("\141\x6c\145\x72\164")); $this->assertSame("\141\x6d\x61\x7a\x61\142\154\145", Inflector::pluralize("\141\155\141\x7a\x65")); $this->assertSame("\160\x68\x6f\x6e\145\x7a\145\163", Inflector::pluralize("\x70\x68\x6f\156\145")); $this->assertSame("\x63\162\x69\x74\145\x72\x69\x61", Inflector::pluralize("\x63\162\151\164\x65\x72\x69\x6f\156")); $this->assertSame("\x74\x65\163\x74\x5f\x63\x72\151\164\145\x72\x69\x61", Inflector::pluralize("\x74\x65\163\164\x5f\x63\162\151\164\x65\x72\x69\x6f\156")); $this->assertSame("\103\x72\x69\164\145\162\x69\141", Inflector::pluralize("\x43\162\151\164\145\x72\x69\x6f\x6e")); $this->assertSame("\124\145\163\164\x43\162\x69\164\x65\x72\151\x61", Inflector::pluralize("\124\145\163\x74\103\x72\151\x74\x65\x72\x69\x6f\156")); $this->assertSame("\x54\145\163\164\40\103\x72\151\164\145\x72\x69\141", Inflector::pluralize("\124\145\163\x74\x20\x43\x72\151\164\145\x72\x69\157\x6e")); } public function testCustomSingularRule() : void { Inflector::rules("\165\156\x69\156\x66\x6c\x65\x63\x74\x65\x64", array("\163\151\x6e\147\x75\x6c\x61\x72\x73")); Inflector::rules("\x73\151\x6e\x67\x75\x6c\141\x72", array("\x2f\x28\145\160\154\145\x29\162\x24\57\x69" => "\134\61", "\x2f\x28\x6a\x65\x6e\164\x65\x29\162\44\57\151" => "\x5c\x31")); $this->assertSame("\x65\x70\x6c\x65", Inflector::singularize("\x65\160\154\x65\x72")); $this->assertSame("\x6a\145\156\164\x65", Inflector::singularize("\152\145\156\164\x65\162")); Inflector::rules("\x73\151\156\147\x75\x6c\x61\x72", array("\57\136\x28\142\151\154\51\x65\x72\x24\x2f\151" => "\134\x31", "\x2f\136\x28\151\156\x66\x6c\x65\143\x7c\x63\157\156\164\162\x69\142\165\51\164\157\162\163\44\x2f\151" => "\134\61\164\141")); Inflector::rules("\x69\x72\162\x65\147\x75\x6c\x61\x72", array("\x73\x70\x69\x6e\x6f\x72" => "\163\x70\151\x6e\x73")); $this->assertSame("\163\x70\151\x6e\x6f\x72", Inflector::singularize("\x73\x70\151\156\163")); $this->assertSame("\x69\x6e\x66\154\x65\x63\164\x61", Inflector::singularize("\151\156\x66\x6c\x65\143\x74\157\162\163")); $this->assertSame("\x63\x6f\156\x74\162\x69\142\x75\x74\141", Inflector::singularize("\x63\x6f\156\164\162\x69\x62\165\164\x6f\x72\163")); $this->assertSame("\163\x69\x6e\x67\x75\x6c\x61\162\x73", Inflector::singularize("\163\151\156\x67\x75\154\141\x72\163")); $this->assertSame("\143\162\x69\x74\145\162\151\x6f\156", Inflector::singularize("\143\162\x69\x74\145\162\x69\x61")); $this->assertSame("\164\145\163\x74\x5f\143\x72\151\164\145\162\x69\157\x6e", Inflector::singularize("\164\145\x73\164\x5f\143\162\x69\164\145\162\151\141")); $this->assertSame("\x43\162\x69\x74\x65\x72\151\x6f\x6e", Inflector::singularize("\103\162\x69\x74\x65\162\x69\141")); $this->assertSame("\x54\145\163\x74\103\162\151\164\145\x72\x69\157\x6e", Inflector::singularize("\124\145\163\x74\103\x72\x69\164\x65\x72\151\141")); $this->assertSame("\124\x65\x73\x74\x20\x43\162\x69\x74\145\162\x69\157\156", Inflector::singularize("\124\145\163\164\40\103\x72\x69\x74\145\162\x69\x61")); } public function testRulesClearsCaches() : void { $this->assertSame("\x42\x61\156\x61\x6e\x61", Inflector::singularize("\102\x61\156\x61\x6e\141\163")); $this->assertSame("\142\x61\x6e\x61\x6e\141\x73", Inflector::tableize("\x42\141\156\141\156\141")); $this->assertSame("\x42\141\x6e\141\x6e\141\x73", Inflector::pluralize("\102\x61\x6e\141\156\141")); Inflector::rules("\x73\x69\x6e\147\x75\x6c\x61\x72", array("\x2f\50\56\x2a\51\x6e\141\163\44\57\151" => "\x5c\x31\x7a\x7a\x7a")); $this->assertSame("\x42\141\156\141\x7a\172\172", Inflector::singularize("\x42\141\x6e\x61\156\141\163"), "\127\x61\x73\40\151\156\x66\154\x65\x63\164\145\144\40\x77\x69\x74\150\40\x6f\x6c\144\x20\x72\165\x6c\145\x73\56"); Inflector::rules("\160\x6c\165\162\141\x6c", array("\x2f\x28\56\52\51\x6e\x61\44\57\151" => "\x5c\61\172\x7a\172")); Inflector::rules("\151\162\x72\145\x67\165\x6c\x61\x72", array("\143\x6f\162\x70\x75\x73" => "\x63\157\162\x70\157\162\x61")); $this->assertSame("\x42\x61\x6e\141\x7a\172\x7a", Inflector::pluralize("\102\x61\x6e\x61\x6e\x61"), "\x57\141\x73\40\x69\x6e\x66\x6c\x65\x63\164\145\x64\40\167\x69\164\x68\40\157\154\144\40\162\165\x6c\145\x73\56"); $this->assertSame("\x63\x6f\x72\160\x6f\x72\x61", Inflector::pluralize("\143\157\x72\160\x75\x73"), "\x57\141\x73\40\151\x6e\146\x6c\x65\143\164\145\x64\40\167\151\164\x68\40\x6f\x6c\144\x20\x69\x72\162\x65\x67\x75\x6c\x61\x72\40\146\x6f\162\155\56"); } public function testCustomRuleWithReset() : void { $uninflected = array("\x61\164\x6c\141\x73", "\154\141\160\x69\163", "\157\156\x69\142\x75\163", "\160\x69\162\145\x73", "\x76\x69\x72\165\163", "\56\x2a\170"); $pluralIrregular = array("\x61\163" => "\x61\163\145\163"); Inflector::rules("\x73\151\x6e\147\165\x6c\141\x72", array("\x2f\136\50\56\x2a\x29\x28\141\x7c\x65\x7c\157\174\165\x29\151\163\x24\x2f\x69" => "\x5c\x31\134\62\154"), true); Inflector::rules("\160\154\x75\x72\141\x6c", array("\x2f\x5e\50\56\x2a\x29\x28\x61\x7c\145\174\157\174\x75\51\x6c\x24\x2f\x69" => "\x5c\x31\134\x32\151\163"), true); Inflector::rules("\x75\x6e\151\x6e\x66\x6c\145\143\x74\145\x64", $uninflected, true); Inflector::rules("\x69\162\162\145\147\x75\154\141\x72", $pluralIrregular, true); $this->assertSame("\x41\x6c\143\157\x6f\x69\x73", Inflector::pluralize("\x41\x6c\143\157\x6f\154")); $this->assertSame("\x41\x74\154\x61\163", Inflector::pluralize("\x41\164\x6c\x61\163")); $this->assertSame("\x41\154\x63\157\x6f\x6c", Inflector::singularize("\x41\154\x63\x6f\157\x69\163")); $this->assertSame("\x41\164\154\x61\x73", Inflector::singularize("\101\x74\x6c\141\x73")); } }
Function Calls
None |
Stats
MD5 | e292447b07eb65e142e5133849307ff4 |
Eval Count | 0 |
Decode Time | 122 ms |