Skip to content

Commit

Permalink
Support PHPUnit 8
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints committed Feb 7, 2019
1 parent d6ba88c commit 788e79c
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 45 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
composer.lock
phpunit.xml
!/stubs/phpunit.xml
.phpunit.result.cache
21 changes: 16 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"require-dev": {
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~7.0"
"phpunit/phpunit": "^7.0|^8.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ abstract class TestCase extends FoundationTestCase
*
* @return void
*/
protected function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/BrowserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class BrowserTest extends TestCase
{
public function tearDown()
public function tearDown(): void
{
m::close();
}
Expand Down
9 changes: 4 additions & 5 deletions tests/ChromeProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,31 @@ 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()
{
$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()
{
$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()
{
$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()
Expand All @@ -59,7 +59,6 @@ protected function onWindows()
}
}


class ChromeProcessDarwin extends ChromeProcess
{
protected function onMac()
Expand Down
2 changes: 1 addition & 1 deletion tests/ComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class ComponentTest extends TestCase
{
public function tearDown()
public function tearDown(): void
{
m::close();
}
Expand Down
16 changes: 8 additions & 8 deletions tests/MakesAssertionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand Down
38 changes: 19 additions & 19 deletions tests/MakesUrlAssertionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
Expand Down Expand Up @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand Down Expand Up @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand All @@ -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()
);
Expand Down
2 changes: 1 addition & 1 deletion tests/SupportsChromeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
5 changes: 2 additions & 3 deletions tests/WaitsForElementsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit 788e79c

Please sign in to comment.