Skip to content

Commit

Permalink
add DcaUtilTest->testExecuteCallback()
Browse files Browse the repository at this point in the history
  • Loading branch information
ericges committed Mar 25, 2024
1 parent 6bb7416 commit 0ffce58
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Options/OptionsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function has(string $key): bool

public function del(string $key): static
{
unset($this->$key);
unset($this->options[$key]);
return $this;
}
Expand Down
17 changes: 17 additions & 0 deletions tests/Util/Dca/DcaUtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,21 @@ public function testGetDcaFields()
'title',
], $fields);
}

public function testExecuteCallback()
{
$instance = $this->getTestInstance();

$this->assertSame('ham', $instance->executeCallback(function () {
return 'ham';
}));

$this->assertSame('spam', $instance->executeCallback(function ($value) {
return $value;
}, ['spam']));

$this->assertSame('spam_ham', $instance->executeCallback(
[\HeimrichHannot\UtilsBundle\Util\StringUtil::class, 'camelCaseToSnake'], ['spamHam'])
);
}
}

0 comments on commit 0ffce58

Please sign in to comment.