Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: prepare for phpunit 10 #842

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tests/Driver/CoreDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -74,7 +80,7 @@ public function testInterfaceMethods(\ReflectionMethod $method)
$coreDriverMethod->invokeArgs($driver, $this->getArguments($method));
}

public function getDriverInterfaceMethods()
public static function getDriverInterfaceMethods()
{
$ref = new \ReflectionClass('Behat\Mink\Driver\DriverInterface');

Expand Down
2 changes: 1 addition & 1 deletion tests/Element/DocumentElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Behat\Mink\Element\DocumentElement;
use Behat\Mink\Element\NodeElement;

class DocumentElementTest extends ElementTest
class DocumentElementTest extends ElementTestCase
{
/**
* Page.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

abstract class ElementTest extends TestCase
abstract class ElementTestCase extends TestCase
{
/**
* Session.
Expand Down
2 changes: 1 addition & 1 deletion tests/Element/NodeElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Behat\Mink\Element\NodeElement;
use Behat\Mink\Exception\DriverException;

class NodeElementTest extends ElementTest
class NodeElementTest extends ElementTestCase
{
public function testGetXpath()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Exception/ElementNotFoundExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testBuildMessage(string $message, ?string $type, ?string $select
$this->assertEquals($message, $exception->getMessage());
}

public function provideExceptionMessage()
public static function provideExceptionMessage()
{
return array(
array('Tag not found.', null),
Expand Down
2 changes: 1 addition & 1 deletion tests/Selector/ExactNamedSelectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Behat\Mink\Selector\ExactNamedSelector;

class ExactNamedSelectorTest extends NamedSelectorTest
class ExactNamedSelectorTest extends NamedSelectorTestCase
{
protected function getSelector()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Behat\Mink\Selector\Xpath\Escaper;
use PHPUnit\Framework\TestCase;

abstract class NamedSelectorTest extends TestCase
abstract class NamedSelectorTestCase extends TestCase
{
public function testRegisterXpath()
{
Expand Down Expand Up @@ -105,7 +105,7 @@ public function testEscapedSelectors(string $fixtureFile, string $selector, stri
$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
Expand Down Expand Up @@ -196,7 +196,7 @@ public function getSelectorTests()
);
}

public function getLateRegisteredReplacements()
public static function getLateRegisteredReplacements()
{
// The following tests all use `test.html` from the fixtures directory.
return array(
Expand Down
2 changes: 1 addition & 1 deletion tests/Selector/PartialNamedSelectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Behat\Mink\Selector\PartialNamedSelector;

class PartialNamedSelectorTest extends NamedSelectorTest
class PartialNamedSelectorTest extends NamedSelectorTestCase
{
protected function getSelector()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Selector/Xpath/EscaperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function testXpathLiteral(string $string, string $expected)
$this->assertEquals($expected, $escaper->escapeLiteral($string));
}

public function getXpathLiterals()
public static function getXpathLiterals()
{
return array(
array('some simple string', "'some simple string'"),
Expand Down
2 changes: 1 addition & 1 deletion tests/Selector/Xpath/ManipulatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function testPrepend(string $prefix, string $xpath, string $expectedXpath
$this->assertEquals($expectedXpath, $manipulator->prepend($xpath, $prefix));
}

public function getPrependedXpath()
public static function getPrependedXpath()
{
return array(
'simple' => array(
Expand Down
2 changes: 1 addition & 1 deletion tests/SessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function testGetResponseHeader(?string $expected, string $name, array $he
$this->assertSame($expected, $this->session->getResponseHeader($name));
}

public function provideResponseHeader()
public static function provideResponseHeader()
{
return array(
array('test', 'Mink', array('Mink' => 'test')),
Expand Down
2 changes: 1 addition & 1 deletion tests/WebAssertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ function () use ($selector, $locator) {
);
}

public function getArrayLocatorFormats()
public static function getArrayLocatorFormats()
{
return array(
'named' => array(
Expand Down