Skip to content

Commit

Permalink
Enhance (#79)
Browse files Browse the repository at this point in the history
* - added bamarni/composer-bin-plugin
- added php-cs-fixer, phpstan, phpunit
- remove psalm
- fixing phpstan and php-cs-fixer

* update CI

* update CI

* tests phpcs and phpstan

* fixing \OAndreyev\Mink\Driver\WebDriver::start

* fixing \OAndreyev\Mink\Driver\WebDriver

* updated ci

* updated ci

* updated ci

* Update to support PHP 8 and remove unused code comments

This commit updates the minimum supported PHP version in our CI workflow and composer.json file to PHP 8. Also, the PHP versions tested against is now expanded to  include 8.2 and 8.3. Furthermore, unnecessary ‘inheritdoc’ comments have been removed to improve code readability. The 'WebDriver' class has been enriched too with PHP 8 attribute modifications for method input types. Lastly, the README and copyright years have been updated. These changes are important to keep the project maintained with the latest PHP releases and standards.
  • Loading branch information
oleg-andreyev authored Jul 11, 2023
1 parent 058c254 commit bb64ac8
Show file tree
Hide file tree
Showing 22 changed files with 674 additions and 441 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vendor-bin/**/composer.lock binary
34 changes: 31 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,44 @@ defaults:
shell: bash

jobs:
static:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ 8.2 ]
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
extensions: zip, :xdebug
tools: composer
- id: composer-cache
run: echo "::set-output name=directory::$(composer config cache-dir)"
- uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.directory }}
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ matrix.php }}-composer-
- run: composer update --prefer-dist
- name: Style
run: |
./bin/php-cs-fixer fix -v --diff --dry-run --rules=@Symfony
- name: Static
run: |
./bin/phpstan analyze
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ 7.4, 8.0, 8.1 ]
php: [ 8.0, 8.1, 8.2 ]
browser: [ chrome, firefox ]
experimental: [false]
include:
- php: 8.2
- php: 8.3
experimental: true
browser: chrome
continue-on-error: ${{ matrix.experimental }}
Expand Down Expand Up @@ -104,7 +132,7 @@ jobs:
SYMFONY_DEPRECATIONS_HELPER: 'max[total]=999999'
BROWSER_NAME: ${{ matrix.browser }}
run: |
./vendor/bin/simple-phpunit -v
./bin/phpunit -v
- name: Archive logs artifacts
if: ${{ always() }}
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ geckodriver/
msedgedriver/
logs/
vendor-bin/**/vendor/
bin/
vendor/
composer.lock
!bin/browser
!bin/start_driver.sh
!bin/start_webserver.sh
.phpunit.result.cache
.php-cs-fixer.cache
15 changes: 15 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

$finder = (new PhpCsFixer\Finder())
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
;

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
])
->setFinder($finder);
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Initially it's started as [PR](https://github.com/minkphp/MinkSelenium2Driver/pu

Major updates include:
- Switch to using `facebook/webdriver`
- Update minimum php version to 7.4
- Update minimum php version to 8.0
- Tested against the latest Google Chrome and Mozilla Firefox both in GUI and Headless modes

## Setup
Expand All @@ -24,7 +24,7 @@ https://github.com/oleg-andreyev/MinkPhpWebdriverExtension
./bin/start_webdriver.sh &
# ./bin/start_driver.sh <browser> <version>
./bin/start_driver.sh chrome latest &
BROWSER_NAME=chrome ./vendor/bin/simple-phpunit
BROWSER_NAME=chrome ./bin/phpunit
```

This will download the latest driver for specified browser and will execute phpunit
Expand All @@ -34,4 +34,4 @@ Follow https://github.com/shivammathur/setup-php#local-testing-setup

## Copyright

Copyright (c) 2022 Oleg Andreyev <oleg@andreyev.lv>
Copyright (c) 2023 Oleg Andreyev <oleg@andreyev.lv>
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
}
],
"require": {
"php": ">=7.2",
"behat/mink": "^1.8",
"php-webdriver/webdriver": "^1.8"
"php": ">=8.0",
"behat/mink": "^1.10",
"php-webdriver/webdriver": "^1.14"
},
"require-dev": {
"ext-json": "*",
"roave/security-advisories": "dev-master",
"mink/driver-testsuite": "dev-integration-branch",
"behat/mink-extension": "^2.3",
"symfony/phpunit-bridge": "^4.4 || ^5.4 || ^6.0",
"bamarni/composer-bin-plugin": "^1.8"
"bamarni/composer-bin-plugin": "^1.8",
"jetbrains/phpstorm-attributes": "^1.0"
},
"scripts": {
"bin": "echo 'bin not installed'",
Expand All @@ -60,6 +60,7 @@
}
},
"config": {
"bin-dir": "./bin",
"allow-plugins": {
"bamarni/composer-bin-plugin": true
}
Expand Down
10 changes: 10 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
parameters:
level: 6
paths:
- src
- tests
ignoreErrors:
- '#Call to an undefined method PHPUnit\\Framework\\Test::getName\(\)#'
bootstrapFiles:
- vendor/autoload.php
- vendor-bin/phpunit/vendor/autoload.php
9 changes: 1 addition & 8 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,8 @@

<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.5/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
xsi:noNamespaceSchemaLocation="vendor-bin/phpunit/vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="vendor/autoload.php"
>
<testsuites>
Expand Down
Loading

0 comments on commit bb64ac8

Please sign in to comment.