diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 816830b..6fc01e9 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -10,7 +10,7 @@ jobs:
tests:
strategy:
matrix:
- php-versions: ['7.3', '7.4']
+ php-versions: ['7.3', '7.4', '8.0', '8.1']
runs-on: ubuntu-latest
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3eb76cc
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+/.phpunit.cache
+/composer.lock
+/vendor
diff --git a/composer.json b/composer.json
index 55f2c2b..ef0f3a1 100644
--- a/composer.json
+++ b/composer.json
@@ -14,7 +14,7 @@
"php": ">=5.3.0"
},
"require-dev": {
- "phpunit/phpunit": "~4"
+ "phpunit/phpunit": "^9.5.21"
},
"autoload": {
"psr-0": {
diff --git a/phpunit.xml b/phpunit.xml
new file mode 100644
index 0000000..fd5e558
--- /dev/null
+++ b/phpunit.xml
@@ -0,0 +1,26 @@
+
+
+
+
+ tests
+
+
+
+
+
+ src
+
+
+
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
deleted file mode 100644
index c4c78cc..0000000
--- a/phpunit.xml.dist
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
- ./tests
-
-
-
-
- ./src
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/vierbergenlars/LibJs/JSArray.php b/src/vierbergenlars/LibJs/JSArray.php
index dfd0668..43d48c7 100644
--- a/src/vierbergenlars/LibJs/JSArray.php
+++ b/src/vierbergenlars/LibJs/JSArray.php
@@ -194,7 +194,7 @@ public function rewind()
public function valid()
{
- return each($this->array)!== false;
+ return key($this->array) !== null;
}
public function valueOf()
diff --git a/tests/JSArrayTest.php b/tests/JSArrayTest.php
new file mode 100644
index 0000000..598a00a
--- /dev/null
+++ b/tests/JSArrayTest.php
@@ -0,0 +1,25 @@
+assertEquals(array(new JString('1.0.0'), new JString('2.0.0')), $versions);
+ }
+}
diff --git a/tests/RegressionTest.php b/tests/RegressionTest.php
index 1daa441..b561d3c 100644
--- a/tests/RegressionTest.php
+++ b/tests/RegressionTest.php
@@ -2,9 +2,10 @@
namespace vierbergenlars\SemVer\Tests;
+use PHPUnit\Framework\TestCase;
use vierbergenlars\SemVer;
-class RegressionTest extends \PHPUnit_Framework_TestCase
+class RegressionTest extends TestCase
{
public function testBug23()
{
diff --git a/tests/SemVerTest.php b/tests/SemVerTest.php
index f507112..dc27e7f 100644
--- a/tests/SemVerTest.php
+++ b/tests/SemVerTest.php
@@ -2,9 +2,10 @@
namespace vierbergenlars\SemVer\Tests\Internal;
+use PHPUnit\Framework\TestCase;
use vierbergenlars\SemVer\Internal as SemVer;
-class SemVerTest extends \PHPUnit_Framework_TestCase
+class SemVerTest extends TestCase
{
public function testComparison()
{
diff --git a/tests/VersionTest.php b/tests/VersionTest.php
index ad44ea9..2b8ab80 100644
--- a/tests/VersionTest.php
+++ b/tests/VersionTest.php
@@ -2,9 +2,10 @@
namespace vierbergenlars\SemVer\Tests;
+use PHPUnit\Framework\TestCase;
use vierbergenlars\SemVer;
-class VersionTest extends \PHPUnit_Framework_TestCase
+class VersionTest extends TestCase
{
public function testKeepSimpleversion()
{
@@ -238,19 +239,19 @@ public function testNotSatisfiedBy()
/**
* @dataProvider invalidSemanticVersionProvider
- * @expectedException \vierbergenlars\SemVer\SemVerException
*/
public function testInvalidExpressionString($version)
{
+ $this->expectException(SemVer\SemVerException::class);
new SemVer\expression($version);
}
/**
* @dataProvider invalidSemanticVersionProvider
- * @expectedException \vierbergenlars\SemVer\SemVerException
*/
public function testInvalidVersionString($version)
{
+ $this->expectException(SemVer\SemVerException::class);
new SemVer\version($version);
}