Skip to content

Commit

Permalink
Merge pull request #83 from villfa/testing
Browse files Browse the repository at this point in the history
Update the test suite to run with a wider range of PHP versions
  • Loading branch information
aik099 authored Jul 8, 2024
2 parents 696163a + e3b7bfc commit dd03e52
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
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

0 comments on commit dd03e52

Please sign in to comment.