Skip to content

Commit

Permalink
Assertions enable when testing (#700)
Browse files Browse the repository at this point in the history
* enable assertions when testing

* fix invalid asserts
  • Loading branch information
frederikbosch committed Aug 11, 2022
1 parent 17b210e commit cef1e1e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
with:
php-version: ${{ matrix.php }}
extensions: bcmath, gmp, intl, dom, mbstring
ini-values: zend.assertions=1

- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
Expand Down
4 changes: 2 additions & 2 deletions spec/Currencies/Matchers.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Money\Currency;

use function assert;
use function is_array;
use function is_iterable;

trait Matchers
{
Expand All @@ -16,7 +16,7 @@ public function getMatchers(): array
{
return [
'haveCurrency' => static function (mixed $subject, mixed $value): bool {
assert(is_array($subject));
assert(is_iterable($subject));

foreach ($subject as $currency) {
assert($currency instanceof Currency);
Expand Down
2 changes: 1 addition & 1 deletion src/CurrencyPair.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static function createFromIso(string $iso): CurrencyPair
}

assert($matches[1] !== '');
assert(is_numeric($matches[2]));
assert($matches[2] !== '');
assert(is_numeric($matches[3]));

return new self(new Currency($matches[1]), new Currency($matches[2]), $matches[3]);
Expand Down

0 comments on commit cef1e1e

Please sign in to comment.