Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the test suite to run with a wider range of PHP versions #83

Merged
merged 2 commits into from
Jul 8, 2024
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
15 changes: 14 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,20 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php:
- '5.3'
- '5.4'
- '5.5'
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- '8.0'
- '8.1'
- '8.2'
- '8.3'

name: PHP ${{ matrix.php }}

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
},

"require-dev": {
"phpunit/php-file-iterator": "^1.4 || ^2.0",
"phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0 || ^8.0"
"phpunit/php-file-iterator": "^1.4 || ^2.0 || ^3.0",
"phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0 || ^8.0 || ^9.0"
},

"replace": {
Expand Down
23 changes: 15 additions & 8 deletions tests/Hamcrest/UtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,28 @@ public function testCheckAllAreMatchersAcceptsMatchers()
));
}

/**
* @expectedException InvalidArgumentException
*/
public function testCheckAllAreMatchersFailsForPrimitive()
{
\Hamcrest\Util::checkAllAreMatchers(array(
new \Hamcrest\Text\MatchesPattern('/fo+/'),
'foo',
));
$exceptionThrown = false;
try {
\Hamcrest\Util::checkAllAreMatchers(array(
new \Hamcrest\Text\MatchesPattern('/fo+/'),
'foo',
));
} catch (\InvalidArgumentException $exception) {
$exceptionThrown = true;
}

$this->assertTrue(
$exceptionThrown,
'Failed asserting that exception of type "InvalidArgumentException" is thrown.'
);
}

private function callAndAssertCreateMatcherArray($items)
{
$matchers = \Hamcrest\Util::createMatcherArray($items);
$this->assertInternalType('array', $matchers);
$this->assertTrue(is_array($matchers), sprintf('Type "array" expected, but got "%s" instead', gettype($matchers)));
$this->assertSameSize($items, $matchers);
foreach ($matchers as $matcher) {
$this->assertInstanceOf('\Hamcrest\Matcher', $matcher);
Expand Down
Loading