Skip to content

Commit

Permalink
Allow installation of PHPUnit 8 in order to test with PHP 8.1 and 8.2 (
Browse files Browse the repository at this point in the history
…#82)

* Allow installation of PHPUnit 8
* Run the tests with PHP 8.1 and 8.2
  • Loading branch information
villfa authored Dec 14, 2023
1 parent d34238d commit 696163a
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 21 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']

name: PHP ${{ matrix.php }}

Expand All @@ -26,13 +26,8 @@ jobs:
tools: composer:v2
coverage: none

- name: Install PHP 7 dependencies
- name: Install PHP dependencies
run: composer update --prefer-dist --no-interaction --no-progress
if: "matrix.php != '8.0'"

- name: Install PHP 8 dependencies
run: composer update --prefer-dist --no-interaction --no-progress --ignore-platform-reqs
if: "matrix.php == '8.0'"

- name: Execute tests
run: vendor/bin/phpunit -c tests/phpunit.xml.dist
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
composer.lock
tests/.phpunit.result.cache
vendor
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

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

"replace": {
Expand Down
5 changes: 4 additions & 1 deletion tests/Hamcrest/Core/CombinableMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ class CombinableMatcherTest extends \Hamcrest\AbstractMatcherTest
private $_either_3_or_4;
private $_not_3_and_not_4;

protected function setUp()
/**
* @before
*/
protected function setUpTest()
{
$this->_either_3_or_4 = \Hamcrest\Core\CombinableMatcher::either(equalTo(3))->orElse(equalTo(4));
$this->_not_3_and_not_4 = \Hamcrest\Core\CombinableMatcher::both(not(equalTo(3)))->andAlso(not(equalTo(4)));
Expand Down
5 changes: 4 additions & 1 deletion tests/Hamcrest/Core/IsInstanceOfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ class IsInstanceOfTest extends \Hamcrest\AbstractMatcherTest
private $_baseClassInstance;
private $_subClassInstance;

protected function setUp()
/**
* @before
*/
protected function setUpTest()
{
$this->_baseClassInstance = new \Hamcrest\Core\SampleBaseClass('good');
$this->_subClassInstance = new \Hamcrest\Core\SampleSubClass('good');
Expand Down
5 changes: 4 additions & 1 deletion tests/Hamcrest/Core/SetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ class SetTest extends \Hamcrest\AbstractMatcherTest
public static $_classProperty;
public $_instanceProperty;

protected function setUp()
/**
* @before
*/
protected function setUpTest()
{
self::$_classProperty = null;
unset($this->_instanceProperty);
Expand Down
5 changes: 4 additions & 1 deletion tests/Hamcrest/FeatureMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ class FeatureMatcherTest extends \Hamcrest\AbstractMatcherTest

private $_resultMatcher;

protected function setUp()
/**
* @before
*/
protected function setUpTest()
{
$this->_resultMatcher = $this->_resultMatcher();
}
Expand Down
5 changes: 4 additions & 1 deletion tests/Hamcrest/MatcherAssertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
class MatcherAssertTest extends TestCase
{

protected function setUp()
/**
* @before
*/
protected function setUpTest()
{
\Hamcrest\MatcherAssert::resetCount();
}
Expand Down
5 changes: 4 additions & 1 deletion tests/Hamcrest/StringDescriptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ class StringDescriptionTest extends TestCase

private $_description;

protected function setUp()
/**
* @before
*/
protected function setUpTest()
{
$this->_description = new \Hamcrest\StringDescription();
}
Expand Down
5 changes: 4 additions & 1 deletion tests/Hamcrest/Text/IsEqualIgnoringWhiteSpaceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ class IsEqualIgnoringWhiteSpaceTest extends \Hamcrest\AbstractMatcherTest

private $_matcher;

protected function setUp()
/**
* @before
*/
protected function setUpTest()
{
$this->_matcher = \Hamcrest\Text\IsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace(
"Hello World how\n are we? "
Expand Down
5 changes: 4 additions & 1 deletion tests/Hamcrest/Text/StringContainsIgnoringCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ class StringContainsIgnoringCaseTest extends \Hamcrest\AbstractMatcherTest

private $_stringContains;

protected function setUp()
/**
* @before
*/
protected function setUpTest()
{
$this->_stringContains = \Hamcrest\Text\StringContainsIgnoringCase::containsStringIgnoringCase(
strtolower(self::EXCERPT)
Expand Down
5 changes: 4 additions & 1 deletion tests/Hamcrest/Text/StringContainsInOrderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ class StringContainsInOrderTest extends \Hamcrest\AbstractMatcherTest

private $_m;

protected function setUp()
/**
* @before
*/
protected function setUpTest()
{
$this->_m = \Hamcrest\Text\StringContainsInOrder::stringContainsInOrder(array('a', 'b', 'c'));
}
Expand Down
5 changes: 4 additions & 1 deletion tests/Hamcrest/Text/StringContainsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ class StringContainsTest extends \Hamcrest\AbstractMatcherTest

private $_stringContains;

protected function setUp()
/**
* @before
*/
protected function setUpTest()
{
$this->_stringContains = \Hamcrest\Text\StringContains::containsString(self::EXCERPT);
}
Expand Down
5 changes: 4 additions & 1 deletion tests/Hamcrest/Text/StringEndsWithTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ class StringEndsWithTest extends \Hamcrest\AbstractMatcherTest

private $_stringEndsWith;

protected function setUp()
/**
* @before
*/
protected function setUpTest()
{
$this->_stringEndsWith = \Hamcrest\Text\StringEndsWith::endsWith(self::EXCERPT);
}
Expand Down
5 changes: 4 additions & 1 deletion tests/Hamcrest/Text/StringStartsWithTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ class StringStartsWithTest extends \Hamcrest\AbstractMatcherTest

private $_stringStartsWith;

protected function setUp()
/**
* @before
*/
protected function setUpTest()
{
$this->_stringStartsWith = \Hamcrest\Text\StringStartsWith::startsWith(self::EXCERPT);
}
Expand Down
5 changes: 4 additions & 1 deletion tests/Hamcrest/Xml/HasXPathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ class HasXPathTest extends \Hamcrest\AbstractMatcherTest
protected static $doc;
protected static $html;

public static function setUpBeforeClass()
/**
* @beforeClass
*/
public static function setUpBeforeClassTest()
{
self::$xml = <<<XML
<?xml version="1.0"?>
Expand Down

0 comments on commit 696163a

Please sign in to comment.