Skip to content

Commit

Permalink
test for plural or singular of add/remove functions
Browse files Browse the repository at this point in the history
  • Loading branch information
sHorst committed May 6, 2024
1 parent dd56804 commit 716bc2e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Classes/Domain/Model/ModelUnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,20 +210,20 @@ public function testNotTestedStringAndIntegerAttributes(): void
$remove = 'remove' . ucfirst($attribute);

// remove s at end
if (!$method_exists($this->subject, $add)) {
$add = substr($add, 0, len($add) - 1);
if (!method_exists($this->subject, $add)) {
$add = mb_substr($add, 0, -1);
}

// remove s at end
if (!$method_exists($this->subject, $remove)) {
$remove = substr($remove, 0, len($remove) - 1);
if (!method_exists($this->subject, $remove)) {
$remove = mb_substr($remove, 0, -1);
}

if (!$method_exists($this->subject, $add)) {
if (!method_exists($this->subject, $add)) {
self::fail('there is no add' . ucfirst($attribute) . ' or ' . $add . ' function!');
}

if (!$method_exists($this->subject, $remove)) {
if (!method_exists($this->subject, $remove)) {
self::fail('there is no remove' . ucfirst($attribute) . ' or ' . $remove . ' function!');
}

Expand Down

0 comments on commit 716bc2e

Please sign in to comment.