diff --git a/.gitignore b/.gitignore index 9ac3ebd71..72b0bf9e8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ composer.lock phpunit.xml !/stubs/phpunit.xml +.phpunit.result.cache diff --git a/.travis.yml b/.travis.yml index b004e4500..99067b9cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,27 @@ language: php -php: - - 7.1 - - 7.2 - - 7.3 +matrix: + fast_finish: true + include: + - php: 7.1 + env: PHPUNIT=^7.0 + - php: 7.2 + env: PHPUNIT=^7.0 + - php: 7.2 + env: PHPUNIT=^8.0 + - php: 7.3 + env: PHPUNIT=^7.0 + - php: 7.3 + env: PHPUNIT=^8.0 sudo: false before_install: - phpenv config-rm xdebug.ini || true -install: travis_retry composer install --no-interaction --prefer-source +install: + - travis_retry composer install --no-interaction --prefer-dist --no-suggest + - travis_retry composer require phpunit/phpunit:$PHPUNIT --update-with-dependencies before_script: sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6' diff --git a/composer.json b/composer.json index 3a776b99b..02086cad6 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ }, "require-dev": { "mockery/mockery": "~1.0", - "phpunit/phpunit": "~7.0" + "phpunit/phpunit": "^7.0|^8.0" }, "autoload": { "psr-4": { diff --git a/src/TestCase.php b/src/TestCase.php index 9eb4164a1..383030e6a 100644 --- a/src/TestCase.php +++ b/src/TestCase.php @@ -18,7 +18,7 @@ abstract class TestCase extends FoundationTestCase * * @return void */ - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/BrowserTest.php b/tests/BrowserTest.php index 206fe938b..d169ba6bb 100644 --- a/tests/BrowserTest.php +++ b/tests/BrowserTest.php @@ -11,7 +11,7 @@ class BrowserTest extends TestCase { - public function tearDown() + public function tearDown(): void { m::close(); } diff --git a/tests/ChromeProcessTest.php b/tests/ChromeProcessTest.php index 192899b1b..ed0b2951d 100644 --- a/tests/ChromeProcessTest.php +++ b/tests/ChromeProcessTest.php @@ -16,7 +16,7 @@ public function test_build_process_with_custom_driver() $process = (new ChromeProcess($driver))->toProcess(); $this->assertInstanceOf(Process::class, $process); - $this->assertContains("$driver", $process->getCommandLine()); + $this->assertStringContainsString("$driver", $process->getCommandLine()); } public function test_build_process_for_windows() @@ -24,7 +24,7 @@ public function test_build_process_for_windows() $process = (new ChromeProcessWindows)->toProcess(); $this->assertInstanceOf(Process::class, $process); - $this->assertContains('chromedriver-win.exe', $process->getCommandLine()); + $this->assertStringContainsString('chromedriver-win.exe', $process->getCommandLine()); } public function test_build_process_for_darwin() @@ -32,7 +32,7 @@ public function test_build_process_for_darwin() $process = (new ChromeProcessDarwin)->toProcess(); $this->assertInstanceOf(Process::class, $process); - $this->assertContains('chromedriver-mac', $process->getCommandLine()); + $this->assertStringContainsString('chromedriver-mac', $process->getCommandLine()); } public function test_build_process_for_linux() @@ -40,7 +40,7 @@ public function test_build_process_for_linux() $process = (new ChromeProcessLinux)->toProcess(); $this->assertInstanceOf(Process::class, $process); - $this->assertContains('chromedriver-linux', $process->getCommandLine()); + $this->assertStringContainsString('chromedriver-linux', $process->getCommandLine()); } public function test_invalid_path() @@ -59,7 +59,6 @@ protected function onWindows() } } - class ChromeProcessDarwin extends ChromeProcess { protected function onMac() diff --git a/tests/ComponentTest.php b/tests/ComponentTest.php index 2319fa591..4e062bd01 100644 --- a/tests/ComponentTest.php +++ b/tests/ComponentTest.php @@ -11,7 +11,7 @@ class ComponentTest extends TestCase { - public function tearDown() + public function tearDown(): void { m::close(); } diff --git a/tests/MakesAssertionsTest.php b/tests/MakesAssertionsTest.php index 47f3326c6..5bac2a05f 100644 --- a/tests/MakesAssertionsTest.php +++ b/tests/MakesAssertionsTest.php @@ -25,7 +25,7 @@ public function test_assert_title() $browser->assertTitle('Foo'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Expected title [Foo] does not equal actual title [foo].', $e->getMessage() ); @@ -46,7 +46,7 @@ public function test_assert_title_contains() $browser->assertTitleContains('Fo'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Did not see expected value [Fo] within title [foo].', $e->getMessage() ); @@ -71,7 +71,7 @@ public function test_assert_present() $browser->assertPresent('foo'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( "Element [body foo] is not present.", $e->getMessage() ); @@ -94,7 +94,7 @@ public function test_assert_enabled() $browser->assertEnabled('foo'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( "Expected element [foo] to be enabled, but it wasn't.", $e->getMessage() ); @@ -117,7 +117,7 @@ public function test_assert_disabled() $browser->assertDisabled('foo'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( "Expected element [foo] to be disabled, but it wasn't.", $e->getMessage() ); @@ -141,7 +141,7 @@ public function test_assert_focused() $browser->assertFocused('foo'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( "Expected element [foo] to be focused, but it wasn't.", $e->getMessage() ); @@ -165,7 +165,7 @@ public function test_assert_not_focused() $browser->assertNotFocused('foo'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Expected element [foo] not to be focused, but it was.', $e->getMessage() ); @@ -192,7 +192,7 @@ public function test_assert_selected() $browser->assertNotSelected('select[name="users"]', 2); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Unexpected value [2] selected for [select[name="users"]].', $e->getMessage() ); diff --git a/tests/MakesUrlAssertionsTest.php b/tests/MakesUrlAssertionsTest.php index 2b2581150..aacd88d7c 100644 --- a/tests/MakesUrlAssertionsTest.php +++ b/tests/MakesUrlAssertionsTest.php @@ -27,7 +27,7 @@ public function test_assert_url_is() $browser->assertUrlIs('http://www.google.com'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Actual URL [http://www.google.com:80/test?foo=bar] does not equal expected URL [http://www.google.com].', $e->getMessage() ); @@ -55,7 +55,7 @@ public function test_assert_scheme_is() $browser->assertSchemeIs('https'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Actual scheme [http] does not equal expected scheme [https].', $e->getMessage() ); @@ -79,7 +79,7 @@ public function test_assert_scheme_is_not() $browser->assertSchemeIsNot('https'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Scheme [https] should not equal the actual value.', $e->getMessage() ); @@ -105,7 +105,7 @@ public function test_assert_host_is() $browser->assertHostIs('testing.com'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Actual host [www.laravel.com] does not equal expected host [testing\.com].', $e->getMessage() ); @@ -131,7 +131,7 @@ public function test_assert_host_is_not() $browser->assertHostIsNot('laravel.com'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Host [laravel.com] should not equal the actual value.', $e->getMessage() ); @@ -157,7 +157,7 @@ public function test_assert_port_is() $browser->assertPortIs('21'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Actual port [22] does not equal expected port [21].', $e->getMessage() ); @@ -183,7 +183,7 @@ public function test_assert_port_is_not() $browser->assertPortIsNot('22'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Port [22] should not equal the actual value.', $e->getMessage() ); @@ -211,7 +211,7 @@ public function test_assert_path_is() $browser->assertPathIs('foo/*/'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Actual path [foo/1/bar/1] does not equal expected path [foo/*/].', $e->getMessage() ); @@ -232,7 +232,7 @@ public function test_assert_path_begins_with() $browser->assertPathBeginsWith('test'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Actual path [/test] does not begin with expected path [test].', $e->getMessage() ); @@ -253,7 +253,7 @@ public function test_assert_path_is_not() $browser->assertPathIsNot('/test'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Path [/test] should not equal the actual value.', $e->getMessage() ); @@ -274,7 +274,7 @@ public function test_assert_fragment_is() $browser->assertFragmentIs('ba'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Actual fragment [baz] does not equal expected fragment [ba].', $e->getMessage() ); @@ -295,7 +295,7 @@ public function test_assert_fragment_begins_with() $browser->assertFragmentBeginsWith('Ba'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Actual fragment [baz] does not begin with expected fragment [Ba].', $e->getMessage() ); @@ -316,7 +316,7 @@ public function test_assert_fragment_is_not() $browser->assertFragmentIsNot('baz'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Fragment [baz] should not equal the actual value.', $e->getMessage() ); @@ -339,7 +339,7 @@ public function test_assert_route_is() $browser->assertRouteIs('test'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Actual path [/test/1] does not equal expected path [/test/].', $e->getMessage() ); @@ -360,7 +360,7 @@ public function test_assert_query_string_has_name() $browser->assertQueryStringHas('foo'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Did not see expected query string in [http://www.google.com].', $e->getMessage() ); @@ -372,7 +372,7 @@ public function test_assert_query_string_has_name() $browser->assertQueryStringHas('bar'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Did not see expected query string parameter [bar] in [http://www.google.com/?foo].', $e->getMessage() ); @@ -393,7 +393,7 @@ public function test_assert_query_string_has_name_value() $browser->assertQueryStringHas('foo', ''); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Query string parameter [foo] had value [bar], but expected [].', $e->getMessage() ); @@ -414,7 +414,7 @@ public function test_assert_query_string_has_name_array_value() $browser->assertQueryStringHas('foo', ''); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Query string parameter [foo] had value [bar,buzz], but expected [].', $e->getMessage() ); @@ -437,7 +437,7 @@ public function test_assert_query_string_missing() $browser->assertQueryStringMissing('foo'); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertContains( + $this->assertStringContainsString( 'Found unexpected query string parameter [foo] in [http://www.google.com/?foo=bar].', $e->getMessage() ); diff --git a/tests/SupportsChromeTest.php b/tests/SupportsChromeTest.php index 9cef954c8..b6d4a0650 100644 --- a/tests/SupportsChromeTest.php +++ b/tests/SupportsChromeTest.php @@ -20,7 +20,7 @@ public function test_it_can_run_chrome_process() $process->stop(); - $this->assertContains("Starting ChromeDriver", $process->getOutput()); + $this->assertStringContainsString("Starting ChromeDriver", $process->getOutput()); $this->assertSame("", $process->getErrorOutput()); } } diff --git a/tests/WaitsForElementsTest.php b/tests/WaitsForElementsTest.php index b5ee95360..9b3e9c3c1 100644 --- a/tests/WaitsForElementsTest.php +++ b/tests/WaitsForElementsTest.php @@ -55,11 +55,10 @@ public function test_wait_using() }); } - /** - * @expectedException \Facebook\WebDriver\Exception\TimeOutException - */ public function test_wait_using_failure() { + $this->expectException(TimeOutException::class); + $browser = new Browser(new stdClass); $browser->waitUsing(1, 100, function () {