Skip to content

Commit

Permalink
Merge pull request #9 from zf1s/Make_Php_8.1_Compatiable
Browse files Browse the repository at this point in the history
  • Loading branch information
partikus authored Oct 10, 2022
2 parents c0bc7ab + 7bcaf94 commit 253f4b3
Show file tree
Hide file tree
Showing 141 changed files with 9,941 additions and 46 deletions.
34 changes: 10 additions & 24 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ on:

jobs:
test:
name: PHP:${{ matrix.php }} PHP_INVOKER:${{ toJSON(matrix.php_invoker) }} ALLOW_FAILURES:${{ toJSON(matrix.experimental) }} COVERAGE:${{ toJSON(matrix.coverage) }}
name: PHP:${{ matrix.php }} php-invoker:${{ toJSON(matrix.php_invoker) }}${{ matrix.coverage && ' (with coverage)' || '' }}${{ matrix.experimental && ' (allowing failures - php version not supported yet)' || '' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
experimental: [false]
coverage: [false]
php:
- "5.3"
- "5.4"
Expand All @@ -24,32 +22,20 @@ jobs:
- "7.1"
- "7.2"
- "7.3"
php_invoker:
- true
- false
- "8.0"
- "8.1"
- "8.2"
php_invoker: [true, false]
coverage: [false]
experimental: [false]
include:
- php: "7.4"
php_invoker: true
coverage: true
# run coverage only on PHP 7.4
- php: "7.4"
php_invoker: false
coverage: true
- php: "8.0"
php_invoker: true
experimental: false
coverage: false
- php: "8.0"
php_invoker: false
coverage: false
experimental: false
- php: "8.1"
- php: "7.4"
php_invoker: true
experimental: true
coverage: false
- php: "8.1"
php_invoker: false
experimental: true
coverage: false
coverage: true

steps:
- name: Checkout Code
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Tests/TextUI/*.log
Tests/TextUI/*.out
Tests/TextUI/*.php
/bin
/vendor
/composer.lock
/composer.phar
vendor
composer.lock
composer.phar
phpunit.xml
cache.properties
.idea
1 change: 1 addition & 0 deletions PHPUnit/Extensions/PhptTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public function __construct($filename, array $options = array())
*
* @return integer
*/
#[\ReturnTypeWillChange]
public function count()
{
return 1;
Expand Down
1 change: 1 addition & 0 deletions PHPUnit/Extensions/RepeatedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public function __construct(PHPUnit_Framework_Test $test, $timesRepeat = 1, $fil
*
* @return integer
*/
#[\ReturnTypeWillChange]
public function count()
{
return $this->timesRepeat * count($this->test);
Expand Down
1 change: 1 addition & 0 deletions PHPUnit/Extensions/TestDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public function basicRun(PHPUnit_Framework_TestResult $result)
*
* @return integer
*/
#[\ReturnTypeWillChange]
public function count()
{
return count($this->test);
Expand Down
1 change: 1 addition & 0 deletions PHPUnit/Framework/Constraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ protected function matches($other)
* @return integer
* @since Method available since Release 3.4.0
*/
#[\ReturnTypeWillChange]
public function count()
{
return 1;
Expand Down
1 change: 1 addition & 0 deletions PHPUnit/Framework/Constraint/And.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public function toString()
* @return integer
* @since Method available since Release 3.4.0
*/
#[\ReturnTypeWillChange]
public function count()
{
$count = 0;
Expand Down
1 change: 1 addition & 0 deletions PHPUnit/Framework/Constraint/Composite.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public function evaluate($other, $description = '', $returnResult = FALSE)
*
* @return integer
*/
#[\ReturnTypeWillChange]
public function count()
{
return count($this->innerConstraint);
Expand Down
1 change: 1 addition & 0 deletions PHPUnit/Framework/Constraint/IsAnything.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public function toString()
* @return integer
* @since Method available since Release 3.5.0
*/
#[\ReturnTypeWillChange]
public function count()
{
return 0;
Expand Down
1 change: 1 addition & 0 deletions PHPUnit/Framework/Constraint/Not.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ public function toString()
* @return integer
* @since Method available since Release 3.4.0
*/
#[\ReturnTypeWillChange]
public function count()
{
return count($this->constraint);
Expand Down
1 change: 1 addition & 0 deletions PHPUnit/Framework/Constraint/Or.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public function toString()
* @return integer
* @since Method available since Release 3.4.0
*/
#[\ReturnTypeWillChange]
public function count()
{
$count = 0;
Expand Down
1 change: 1 addition & 0 deletions PHPUnit/Framework/Constraint/Xor.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public function toString()
* @return integer
* @since Method available since Release 3.4.0
*/
#[\ReturnTypeWillChange]
public function count()
{
$count = 0;
Expand Down
1 change: 1 addition & 0 deletions PHPUnit/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ public function toString()
*
* @return integer
*/
#[\ReturnTypeWillChange]
public function count()
{
return 1;
Expand Down
1 change: 1 addition & 0 deletions PHPUnit/Framework/TestResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@ public function run(PHPUnit_Framework_Test $test)
*
* @return integer
*/
#[\ReturnTypeWillChange]
public function count()
{
return $this->runTests;
Expand Down
2 changes: 2 additions & 0 deletions PHPUnit/Framework/TestSuite.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ public function addTestFiles($filenames)
*
* @return integer
*/
#[\ReturnTypeWillChange]
public function count()
{
if ($this->numTests > -1) {
Expand Down Expand Up @@ -925,6 +926,7 @@ public function setBackupStaticAttributes($backupStaticAttributes)
* @return RecursiveIteratorIterator
* @since Method available since Release 3.1.0
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new RecursiveIteratorIterator(
Expand Down
12 changes: 8 additions & 4 deletions PHPUnit/Util/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,10 @@ public function handlePHPConfiguration()
// See https://github.com/sebastianbergmann/phpunit/issues/277
switch ($array) {
case 'var':
$target = &$GLOBALS;
break;
foreach ($configuration[$array] as $name => $value) {
$GLOBALS[$name] = $value;
}
continue 2;

case 'env':
$target = &$_ENV;
Expand All @@ -550,8 +552,10 @@ public function handlePHPConfiguration()
break;

default:
$target = &$GLOBALS['_' . strtoupper($array)];
break;
foreach ($configuration[$array] as $name => $value) {
$GLOBALS['_' . strtoupper($array)][$name] = $value;
}
continue 2;
}

foreach ($configuration[$array] as $name => $value) {
Expand Down
2 changes: 1 addition & 1 deletion PHPUnit/Util/Getopt.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ protected static function parseLongOption($arg, $long_options, &$opts, &$args)

if (substr($long_opt, -1) == '=') {
if (substr($long_opt, -2) != '==') {
if (!strlen($opt_arg)) {
if ($opt_arg === null || !strlen($opt_arg)) {
if (false === $opt_arg = current($args)) {
throw new PHPUnit_Framework_Exception(
"option --$opt requires an argument"
Expand Down
5 changes: 5 additions & 0 deletions PHPUnit/Util/TestSuiteIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public function __construct(PHPUnit_Framework_TestSuite $testSuite)
* Rewinds the Iterator to the first element.
*
*/
#[\ReturnTypeWillChange]
public function rewind()
{
$this->position = 0;
Expand All @@ -90,6 +91,7 @@ public function rewind()
*
* @return boolean
*/
#[\ReturnTypeWillChange]
public function valid()
{
return $this->position < count($this->tests);
Expand All @@ -100,6 +102,7 @@ public function valid()
*
* @return integer
*/
#[\ReturnTypeWillChange]
public function key()
{
return $this->position;
Expand All @@ -110,6 +113,7 @@ public function key()
*
* @return PHPUnit_Framework_Test
*/
#[\ReturnTypeWillChange]
public function current()
{
return $this->valid() ? $this->tests[$this->position] : NULL;
Expand All @@ -119,6 +123,7 @@ public function current()
* Moves forward to next element.
*
*/
#[\ReturnTypeWillChange]
public function next()
{
$this->position++;
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PHPUnit 3.7.x php 5.3-8.0 compatible
# PHPUnit 3.7.x php 5.3-8.2 compatible

This version of PHPUnit bases on release 3.7.38 and is adjusted for compatibility with PHP 5.3-8.0.
This version of PHPUnit bases on release 3.7.38 and is adjusted for compatibility with PHP 5.3-8.2.
The package was created especially for testing https://github.com/zf1s packages.

All credits go to original PHPUnit author and contributors.
1 change: 1 addition & 0 deletions Tests/_files/DoubleTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public function __construct(PHPUnit_Framework_TestCase $testCase)
$this->testCase = $testCase;
}

#[\ReturnTypeWillChange]
public function count()
{
return 2;
Expand Down
4 changes: 4 additions & 0 deletions Tests/_files/SampleArrayAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,23 @@ class SampleArrayAccess implements ArrayAccess
public function __construct() {
$this->container = array();
}
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value) {
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
#[\ReturnTypeWillChange]
public function offsetExists($offset) {
return isset($this->container[$offset]);
}
#[\ReturnTypeWillChange]
public function offsetUnset($offset) {
unset($this->container[$offset]);
}
#[\ReturnTypeWillChange]
public function offsetGet($offset) {
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
Expand Down
5 changes: 5 additions & 0 deletions Tests/_files/TestIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,31 @@ public function __construct($array = array())
$this->array = $array;
}

#[\ReturnTypeWillChange]
public function rewind()
{
$this->position = 0;
}

#[\ReturnTypeWillChange]
public function valid()
{
return $this->position < count($this->array);
}

#[\ReturnTypeWillChange]
public function key()
{
return $this->position;
}

#[\ReturnTypeWillChange]
public function current()
{
return $this->array[$this->position];
}

#[\ReturnTypeWillChange]
public function next()
{
$this->position++;
Expand Down
5 changes: 5 additions & 0 deletions Tests/_files/TestIterator2.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,31 @@ public function __construct(array $array)
$this->data = $array;
}

#[\ReturnTypeWillChange]
public function current()
{
return current($this->data);
}

#[\ReturnTypeWillChange]
public function next()
{
next($this->data);
}

#[\ReturnTypeWillChange]
public function key()
{
return key($this->data);
}

#[\ReturnTypeWillChange]
public function valid()
{
return key($this->data) !== null;
}

#[\ReturnTypeWillChange]
public function rewind()
{
reset($this->data);
Expand Down
Loading

0 comments on commit 253f4b3

Please sign in to comment.