/** * @test */ function it_pluralizes_and_singularizes_last_words_in_camelcased_strings() { $words = [['korteFles', 'korteFlessen'], ['zeerLangeFiets', 'zeerLangeFietsen'], ['notCamelCased_fiets', 'notCamelCased_fietsen'], ['CBP', 'CBPs']]; foreach ($words as $forms) { foreach ($forms as $word) { $this->assertEquals($forms[0], $this->dutch->singularize($word), "Singular form for '{$word}' is incorrect."); $this->assertEquals($forms[1], $this->dutch->pluralize($word), "Plural form for '{$word}' is incorrect."); } } }
/** * Pluralizes a noun/name for Dutch content * * @param string $name * @return string */ protected function dutchPluralize($name) { if (empty($this->dutchHelper)) { return $name; } return $this->dutchHelper->pluralize($name); }