diff --git a/src/Inflection.php b/src/Inflection.php index e222a21..4d9f4de 100644 --- a/src/Inflection.php +++ b/src/Inflection.php @@ -537,20 +537,20 @@ public function inflect($text, $animate = FALSE) $inflectedWord = [1 => $word]; $word = $this->breakAccents($word); - + $wordLower = strtolower($word); if ($gender === NULL) { - if (in_array($word, $this->forceM)) { + if (in_array($wordLower, $this->forceM)) { $gender = 'm'; - } else if (in_array($word, $this->forceF)) { + } else if (in_array($wordLower, $this->forceF)) { $gender = 'f'; - } else if (in_array($word, $this->forceS)) { + } else if (in_array($wordLower, $this->forceS)) { $gender = 's'; } } $exception = NULL; foreach ($this->exceptions as $e) { - if ($word === $e[0]) { + if ($wordLower === $e[0]) { $exception = $e; break; } diff --git a/tests/InflectionTest.php b/tests/InflectionTest.php index 44842d3..7ad2600 100644 --- a/tests/InflectionTest.php +++ b/tests/InflectionTest.php @@ -147,6 +147,26 @@ public function providerNames() 13 => 'Marcelích', 14 => 'Marcely' ) + ), + array( + "Dagmar", //name to inflection + null, //environment ? - životné - null because it is inferred from the array with exceptional words + array( //expected result + 1 => "Dagmar", + 2 => "Dagmary", + 3 => "Dagmaře", + 4 => "Dagmar", + 5 => "Dagmar", + 6 => "Dagmar", + 7 => "Dagmar", + 8 => 'Dagmary', + 9 => 'Dagmar', + 10 => 'Dagmarám', + 11 => 'Dagmary', + 12 => 'Dagmary', + 13 => 'Dagmarách', + 14 => 'Dagmarami' + ) ) );