Skip to content

Commit

Permalink
[1.8] Dropped PHP 7.3 support (#482)
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell authored Feb 27, 2023
1 parent 72fbb7a commit 8fd9e48
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 106 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ jobs:

strategy:
matrix:
php: ['7.3', '7.4', '8.0', '8.1', '8.2']
php: ['7.4', '8.0', '8.1', '8.2']
symfony: ['4', '5', '6']
exclude:
- php: '7.3'
symfony: '6'
- php: '7.4'
symfony: '6'

Expand All @@ -29,6 +27,8 @@ jobs:
php-version: ${{ matrix.php }}
tools: composer:v2
coverage: none
env:
update: true

- name: Setup Problem Matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# CHANGELOG


## 1.8.0 (UPCOMING)

* Add helper function to find target
* Add `--crash-dumps-dir` option
* Allow passing the event name to wait for in `setHtml`
* Dropped PHP 7.3 support


## 1.7.2 (2023-02-27)

* Fix case where the timeout in `setHtml()` isn't respected
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Happy browsing!

## Requirements

Requires PHP 7.3-8.2 and a chrome/chromium 65+ executable.
Requires PHP 7.4-8.2 and a chrome/chromium 65+ executable.

Note that the library is only tested on Linux but is compatible with macOS and Windows.

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
}
],
"require": {
"php": "^7.3 || ^8.0",
"chrome-php/wrench": "^1.3",
"php": "^7.4.15 || ^8.0.2",
"chrome-php/wrench": "^1.4",
"evenement/evenement": "^3.0.1",
"monolog/monolog": "^1.27.1 || ^2.8 || ^3.2",
"psr/log": "^1.1 || ^2.0 || ^3.0",
Expand All @@ -26,8 +26,8 @@
"symfony/process": "^4.4 || ^5.0 || ^6.0"
},
"require-dev":{
"bamarni/composer-bin-plugin": "^1.8.1",
"phpunit/phpunit": "^9.5.23",
"bamarni/composer-bin-plugin": "^1.8.2",
"phpunit/phpunit": "^9.6.3 || ^10.0.12",
"symfony/var-dumper": "^4.4 || ^5.0 || ^6.0"
},
"autoload":{
Expand Down
34 changes: 11 additions & 23 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
forceCoversAnnotation="true"
colors="true"
convertDeprecationsToExceptions="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
>
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" requireCoverageMetadata="true">
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
</phpunit>
2 changes: 1 addition & 1 deletion tests/AutoDiscoverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
class AutoDiscoverTest extends BaseTestCase
{
private $originalEnvPath = null;
private ?string $originalEnvPath = null;

protected function setUp(): void
{
Expand Down
5 changes: 1 addition & 4 deletions tests/BrowsingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
*/
class BrowsingTest extends BaseTestCase
{
/**
* @var Browser\ProcessAwareBrowser
*/
public static $browser;
public static Browser\ProcessAwareBrowser $browser;

public static function setUpBeforeClass(): void
{
Expand Down
5 changes: 1 addition & 4 deletions tests/Communication/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@
*/
class ConnectionTest extends TestCase
{
/**
* @var MockSocket
*/
protected $mocSocket;
private MockSocket $mocSocket;

public function setUp(): void
{
Expand Down
5 changes: 1 addition & 4 deletions tests/Communication/SessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
*/
class SessionTest extends TestCase
{
/**
* @var MockSocket
*/
protected $mockSocket;
private MockSocket $mockSocket;

public function setUp(): void
{
Expand Down
5 changes: 1 addition & 4 deletions tests/CookieTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
*/
class CookieTest extends HttpEnabledTestCase
{
/**
* @var Browser\ProcessAwareBrowser
*/
public static $browser;
public static Browser\ProcessAwareBrowser $browser;

public function setUp(): void
{
Expand Down
5 changes: 1 addition & 4 deletions tests/DomTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
*/
class DomTest extends BaseTestCase
{
/**
* @var Browser\ProcessAwareBrowser
*/
public static $browser;
public static Browser\ProcessAwareBrowser $browser;

public static function setUpBeforeClass(): void
{
Expand Down
3 changes: 1 addition & 2 deletions tests/HttpEnabledTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

class HttpEnabledTestCase extends BaseTestCase
{
/** @var Process */
private static $process;
private static Process $process;

public static function setUpBeforeClass(): void
{
Expand Down
5 changes: 1 addition & 4 deletions tests/KeyboardApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
*/
class KeyboardApiTest extends BaseTestCase
{
/**
* @var Browser\ProcessAwareBrowser
*/
public static $browser;
public static Browser\ProcessAwareBrowser $browser;

public static function setUpBeforeClass(): void
{
Expand Down
8 changes: 4 additions & 4 deletions tests/KeyboardKeysTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
*/
class KeyboardKeysTest extends BaseTestCase
{
private $keyboard;
private KeyboardForTests $keyboard;

protected function setUp(): void
{
$this->keyboard = new KeyboardForTests();
}

public function keyProvider(): array
public static function keyProvider(): array
{
return [
// Key, expectedKey
Expand All @@ -34,7 +34,7 @@ public function keyProvider(): array
];
}

public function modifierKeyProvider(): array
public static function modifierKeyProvider(): array
{
return [
// Key, expectedModifier
Expand All @@ -54,7 +54,7 @@ public function modifierKeyProvider(): array
];
}

public function keyCodesProvider(): array
public static function keyCodesProvider(): array
{
return [
['a', 65],
Expand Down
33 changes: 15 additions & 18 deletions tests/MouseApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
*/
class MouseApiTest extends BaseTestCase
{
/**
* @var Browser\ProcessAwareBrowser
*/
public static $browser;
public static Browser\ProcessAwareBrowser $browser;

public static function setUpBeforeClass(): void
{
Expand Down Expand Up @@ -105,7 +102,7 @@ public function testScroll(): void
}

/**
* @dataProvider providerFindElement_withSingleElement
* @dataProvider providerFindElementWithSingleElement
*
* @throws \HeadlessChromium\Exception\CommunicationException
* @throws \HeadlessChromium\Exception\NoResponseAvailable
Expand All @@ -126,19 +123,19 @@ public function testFindElement_withSingleElement(Selector $selector): void
/**
* @return Generator<string, array{Selector}>
*/
public function providerFindElement_withSingleElement(): Generator
public static function providerFindElementWithSingleElement(): Generator
{
yield 'css' => [new CssSelector('#a')];
yield 'xpath' => [new XPathSelector('//*[@id="a"]')];
}

/**
* @dataProvider providerFindElement_afterMove
* @dataProvider providerFindElementAfterMove
*
* @throws \HeadlessChromium\Exception\CommunicationException
* @throws \HeadlessChromium\Exception\NoResponseAvailable
*/
public function testFindElement_afterMove(Selector $selector): void
public function testFindElementAfterMove(Selector $selector): void
{
// initial navigation
$page = $this->openSitePage('b.html');
Expand All @@ -156,19 +153,19 @@ public function testFindElement_afterMove(Selector $selector): void
/**
* @return Generator<string, array{Selector}>
*/
public function providerFindElement_afterMove(): Generator
public static function providerFindElementAfterMove(): Generator
{
yield 'css' => [new CssSelector('#a')];
yield 'xpath' => [new XPathSelector('//*[@id="a"]')];
}

/**
* @dataProvider providerFindElement_withMultipleElements
* @dataProvider providerFindElementWithMultipleElements
*
* @throws \HeadlessChromium\Exception\CommunicationException
* @throws \HeadlessChromium\Exception\NoResponseAvailable
*/
public function testFindElement_withMultipleElements(Selector $selector, int $position, string $expectedPageTitle): void
public function testFindElementWithMultipleElements(Selector $selector, int $position, string $expectedPageTitle): void
{
$page = $this->openSitePage('b.html');

Expand All @@ -183,7 +180,7 @@ public function testFindElement_withMultipleElements(Selector $selector, int $po
/**
* @return Generator<array-key, array{Selector, int, string}>
*/
public function providerFindElement_withMultipleElements(): Generator
public static function providerFindElementWithMultipleElements(): Generator
{
$cssSelector = new CssSelector('.a');
$xPathSelector = new XPathSelector('//*[@class="a"]');
Expand All @@ -196,12 +193,12 @@ public function providerFindElement_withMultipleElements(): Generator
}

/**
* @dataProvider providerFindElement_withScrolling
* @dataProvider providerFindElementWithScrolling
*
* @throws \HeadlessChromium\Exception\CommunicationException
* @throws \HeadlessChromium\Exception\NoResponseAvailable
*/
public function testFindElement_withScrolling(Selector $selector): void
public function testFindElementWithScrolling(Selector $selector): void
{
// initial navigation
$page = $this->openSitePage('bigLayout.html');
Expand All @@ -219,20 +216,20 @@ public function testFindElement_withScrolling(Selector $selector): void
/**
* @return Generator<string, array{Selector}>
*/
public function providerFindElement_withScrolling(): Generator
public static function providerFindElementWithScrolling(): Generator
{
yield 'css' => [new CssSelector('#bottomLink')];
yield 'xpath' => [new XPathSelector('//*[@id="bottomLink"]')];
}

/**
* @dataProvider providerFindElement_withMissingElement
* @dataProvider providerFindElementWithMissingElement
*
* @throws \HeadlessChromium\Exception\CommunicationException
* @throws \HeadlessChromium\Exception\NoResponseAvailable
* @throws \HeadlessChromium\Exception\ElementNotFoundException
*/
public function testFindElement_withMissingElement(Selector $selector): void
public function testFindElementWithMissingElement(Selector $selector): void
{
$this->expectException(\HeadlessChromium\Exception\ElementNotFoundException::class);

Expand All @@ -245,7 +242,7 @@ public function testFindElement_withMissingElement(Selector $selector): void
/**
* @return Generator<string, array{Selector}>
*/
public function providerFindElement_withMissingElement(): Generator
public static function providerFindElementWithMissingElement(): Generator
{
yield 'css' => [new CssSelector('#missing')];
yield 'xpath' => [new XPathSelector('//*[@id="missing"]')];
Expand Down
Loading

0 comments on commit 8fd9e48

Please sign in to comment.