From 357158186842ce4c40d361a225382998976f534b Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Wed, 12 Feb 2025 21:58:16 +0000 Subject: [PATCH] feat: first commit --- .editorconfig | 18 ++++++++++++ .gitattributes | 14 ++++++++++ .github/FUNDING.yml | 5 ++++ .github/workflows/static.yml | 32 ++++++++++++++++++++++ .github/workflows/tests.yml | 37 +++++++++++++++++++++++++ .gitignore | 12 ++++++++ CONTRIBUTING.md | 47 ++++++++++++++++++++++++++++++++ LICENSE.md | 21 ++++++++++++++ README.md | 10 +++++++ composer.json | 53 ++++++++++++++++++++++++++++++++++++ phpstan.neon | 12 ++++++++ phpunit.xml | 34 +++++++++++++++++++++++ rector.php | 27 ++++++++++++++++++ src/Autoload.php | 18 ++++++++++++ src/Example.php | 23 ++++++++++++++++ src/Plugin.php | 16 +++++++++++ tests/Example.php | 5 ++++ 17 files changed, 384 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/static.yml create mode 100644 .github/workflows/tests.yml create mode 100644 .gitignore create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE.md create mode 100644 README.md create mode 100644 composer.json create mode 100644 phpstan.neon create mode 100644 phpunit.xml create mode 100644 rector.php create mode 100644 src/Autoload.php create mode 100644 src/Example.php create mode 100644 src/Plugin.php create mode 100644 tests/Example.php diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..79c3e0d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +; This file is for unifying the coding style for different editors and IDEs. +; More information at http://editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[*.yml] +indent_size = 2 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..234cbbf --- /dev/null +++ b/.gitattributes @@ -0,0 +1,14 @@ +/art export-ignore +/docs export-ignore +/tests export-ignore +/scripts export-ignore +/.github export-ignore +/.php-cs-fixer.dist.php export-ignore +.editorconfig export-ignore +.gitattributes export-ignore +.gitignore export-ignore +phpstan.neon export-ignore +phpunit.xml export-ignore +CHANGELOG.md export-ignore +CONTRIBUTING.md export-ignore +README.md export-ignore diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..d03cb24 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,5 @@ +# These are supported funding model platforms + +github: nunomaduro +patreon: nunomaduro +custom: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml new file mode 100644 index 0000000..74fb954 --- /dev/null +++ b/.github/workflows/static.yml @@ -0,0 +1,32 @@ +name: Static Analysis + +on: ['push', 'pull_request'] + +jobs: + static: + name: Static Tests + + runs-on: ubuntu-latest + strategy: + matrix: + dependency-version: [prefer-lowest, prefer-stable] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.2 + tools: composer:v2 + coverage: none + + - name: Install Dependencies + run: composer update --prefer-stable --no-interaction --no-progress --ansi + + - name: Types + run: composer test:types + + - name: Style + run: composer test:lint diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..b6e9ea0 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,37 @@ +name: Tests + +on: ['push', 'pull_request'] + +jobs: + ci: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] # (macos-latest, windows-latest) 3.x-dev is under development + php: ['8.2', '8.3'] + dependency-version: [prefer-lowest, prefer-stable] + parallel: ['', '--parallel'] + + name: PHP ${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency-version }} - ${{ matrix.parallel }} + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer:v2 + coverage: none + + - name: Setup Problem Matches + run: | + echo "::add-matcher::${{ runner.tool_cache }}/php.json" + echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Install PHP dependencies + run: composer update --${{ matrix.dependency-version }} --no-interaction --no-progress --ansi + + - name: Unit Tests + run: composer test:unit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..54420f5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +.idea/* +.idea/codeStyleSettings.xml +composer.lock +/vendor/ +coverage.xml +.phpunit.result.cache +/.php-cs-fixer.php +.php-cs-fixer.cache +.temp/coverage.php +*.swp +*.swo +.phpunit.cache diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..a23f4fa --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,47 @@ +# CONTRIBUTING + +Contributions are welcome, and are accepted via pull requests. +Please review these guidelines before submitting any pull requests. + +## Process + +1. Fork the project +1. Create a new branch +1. Code, test, commit and push +1. Open a pull request detailing your changes. Make sure to follow the [template](.github/PULL_REQUEST_TEMPLATE.md) + +## Guidelines + +* Please ensure the coding style running `composer lint`. +* Send a coherent commit history, making sure each individual commit in your pull request is meaningful. +* You may need to [rebase](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) to avoid merge conflicts. +* Please remember that we follow [SemVer](http://semver.org/). + +## Setup + +Clone your fork, then install the dev dependencies: +```bash +composer install +``` +## Lint + +Lint your code: +```bash +composer lint +``` +## Tests + +Run all tests: +```bash +composer test +``` + +Check types: +```bash +composer test:types +``` + +Unit tests: +```bash +composer test:unit +``` \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..c14ce0d --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Pest and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..bd7c9fb --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +This repository contains the Pest Plugin Browser. + +> If you want to start testing your application with Pest, visit the main **[Pest Repository](https://github.com/pestphp/pest)**. + +- Explore our docs at **[pestphp.com »](https://pestphp.com)** +- Follow us on Twitter at **[@pestphp »](https://twitter.com/pestphp)** +- Join us at **[discord.gg/kaHY6p54JH »](https://discord.gg/kaHY6p54JH)** or **[t.me/+kYH5G4d5MV83ODk0 »](https://t.me/+kYH5G4d5MV83ODk0)** + +Pest is an open-sourced software licensed under the **[MIT license](https://opensource.org/licenses/MIT)**. + diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..c6c3941 --- /dev/null +++ b/composer.json @@ -0,0 +1,53 @@ +{ + "name": "pestphp/pest-plugin-browser", + "description": "Pest plugin to test browser interactions", + "keywords": [ + "php", + "framework", + "pest", + "unit", + "test", + "testing", + "browser" + ], + "license": "MIT", + "require": { + "php": "^8.2", + "pestphp/pest": "^3.0.0", + "pestphp/pest-plugin": "^3.0.0" + }, + "autoload": { + "psr-4": { + "Pest\\PluginName\\": "src/" + }, + "files": [ + "src/Autoload.php" + ] + }, + "require-dev": { + "pestphp/pest-dev-tools": "^3.4.0" + }, + "minimum-stability": "dev", + "prefer-stable": true, + "config": { + "sort-packages": true, + "preferred-install": "dist", + "allow-plugins": { + "pestphp/pest-plugin": true + } + }, + "scripts": { + "refacto": "rector", + "lint": "pint", + "test:refacto": "rector --dry-run", + "test:lint": "pint --test", + "test:types": "phpstan analyse --ansi", + "test:unit": "pest --colors=always", + "test": [ + "@test:refacto", + "@test:lint", + "@test:types", + "@test:unit" + ] + } +} diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..fb0a4c0 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,12 @@ +includes: + - vendor/phpstan/phpstan-strict-rules/rules.neon + +parameters: + level: max + paths: + - src + + ignoreErrors: + - identifier: trait.unused + + reportUnmatchedIgnoredErrors: true diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..c9fd75e --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,34 @@ + + + + + ./tests + + + + + ./src + + + diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..8f4319c --- /dev/null +++ b/rector.php @@ -0,0 +1,27 @@ +paths([ + __DIR__.'/src', + ]); + + $rectorConfig->rules([ + InlineConstructorDefaultToPropertyRector::class, + ]); + + $rectorConfig->sets([ + LevelSetList::UP_TO_PHP_82, + SetList::CODE_QUALITY, + SetList::DEAD_CODE, + SetList::EARLY_RETURN, + SetList::TYPE_DECLARATION, + SetList::PRIVATIZATION, + ]); +}; diff --git a/src/Autoload.php b/src/Autoload.php new file mode 100644 index 0000000..ce516f1 --- /dev/null +++ b/src/Autoload.php @@ -0,0 +1,18 @@ +example(...func_get_args()); // @phpstan-ignore-line +} diff --git a/src/Example.php b/src/Example.php new file mode 100644 index 0000000..0e5e480 --- /dev/null +++ b/src/Example.php @@ -0,0 +1,23 @@ +toBeString(); + + return $this; + } +} diff --git a/src/Plugin.php b/src/Plugin.php new file mode 100644 index 0000000..78afb25 --- /dev/null +++ b/src/Plugin.php @@ -0,0 +1,16 @@ +