Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Matrices/Matrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{
public function __construct(
private ReleasesInterface $releases,
private VersionParser $versionParser = new VersionParser(),
private VersionParser $versionParser = new VersionParser,
) {}

/**
Expand All @@ -36,6 +36,5 @@ public function satisfiedBy(string $constraint): array
previous: $e
);
}

}
}
18 changes: 18 additions & 0 deletions tests/Unit/Matrices/MatrixTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Tests\Unit\Matrices;

use Mockery;
use Throwable;
use TypistTech\PhpMatrix\Exceptions\UnexpectedValueException;
use TypistTech\PhpMatrix\Matrices\Matrix;
use TypistTech\PhpMatrix\Matrices\MatrixInterface;
Expand Down Expand Up @@ -81,5 +82,22 @@

$matrix->satisfiedBy('invalid constraint');
})->throws(UnexpectedValueException::class);

it('does not invoke ReleasesInterface::all() when invalid constraint', function () {
$releases = Mockery::mock(ReleasesInterface::class);

$releases->expects()
->all()
->withAnyArgs()
->never();

$matrix = new Matrix($releases);

try {
$matrix->satisfiedBy('invalid constraint');
} catch (Throwable $e) {
// No-op.
}
});
});
});
Loading