diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 674ca81b3..1fb09b891 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - php: ['7.2', '7.3', '7.4', '8.0', '8.1'] + php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] composer_flags: [ '' ] minimum_stability: [ '' ] symfony_deprecations_helper: [ '' ] @@ -32,7 +32,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 1 @@ -55,9 +55,9 @@ jobs: - name: Run tests run: | export SYMFONY_DEPRECATIONS_HELPER="${{ matrix.symfony_deprecations_helper }}" - vendor/bin/phpunit -v --coverage-clover=coverage.xml + vendor/bin/phpunit --coverage-clover=coverage.xml - name: Upload coverage - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: files: coverage.xml diff --git a/.gitignore b/.gitignore index 961fea1d6..9750b4f88 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ *.phar phpunit.xml .phpunit.result.cache +.phpunit.cache composer.lock vendor diff --git a/composer.json b/composer.json index 5a2bb123d..74383e051 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "require-dev": { "symfony/error-handler": "^4.4 || ^5.0 || ^6.0", - "phpunit/phpunit": "^8.5.22 || ^9.5.11", + "phpunit/phpunit": "^8.5.33 || ^9.6 || ^10.1", "symfony/phpunit-bridge": "^5.4 || ^6.0" }, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 9f6f546c5..522ea9fe7 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,19 +1,28 @@ + + - - - - tests - - + + + tests + + - - - ./src - - + + + ./src + + + + - - - diff --git a/tests/Driver/CoreDriverTest.php b/tests/Driver/CoreDriverTest.php index f4a597886..b2f145179 100644 --- a/tests/Driver/CoreDriverTest.php +++ b/tests/Driver/CoreDriverTest.php @@ -22,9 +22,15 @@ public function testNoExtraMethods() public function testCreateNodeElements() { + if(\PHPUnit\Runner\Version::id() >= 10) { + $driver = $this->getMockBuilder('Behat\Mink\Driver\CoreDriver') + ->onlyMethods(array('findElementXpaths')) + ->getMockForAbstractClass(); + } else { $driver = $this->getMockBuilder('Behat\Mink\Driver\CoreDriver') ->setMethods(array('findElementXpaths')) ->getMockForAbstractClass(); + } $session = $this->getMockBuilder('Behat\Mink\Session') ->disableOriginalConstructor() @@ -72,7 +78,7 @@ public function testInterfaceMethods(\ReflectionMethod $method) call_user_func_array(array($driver, $method->getName()), $this->getArguments($method)); } - public function getDriverInterfaceMethods() + public static function getDriverInterfaceMethods() { $ref = new \ReflectionClass('Behat\Mink\Driver\DriverInterface'); diff --git a/tests/Element/ElementTest.php b/tests/Element/AbstractElement.php similarity index 97% rename from tests/Element/ElementTest.php rename to tests/Element/AbstractElement.php index 885c1a963..3ddbdc11d 100644 --- a/tests/Element/ElementTest.php +++ b/tests/Element/AbstractElement.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; -abstract class ElementTest extends TestCase +abstract class AbstractElement extends TestCase { /** * Session. diff --git a/tests/Element/DocumentElementTest.php b/tests/Element/DocumentElementTest.php index 8250cc3b4..0f33e1de3 100644 --- a/tests/Element/DocumentElementTest.php +++ b/tests/Element/DocumentElementTest.php @@ -4,7 +4,7 @@ use Behat\Mink\Element\DocumentElement; -class DocumentElementTest extends ElementTest +class DocumentElementTest extends AbstractElement { /** * Page. diff --git a/tests/Element/NodeElementTest.php b/tests/Element/NodeElementTest.php index 0766d7a3d..a20201ab5 100644 --- a/tests/Element/NodeElementTest.php +++ b/tests/Element/NodeElementTest.php @@ -4,7 +4,7 @@ use Behat\Mink\Element\NodeElement; -class NodeElementTest extends ElementTest +class NodeElementTest extends AbstractElement { public function testGetXpath() { diff --git a/tests/Exception/ElementNotFoundExceptionTest.php b/tests/Exception/ElementNotFoundExceptionTest.php index 4ac30b0a3..b6b9aaad3 100644 --- a/tests/Exception/ElementNotFoundExceptionTest.php +++ b/tests/Exception/ElementNotFoundExceptionTest.php @@ -19,7 +19,7 @@ public function testBuildMessage($message, $type, $selector = null, $locator = n $this->assertEquals($message, $exception->getMessage()); } - public function provideExceptionMessage() + public static function provideExceptionMessage() { return array( array('Tag not found.', null), diff --git a/tests/Selector/NamedSelectorTest.php b/tests/Selector/AbstractNamedSelector.php similarity index 98% rename from tests/Selector/NamedSelectorTest.php rename to tests/Selector/AbstractNamedSelector.php index 9dcbf71bd..9755ad721 100644 --- a/tests/Selector/NamedSelectorTest.php +++ b/tests/Selector/AbstractNamedSelector.php @@ -6,7 +6,7 @@ use Behat\Mink\Selector\Xpath\Escaper; use PHPUnit\Framework\TestCase; -abstract class NamedSelectorTest extends TestCase +abstract class AbstractNamedSelector extends TestCase { public function testRegisterXpath() { @@ -96,7 +96,7 @@ public function testEscapedSelectors($fixtureFile, $selector, $locator, $expecte $this->testSelectors($fixtureFile, $selector, $locator, $expectedExactCount, $expectedPartialCount); } - public function getSelectorTests() + public static function getSelectorTests() { $fieldCount = 8; // fields without `type` attribute $fieldCount += 4; // fields with `type=checkbox` attribute @@ -187,7 +187,7 @@ public function getSelectorTests() ); } - public function getLateRegisteredReplacements() + public static function getLateRegisteredReplacements() { // The following tests all use `test.html` from the fixtures directory. return array( diff --git a/tests/Selector/ExactNamedSelectorTest.php b/tests/Selector/ExactNamedSelectorTest.php index df51f0fd7..8bdf041c5 100644 --- a/tests/Selector/ExactNamedSelectorTest.php +++ b/tests/Selector/ExactNamedSelectorTest.php @@ -4,7 +4,7 @@ use Behat\Mink\Selector\ExactNamedSelector; -class ExactNamedSelectorTest extends NamedSelectorTest +class ExactNamedSelectorTest extends AbstractNamedSelector { protected function getSelector() { diff --git a/tests/Selector/PartialNamedSelectorTest.php b/tests/Selector/PartialNamedSelectorTest.php index c3e631a11..72f716196 100644 --- a/tests/Selector/PartialNamedSelectorTest.php +++ b/tests/Selector/PartialNamedSelectorTest.php @@ -4,7 +4,7 @@ use Behat\Mink\Selector\PartialNamedSelector; -class PartialNamedSelectorTest extends NamedSelectorTest +class PartialNamedSelectorTest extends AbstractNamedSelector { protected function getSelector() { diff --git a/tests/Selector/Xpath/EscaperTest.php b/tests/Selector/Xpath/EscaperTest.php index ea7944b76..83a0436e8 100644 --- a/tests/Selector/Xpath/EscaperTest.php +++ b/tests/Selector/Xpath/EscaperTest.php @@ -17,7 +17,7 @@ public function testXpathLiteral($string, $expected) $this->assertEquals($expected, $escaper->escapeLiteral($string)); } - public function getXpathLiterals() + public static function getXpathLiterals() { return array( array('some simple string', "'some simple string'"), diff --git a/tests/Selector/Xpath/ManipulatorTest.php b/tests/Selector/Xpath/ManipulatorTest.php index 51bed9f91..91cd7f4f6 100644 --- a/tests/Selector/Xpath/ManipulatorTest.php +++ b/tests/Selector/Xpath/ManipulatorTest.php @@ -17,7 +17,7 @@ public function testPrepend($prefix, $xpath, $expectedXpath) $this->assertEquals($expectedXpath, $manipulator->prepend($xpath, $prefix)); } - public function getPrependedXpath() + public static function getPrependedXpath() { return array( 'simple' => array( diff --git a/tests/SessionTest.php b/tests/SessionTest.php index cab731f51..9cead2ee6 100644 --- a/tests/SessionTest.php +++ b/tests/SessionTest.php @@ -176,7 +176,7 @@ public function testGetResponseHeader($expected, $name, array $headers) $this->assertSame($expected, $this->session->getResponseHeader($name)); } - public function provideResponseHeader() + public static function provideResponseHeader() { return array( array('test', 'Mink', array('Mink' => 'test')), diff --git a/tests/WebAssertTest.php b/tests/WebAssertTest.php index 22c58b7bc..6f844d25a 100644 --- a/tests/WebAssertTest.php +++ b/tests/WebAssertTest.php @@ -818,7 +818,7 @@ public function testElementNotExistsArrayLocator($selector, $locator, $expectedM ); } - public function getArrayLocatorFormats() + public static function getArrayLocatorFormats() { return array( 'named' => array(