Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed pluralization issue for words ending in ies

  • Loading branch information...
commit 7eed47018a355871a51373d208e6dde9f68ccc35 1 parent cc7e0d5
@jbroadway authored
Showing with 6 additions and 0 deletions.
  1. +1 −0  ActiveResource.php
  2. +5 −0 tests/ActiveResource.php
View
1  ActiveResource.php
@@ -181,6 +181,7 @@ function pluralize ($word) {
$word = preg_replace ('/sises$/', 'ses', $word);
$word = preg_replace ('/([^aeiouy]|qu)ys$/', '\1ies', $word);
$word = preg_replace ('/(?:([^f])fe|([lr])f)s$/', '\1\2ves', $word);
+ $word = preg_replace ('/ieses$/', 'ies', $word);
if (isset ($this->pleural_corrections[$word])) {
return $this->pleural_corrections[$word];
}
View
5 tests/ActiveResource.php
@@ -66,6 +66,11 @@ function test_pleuralize () {
$this->assertEquals ($t->pluralize ('life'), 'lives');
$this->assertEquals ($t->pluralize ('wife'), 'wives');
$this->assertEquals ($t->pluralize ('song'), 'songs');
+ $this->assertEquals ($t->pluralize ('try'), 'tries');
+ $this->assertEquals ($t->pluralize ('tree'), 'trees');
+ $this->assertEquals ($t->pluralize ('tries'), 'tries');
+ $this->assertEquals ($t->pluralize ('entry'), 'entries');
+ $this->assertEquals ($t->pluralize ('entries'), 'entries');
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.