diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 00000000..255d0fdb --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,127 @@ +name: PHP +on: + push: + pull_request: + +permissions: + contents: read + +jobs: + php-cs-fixer: + permissions: + contents: read # for actions/checkout to fetch code + name: PHP CS Fixer + runs-on: ubuntu-latest + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v3 + + - name: Get Composer Cache Directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Validate composer config + run: composer validate --strict + + - name: Composer Install + run: composer install --ansi --prefer-dist --no-interaction --no-progress + + - name: Run PHPCSFixer + run: ./vendor/bin/php-cs-fixer fix --dry-run --diff + + - name: Run ergebnis/composer-normalize + run: composer normalize --dry-run --no-check-lock +# phpstan: +# permissions: +# contents: read # for actions/checkout to fetch code +# name: PHP Static Analysis +# runs-on: ubuntu-latest +# strategy: +# matrix: +# php: [ '8.1', '8.2' ] +# fail-fast: false +# steps: +# - name: Setup PHP +# uses: shivammathur/setup-php@v2 +# with: +# php-version: '8.1' # will be overriden by platform.php in composer.json see https://phpstan.org/config-reference#phpversion +# extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv, simplexml +# coverage: none # disable coverage to disable xdebug in the action. +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +# - uses: actions/checkout@v3 + +# - name: Get Composer Cache Directory +# id: composer-cache +# run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + +# - name: Cache Composer Directory +# uses: actions/cache@v3 +# with: +# path: ${{ steps.composer-cache.outputs.dir }} +# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} +# restore-keys: ${{ runner.os }}-composer- + +# - name: Composer Install +# run: | +# composer install --ansi --prefer-dist --no-interaction --no-progress +# rm composer.lock +# composer config platform.php ${{ matrix.php }} + +# - name: Run phpstan +# run: ./vendor/bin/phpstan analyse -c phpstan.neon.dist +# phpunit: +# permissions: +# contents: read # for actions/checkout to fetch code +# name: PHPUnit +# runs-on: ubuntu-latest +# strategy: +# matrix: +# php: [ '8.1', '8.2' ] +# fail-fast: false +# steps: +# - name: Setup PHP +# uses: shivammathur/setup-php@v2 +# with: +# php-version: ${{ matrix.php }} +# extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv, simplexml +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +# - uses: actions/checkout@v3 + +# - name: PrestaShop Configuration +# run: cp .github/workflows/phpunit/parameters.yml app/config/parameters.yml + +# - name: Get Composer Cache Directory +# id: composer-cache +# run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + +# - name: Cache Composer Directory +# uses: actions/cache@v3 +# with: +# path: ${{ steps.composer-cache.outputs.dir }} +# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} +# restore-keys: ${{ runner.os }}-composer- + +# - name: Composer Install +# run: composer install --ansi --prefer-dist --no-interaction --no-progress + +# - name: Update phpunit version +# if: ${{ startsWith(matrix.php, '8.') }} +# run: composer update -w --ignore-platform-reqs --no-interaction phpunit/phpunit + +# - name: Run phpunit +# run: ./vendor/phpunit/phpunit/phpunit -c tests/Unit/phpunit.xml +# env: +# SYMFONY_DEPRECATIONS_HELPER: disabled + +# - name: Test git versionned files unchanged +# if: ${{ !startsWith(matrix.php, '8.') }} # composer.lock changes when updating phpunit version +# run: git diff --exit-code \ No newline at end of file diff --git a/.gitignore b/.gitignore index b5664bad..b50ead5d 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,8 @@ /phpunit.xml .phpunit.result.cache ###< phpunit/phpunit ### + +###> friendsofphp/php-cs-fixer ### +/.php-cs-fixer.php +/.php-cs-fixer.cache +###< friendsofphp/php-cs-fixer ### diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 00000000..ac60bc2f --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,48 @@ +in([ + __DIR__.'/src', + __DIR__.'/migrations', + __DIR__.'/public', + __DIR__.'/tests', +]); + +return (new PhpCsFixer\Config()) + ->setRiskyAllowed(true) + ->setRules([ + '@Symfony' => true, + 'array_indentation' => true, + 'cast_spaces' => [ + 'space' => 'single', + ], + 'combine_consecutive_issets' => true, + 'concat_space' => [ + 'spacing' => 'one', + ], + 'error_suppression' => [ + 'mute_deprecation_error' => false, + 'noise_remaining_usages' => false, + 'noise_remaining_usages_exclude' => [], + ], + 'function_to_constant' => false, + 'method_chaining_indentation' => true, + 'no_alias_functions' => false, + 'no_superfluous_phpdoc_tags' => false, + 'non_printable_character' => [ + 'use_escape_sequences_in_strings' => true, + ], + 'phpdoc_align' => [ + 'align' => 'left', + ], + 'phpdoc_summary' => false, + 'protected_to_private' => false, + 'psr_autoloading' => false, + 'self_accessor' => false, + 'yoda_style' => false, + 'single_line_throw' => false, + 'no_alias_language_construct_call' => false, + ]) + ->setFinder($finder) + ->setCacheFile(__DIR__.'/var/.php_cs.cache'); \ No newline at end of file diff --git a/.php_cs.dist b/.php_cs.dist deleted file mode 100644 index 9830d6d3..00000000 --- a/.php_cs.dist +++ /dev/null @@ -1,11 +0,0 @@ -setUsingCache(true) - ->getFinder() - ->in(__DIR__) - ->exclude('vendor'); - -return $config; diff --git a/README.md b/README.md index 7ad5aae4..90bac91b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # QANightlyResults -QANightlyResults is a Slim Framework app, acting as a backend (via a JSON API) to handle +QANightlyResults is a Symfonyapp, acting as a backend (via a JSON API) to handle and browse tests reports records. You can use any frontend app you want to consume this API. We use a [Vue app](https://github.com/PrestaShop/nightly-board). diff --git a/composer.json b/composer.json index a8dd6675..2cf3255e 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,8 @@ { - "type": "project", + "name": "prestashop/qanightlyresults", + "description": "QANightlyResults is a Symfony app, acting as a backend (via a JSON API) to handle and browse tests reports records.", "license": "MIT", - "minimum-stability": "stable", - "prefer-stable": true, + "type": "project", "require": { "php": ">=8.2", "ext-ctype": "*", @@ -11,28 +11,37 @@ "doctrine/doctrine-bundle": "^2.11", "doctrine/doctrine-migrations-bundle": "^3.3", "doctrine/orm": "^2.17", - "symfony/console": "7.0.*", - "symfony/dotenv": "7.0.*", + "symfony/console": "~7.0.0", + "symfony/dotenv": "~7.0.0", "symfony/flex": "^2", - "symfony/framework-bundle": "7.0.*", - "symfony/runtime": "7.0.*", - "symfony/yaml": "7.0.*" + "symfony/framework-bundle": "~7.0.0", + "symfony/runtime": "~7.0.0", + "symfony/yaml": "~7.0.0" }, "require-dev": { + "ergebnis/composer-normalize": "^2.41", + "friendsofphp/php-cs-fixer": "^3.45", "phpunit/phpunit": "^9.5", - "symfony/browser-kit": "7.0.*", - "symfony/css-selector": "7.0.*", + "symfony/browser-kit": "~7.0.0", + "symfony/css-selector": "~7.0.0", "symfony/maker-bundle": "^1.52", "symfony/phpunit-bridge": "^7.0" }, - "config": { - "allow-plugins": { - "php-http/discovery": true, - "symfony/flex": true, - "symfony/runtime": true - }, - "sort-packages": true + "replace": { + "symfony/polyfill-ctype": "*", + "symfony/polyfill-iconv": "*", + "symfony/polyfill-php72": "*", + "symfony/polyfill-php73": "*", + "symfony/polyfill-php74": "*", + "symfony/polyfill-php80": "*", + "symfony/polyfill-php81": "*", + "symfony/polyfill-php82": "*" }, + "conflict": { + "symfony/symfony": "*" + }, + "minimum-stability": "stable", + "prefer-stable": true, "autoload": { "psr-4": { "App\\": "src/" @@ -43,35 +52,31 @@ "App\\Tests\\": "tests/" } }, - "replace": { - "symfony/polyfill-ctype": "*", - "symfony/polyfill-iconv": "*", - "symfony/polyfill-php72": "*", - "symfony/polyfill-php73": "*", - "symfony/polyfill-php74": "*", - "symfony/polyfill-php80": "*", - "symfony/polyfill-php81": "*", - "symfony/polyfill-php82": "*" + "config": { + "allow-plugins": { + "ergebnis/composer-normalize": true, + "php-http/discovery": true, + "symfony/flex": true, + "symfony/runtime": true + }, + "sort-packages": true + }, + "extra": { + "symfony": { + "allow-contrib": false, + "require": "7.0.*" + } }, "scripts": { - "auto-scripts": { - "cache:clear": "symfony-cmd", - "assets:install %PUBLIC_DIR%": "symfony-cmd" - }, "post-install-cmd": [ "@auto-scripts" ], "post-update-cmd": [ "@auto-scripts" - ] - }, - "conflict": { - "symfony/symfony": "*" - }, - "extra": { - "symfony": { - "allow-contrib": false, - "require": "7.0.*" + ], + "auto-scripts": { + "cache:clear": "symfony-cmd", + "assets:install %PUBLIC_DIR%": "symfony-cmd" } } } diff --git a/composer.lock b/composer.lock index f08ce9de..73562119 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ba320458a16ac460396184b902c0cee8", + "content-hash": "64b1632c8158e50e448daf2441a84aa6", "packages": [ { "name": "beberlei/doctrineextensions", @@ -3961,6 +3961,858 @@ } ], "packages-dev": [ + { + "name": "composer/pcre", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/00104306927c7a0919b4ced2aaa6782c1e61a3c9", + "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.3", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.1.1" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2023-10-11T07:11:09+00:00" + }, + { + "name": "composer/semver", + "version": "3.4.0", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/35e8d0af4486141bc745f23a29cc2091eb624a32", + "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.4", + "symfony/phpunit-bridge": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.4.0" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2023-08-31T09:50:34+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "ced299686f41dce890debac69273b47ffe98a40c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ced299686f41dce890debac69273b47ffe98a40c", + "reference": "ced299686f41dce890debac69273b47ffe98a40c", + "shasum": "" + }, + "require": { + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" + }, + "require-dev": { + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/3.0.3" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-02-25T21:32:43+00:00" + }, + { + "name": "ergebnis/composer-normalize", + "version": "2.41.1", + "source": { + "type": "git", + "url": "https://github.com/ergebnis/composer-normalize.git", + "reference": "01eb2d9b8623828ec2264f54d7782a25558d27b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ergebnis/composer-normalize/zipball/01eb2d9b8623828ec2264f54d7782a25558d27b2", + "reference": "01eb2d9b8623828ec2264f54d7782a25558d27b2", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.0.0", + "ergebnis/json": "^1.1.0", + "ergebnis/json-normalizer": "^4.4.1", + "ergebnis/json-printer": "^3.4.0", + "ext-json": "*", + "justinrainbow/json-schema": "^5.2.12", + "localheinz/diff": "^1.1.1", + "php": "~8.1.0 || ~8.2.0 || ~8.3.0" + }, + "require-dev": { + "composer/composer": "^2.6.6", + "ergebnis/license": "^2.4.0", + "ergebnis/php-cs-fixer-config": "~6.14.0", + "ergebnis/phpunit-slow-test-detector": "^2.7.0", + "fakerphp/faker": "^1.23.0", + "infection/infection": "~0.27.9", + "phpunit/phpunit": "^10.5.3", + "psalm/plugin-phpunit": "~0.18.4", + "rector/rector": "~0.18.12", + "roave/backward-compatibility-check": "^8.4.0", + "symfony/filesystem": "^6.4.0", + "vimeo/psalm": "^5.17.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Ergebnis\\Composer\\Normalize\\NormalizePlugin", + "composer-normalize": { + "indent-size": 2, + "indent-style": "space" + }, + "plugin-optional": true + }, + "autoload": { + "psr-4": { + "Ergebnis\\Composer\\Normalize\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andreas Möller", + "email": "am@localheinz.com", + "homepage": "https://localheinz.com" + } + ], + "description": "Provides a composer plugin for normalizing composer.json.", + "homepage": "https://github.com/ergebnis/composer-normalize", + "keywords": [ + "composer", + "normalize", + "normalizer", + "plugin" + ], + "support": { + "issues": "https://github.com/ergebnis/composer-normalize/issues", + "security": "https://github.com/ergebnis/composer-normalize/blob/main/.github/SECURITY.md", + "source": "https://github.com/ergebnis/composer-normalize" + }, + "time": "2023-12-14T09:37:52+00:00" + }, + { + "name": "ergebnis/json", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/ergebnis/json.git", + "reference": "9f2b9086c43b189d7044a5b6215a931fb6e9125d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ergebnis/json/zipball/9f2b9086c43b189d7044a5b6215a931fb6e9125d", + "reference": "9f2b9086c43b189d7044a5b6215a931fb6e9125d", + "shasum": "" + }, + "require": { + "php": "~8.1.0 || ~8.2.0 || ~8.3.0" + }, + "require-dev": { + "ergebnis/composer-normalize": "^2.29.0", + "ergebnis/data-provider": "^3.0.0", + "ergebnis/license": "^2.2.0", + "ergebnis/php-cs-fixer-config": "^6.6.0", + "ergebnis/phpunit-slow-test-detector": "^2.3.0", + "fakerphp/faker": "^1.23.0", + "infection/infection": "~0.27.4", + "phpunit/phpunit": "^10.4.1", + "psalm/plugin-phpunit": "~0.18.4", + "rector/rector": "~0.18.5", + "vimeo/psalm": "^5.15.0" + }, + "type": "library", + "extra": { + "composer-normalize": { + "indent-size": 2, + "indent-style": "space" + } + }, + "autoload": { + "psr-4": { + "Ergebnis\\Json\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andreas Möller", + "email": "am@localheinz.com", + "homepage": "https://localheinz.com" + } + ], + "description": "Provides a Json value object for representing a valid JSON string.", + "homepage": "https://github.com/ergebnis/json", + "keywords": [ + "json" + ], + "support": { + "issues": "https://github.com/ergebnis/json/issues", + "security": "https://github.com/ergebnis/json/blob/main/.github/SECURITY.md", + "source": "https://github.com/ergebnis/json" + }, + "time": "2023-10-10T07:57:48+00:00" + }, + { + "name": "ergebnis/json-normalizer", + "version": "4.4.1", + "source": { + "type": "git", + "url": "https://github.com/ergebnis/json-normalizer.git", + "reference": "d28f36af9763ee6bc4e2a2390c0348963df7881b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ergebnis/json-normalizer/zipball/d28f36af9763ee6bc4e2a2390c0348963df7881b", + "reference": "d28f36af9763ee6bc4e2a2390c0348963df7881b", + "shasum": "" + }, + "require": { + "ergebnis/json": "^1.1.0", + "ergebnis/json-pointer": "^3.2.0", + "ergebnis/json-printer": "^3.4.0", + "ergebnis/json-schema-validator": "^4.1.0", + "ext-json": "*", + "justinrainbow/json-schema": "^5.2.12", + "php": "~8.1.0 || ~8.2.0 || ~8.3.0" + }, + "require-dev": { + "composer/semver": "^3.4.0", + "ergebnis/data-provider": "^3.2.0", + "ergebnis/license": "^2.4.0", + "ergebnis/php-cs-fixer-config": "~6.14.0", + "ergebnis/phpunit-slow-test-detector": "^2.7.0", + "fakerphp/faker": "^1.23.0", + "infection/infection": "~0.27.9", + "phpunit/phpunit": "^10.5.3", + "psalm/plugin-phpunit": "~0.18.4", + "rector/rector": "~0.18.12", + "roave/backward-compatibility-check": "^8.4.0", + "symfony/filesystem": "^6.4.0", + "symfony/finder": "^6.4.0", + "vimeo/psalm": "^5.17.0" + }, + "suggest": { + "composer/semver": "If you want to use ComposerJsonNormalizer or VersionConstraintNormalizer" + }, + "type": "library", + "autoload": { + "psr-4": { + "Ergebnis\\Json\\Normalizer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andreas Möller", + "email": "am@localheinz.com", + "homepage": "https://localheinz.com" + } + ], + "description": "Provides generic and vendor-specific normalizers for normalizing JSON documents.", + "homepage": "https://github.com/ergebnis/json-normalizer", + "keywords": [ + "json", + "normalizer" + ], + "support": { + "issues": "https://github.com/ergebnis/json-normalizer/issues", + "security": "https://github.com/ergebnis/json-normalizer/blob/main/.github/SECURITY.md", + "source": "https://github.com/ergebnis/json-normalizer" + }, + "time": "2023-12-14T09:30:24+00:00" + }, + { + "name": "ergebnis/json-pointer", + "version": "3.3.0", + "source": { + "type": "git", + "url": "https://github.com/ergebnis/json-pointer.git", + "reference": "8e517faefc06b7c761eaa041febef51a9375819a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ergebnis/json-pointer/zipball/8e517faefc06b7c761eaa041febef51a9375819a", + "reference": "8e517faefc06b7c761eaa041febef51a9375819a", + "shasum": "" + }, + "require": { + "php": "~8.1.0 || ~8.2.0 || ~8.3.0" + }, + "require-dev": { + "ergebnis/composer-normalize": "^2.29.0", + "ergebnis/data-provider": "^3.0.0", + "ergebnis/license": "^2.2.0", + "ergebnis/php-cs-fixer-config": "~6.7.0", + "ergebnis/phpunit-slow-test-detector": "^2.3.0", + "fakerphp/faker": "^1.23.0", + "infection/infection": "~0.27.4", + "phpunit/phpunit": "^10.4.1", + "psalm/plugin-phpunit": "~0.18.4", + "rector/rector": "~0.18.5", + "vimeo/psalm": "^5.15.0" + }, + "type": "library", + "extra": { + "composer-normalize": { + "indent-size": 2, + "indent-style": "space" + } + }, + "autoload": { + "psr-4": { + "Ergebnis\\Json\\Pointer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andreas Möller", + "email": "am@localheinz.com", + "homepage": "https://localheinz.com" + } + ], + "description": "Provides JSON pointer as a value object.", + "homepage": "https://github.com/ergebnis/json-pointer", + "keywords": [ + "RFC6901", + "json", + "pointer" + ], + "support": { + "issues": "https://github.com/ergebnis/json-pointer/issues", + "security": "https://github.com/ergebnis/json-pointer/blob/main/.github/SECURITY.md", + "source": "https://github.com/ergebnis/json-pointer" + }, + "time": "2023-10-10T14:41:06+00:00" + }, + { + "name": "ergebnis/json-printer", + "version": "3.4.0", + "source": { + "type": "git", + "url": "https://github.com/ergebnis/json-printer.git", + "reference": "05841593d72499de4f7ce4034a237c77e470558f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ergebnis/json-printer/zipball/05841593d72499de4f7ce4034a237c77e470558f", + "reference": "05841593d72499de4f7ce4034a237c77e470558f", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "php": "~8.1.0 || ~8.2.0 || ~8.3.0" + }, + "require-dev": { + "ergebnis/license": "^2.2.0", + "ergebnis/php-cs-fixer-config": "^6.6.0", + "ergebnis/phpunit-slow-test-detector": "^2.3.0", + "fakerphp/faker": "^1.23.0", + "infection/infection": "~0.27.3", + "phpunit/phpunit": "^10.4.1", + "psalm/plugin-phpunit": "~0.18.4", + "rector/rector": "~0.18.5", + "vimeo/psalm": "^5.15.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Ergebnis\\Json\\Printer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andreas Möller", + "email": "am@localheinz.com", + "homepage": "https://localheinz.com" + } + ], + "description": "Provides a JSON printer, allowing for flexible indentation.", + "homepage": "https://github.com/ergebnis/json-printer", + "keywords": [ + "formatter", + "json", + "printer" + ], + "support": { + "issues": "https://github.com/ergebnis/json-printer/issues", + "security": "https://github.com/ergebnis/json-printer/blob/main/.github/SECURITY.md", + "source": "https://github.com/ergebnis/json-printer" + }, + "time": "2023-10-10T07:42:48+00:00" + }, + { + "name": "ergebnis/json-schema-validator", + "version": "4.1.0", + "source": { + "type": "git", + "url": "https://github.com/ergebnis/json-schema-validator.git", + "reference": "d568ed85d1cdc2e49d650c2fc234dc2516f3f25b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ergebnis/json-schema-validator/zipball/d568ed85d1cdc2e49d650c2fc234dc2516f3f25b", + "reference": "d568ed85d1cdc2e49d650c2fc234dc2516f3f25b", + "shasum": "" + }, + "require": { + "ergebnis/json": "^1.0.1", + "ergebnis/json-pointer": "^3.2.0", + "ext-json": "*", + "justinrainbow/json-schema": "^5.2.12", + "php": "~8.1.0 || ~8.2.0 || ~8.3.0" + }, + "require-dev": { + "ergebnis/composer-normalize": "^2.21.0", + "ergebnis/data-provider": "^3.0.0", + "ergebnis/license": "^2.2.0", + "ergebnis/php-cs-fixer-config": "~6.6.0", + "ergebnis/phpunit-slow-test-detector": "^2.3.0", + "fakerphp/faker": "^1.23.0", + "infection/infection": "~0.27.4", + "phpunit/phpunit": "^10.4.1", + "psalm/plugin-phpunit": "~0.18.4", + "rector/rector": "~0.18.5", + "vimeo/psalm": "^5.15.0" + }, + "type": "library", + "extra": { + "composer-normalize": { + "indent-size": 2, + "indent-style": "space" + } + }, + "autoload": { + "psr-4": { + "Ergebnis\\Json\\SchemaValidator\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andreas Möller", + "email": "am@localheinz.com", + "homepage": "https://localheinz.com" + } + ], + "description": "Provides a JSON schema validator, building on top of justinrainbow/json-schema.", + "homepage": "https://github.com/ergebnis/json-schema-validator", + "keywords": [ + "json", + "schema", + "validator" + ], + "support": { + "issues": "https://github.com/ergebnis/json-schema-validator/issues", + "security": "https://github.com/ergebnis/json-schema-validator/blob/main/.github/SECURITY.md", + "source": "https://github.com/ergebnis/json-schema-validator" + }, + "time": "2023-10-10T14:16:57+00:00" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v3.45.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", + "reference": "c0daa33cb2533cd73f48dde1c70c2afa3e7953b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/c0daa33cb2533cd73f48dde1c70c2afa3e7953b5", + "reference": "c0daa33cb2533cd73f48dde1c70c2afa3e7953b5", + "shasum": "" + }, + "require": { + "composer/semver": "^3.4", + "composer/xdebug-handler": "^3.0.3", + "ext-json": "*", + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0", + "sebastian/diff": "^4.0 || ^5.0", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0", + "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", + "symfony/finder": "^5.4 || ^6.0 || ^7.0", + "symfony/options-resolver": "^5.4 || ^6.0 || ^7.0", + "symfony/polyfill-mbstring": "^1.28", + "symfony/polyfill-php80": "^1.28", + "symfony/polyfill-php81": "^1.28", + "symfony/process": "^5.4 || ^6.0 || ^7.0", + "symfony/stopwatch": "^5.4 || ^6.0 || ^7.0" + }, + "require-dev": { + "facile-it/paraunit": "^1.3 || ^2.0", + "justinrainbow/json-schema": "^5.2", + "keradus/cli-executor": "^2.1", + "mikey179/vfsstream": "^1.6.11", + "php-coveralls/php-coveralls": "^2.7", + "php-cs-fixer/accessible-object": "^1.1", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.4", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.4", + "phpunit/phpunit": "^9.6 || ^10.5.5", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "autoload": { + "psr-4": { + "PhpCsFixer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "keywords": [ + "Static code analysis", + "fixer", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.45.0" + }, + "funding": [ + { + "url": "https://github.com/keradus", + "type": "github" + } + ], + "time": "2023-12-30T02:07:07+00:00" + }, + { + "name": "justinrainbow/json-schema", + "version": "v5.2.13", + "source": { + "type": "git", + "url": "https://github.com/justinrainbow/json-schema.git", + "reference": "fbbe7e5d79f618997bc3332a6f49246036c45793" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/fbbe7e5d79f618997bc3332a6f49246036c45793", + "reference": "fbbe7e5d79f618997bc3332a6f49246036c45793", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", + "json-schema/json-schema-test-suite": "1.2.0", + "phpunit/phpunit": "^4.8.35" + }, + "bin": [ + "bin/validate-json" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "JsonSchema\\": "src/JsonSchema/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bruno Prieto Reis", + "email": "bruno.p.reis@gmail.com" + }, + { + "name": "Justin Rainbow", + "email": "justin.rainbow@gmail.com" + }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + }, + { + "name": "Robert Schönthal", + "email": "seroscho@googlemail.com" + } + ], + "description": "A library to validate a json schema.", + "homepage": "https://github.com/justinrainbow/json-schema", + "keywords": [ + "json", + "schema" + ], + "support": { + "issues": "https://github.com/justinrainbow/json-schema/issues", + "source": "https://github.com/justinrainbow/json-schema/tree/v5.2.13" + }, + "time": "2023-09-26T02:20:38+00:00" + }, + { + "name": "localheinz/diff", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/localheinz/diff.git", + "reference": "851bb20ea8358c86f677f5f111c4ab031b1c764c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/localheinz/diff/zipball/851bb20ea8358c86f677f5f111c4ab031b1c764c", + "reference": "851bb20ea8358c86f677f5f111c4ab031b1c764c", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Fork of sebastian/diff for use with ergebnis/composer-normalize", + "homepage": "https://github.com/localheinz/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "source": "https://github.com/localheinz/diff/tree/main" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-06T04:49:32+00:00" + }, { "name": "masterminds/html5", "version": "2.8.1", @@ -5932,6 +6784,73 @@ ], "time": "2023-10-31T18:23:49+00:00" }, + { + "name": "symfony/options-resolver", + "version": "v7.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "700ff4096e346f54cb628ea650767c8130f1001f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/700ff4096e346f54cb628ea650767c8130f1001f", + "reference": "700ff4096e346f54cb628ea650767c8130f1001f", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an improved replacement for the array_replace PHP function", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v7.0.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-08-08T10:20:21+00:00" + }, { "name": "symfony/phpunit-bridge", "version": "v7.0.0", diff --git a/public/index.php b/public/index.php index 9982c218..7fbc8cf6 100644 --- a/public/index.php +++ b/public/index.php @@ -2,7 +2,7 @@ use App\Kernel; -require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; +require_once dirname(__DIR__) . '/vendor/autoload_runtime.php'; return function (array $context) { return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); diff --git a/src/Controller/DataController.php b/src/Controller/DataController.php index 3da8c1af..02eaafb2 100644 --- a/src/Controller/DataController.php +++ b/src/Controller/DataController.php @@ -1,7 +1,7 @@ getBadgeData($request, false); if (!$badge_data) { return new JsonResponse([ - 'message' => 'Execution not found' + 'message' => 'Execution not found', ], Response::HTTP_NOT_FOUND); } @@ -72,8 +72,7 @@ public function badgeSvg(Request $request): Response private function getBadgeData( Request $request, bool $hexColor - ): ?array - { + ): ?array { $branch = $request->query->get('branch', 'develop'); $date = $request->query->get('date'); if ($date) { @@ -99,4 +98,4 @@ private function getBadgeData( return null; } -} \ No newline at end of file +} diff --git a/src/Controller/GraphController.php b/src/Controller/GraphController.php index 01589be7..d5946cbe 100644 --- a/src/Controller/GraphController.php +++ b/src/Controller/GraphController.php @@ -1,12 +1,11 @@ $execution->getFailures(), 'pending' => $execution->getPending(), ]; - }; + } return new JsonResponse($executions); } @@ -138,4 +137,4 @@ private function isValidParameter(string $parameter, array $values): bool return false; } -} \ No newline at end of file +} diff --git a/src/Controller/HealthCheckController.php b/src/Controller/HealthCheckController.php index c3b0d3f8..2e2cb11d 100644 --- a/src/Controller/HealthCheckController.php +++ b/src/Controller/HealthCheckController.php @@ -1,9 +1,9 @@ first(); + // @todo + // Manager::table('settings')->first(); } catch (QueryException $e) { $data['database'] = false; } @@ -32,4 +32,4 @@ public function check(string $nightlyGCPUrl): JsonResponse return $this->json($data); } -} \ No newline at end of file +} diff --git a/src/Controller/ImportController.php b/src/Controller/ImportController.php index af2cd9df..56cb76ef 100644 --- a/src/Controller/ImportController.php +++ b/src/Controller/ImportController.php @@ -1,4 +1,5 @@ filename) { return new JsonResponse([ - 'message' => 'No enough parameters' + 'message' => 'No enough parameters', ], Response::HTTP_BAD_REQUEST); } if ($token !== $this->nightlyToken) { return new JsonResponse([ - 'message' => 'Invalid token' + 'message' => 'Invalid token', ], Response::HTTP_UNAUTHORIZED); } preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}-(.*)?\.json/', $this->filename, $matchesVersion); if (!isset($matchesVersion[1])) { return new JsonResponse([ - 'message' => 'Could not retrieve version from filename' + 'message' => 'Could not retrieve version from filename', ], Response::HTTP_BAD_REQUEST); } @@ -92,36 +89,36 @@ protected function checkAuth(Request $request, string $dateFormat): ?JsonRespons 'Version found not correct (%s) from filename %s', $this->version, $this->filename - ) + ), ], Response::HTTP_BAD_REQUEST); } $fileContent = @file_get_contents($this->nightlyGCPUrl . 'reports/' . $this->filename); if (!$fileContent) { return new JsonResponse([ - 'message' => 'Unable to retrieve content from GCP URL' + 'message' => 'Unable to retrieve content from GCP URL', ], Response::HTTP_BAD_REQUEST); } $this->jsonContent = json_decode($fileContent); if (!$this->jsonContent) { return new JsonResponse([ - 'message' => 'Unable to decode JSON data' + 'message' => 'Unable to decode JSON data', ], Response::HTTP_BAD_REQUEST); } $force = $request->query->get('force', false); $force = is_bool($force) ? $force : false; - + $this->platform = $request->query->has('platform') ? $request->query->get('platform') : ( $request->query->has('browser') ? $request->query->get('browser') : null ); $this->platform = in_array($this->platform, self::FILTER_PLATFORMS) ? $this->platform : self::FILTER_PLATFORMS[0]; - + $this->campaign = $request->query->has('campaign') ? $request->query->get('campaign') : null; $this->campaign = in_array($this->campaign, self::FILTER_CAMPAIGNS) ? $this->campaign : self::FILTER_CAMPAIGNS[0]; - $this->startDate = DateTime::createFromFormat($dateFormat, $this->jsonContent->stats->start); + $this->startDate = \DateTime::createFromFormat($dateFormat, $this->jsonContent->stats->start); // Check if there is no similar entry if (!$force && $this->executionRepository->findOneByNightly($this->version, $this->platform, $this->campaign, $this->startDate->format('Y-m-d'))) { @@ -132,7 +129,7 @@ protected function checkAuth(Request $request, string $dateFormat): ?JsonRespons $this->platform, $this->campaign, $this->startDate->format('Y-m-d') - ) + ), ], Response::HTTP_FORBIDDEN); } @@ -155,14 +152,14 @@ public function importReportOld(Request $request): JsonResponse ->setPlatform($this->platform) ->setCampaign($this->campaign) ->setStartDate($this->startDate) - ->setEndDate(DateTime::createFromFormat(self::FORMAT_DATE_MOCHA5, $this->jsonContent->stats->end)) + ->setEndDate(\DateTime::createFromFormat(self::FORMAT_DATE_MOCHA5, $this->jsonContent->stats->end)) ->setDuration($this->jsonContent->stats->duration) ->setVersion($this->version) ->setSkipped($this->jsonContent->stats->skipped) ->setPending($this->jsonContent->stats->pending) ->setPasses($this->jsonContent->stats->passes) ->setFailures($this->jsonContent->stats->failures) - ->setInsertionStartDate(new DateTime()) + ->setInsertionStartDate(new \DateTime()) ; $this->entityManager->persist($execution); $this->entityManager->flush(); @@ -171,7 +168,7 @@ public function importReportOld(Request $request): JsonResponse // Calculate comparison with last execution $execution = $this->compareReportData($execution); - $execution->setInsertionEndDate(new DateTime()); + $execution->setInsertionEndDate(new \DateTime()); $this->entityManager->persist($execution); $this->entityManager->flush(); @@ -198,25 +195,25 @@ public function importReport(Request $request): JsonResponse ->setPlatform($this->platform) ->setCampaign($this->campaign) ->setStartDate($this->startDate) - ->setEndDate(DateTime::createFromFormat(self::FORMAT_DATE_MOCHA6, $this->jsonContent->stats->end)) + ->setEndDate(\DateTime::createFromFormat(self::FORMAT_DATE_MOCHA6, $this->jsonContent->stats->end)) ->setDuration($this->jsonContent->stats->duration) ->setVersion($this->version) ->setSkipped($this->jsonContent->stats->skipped) ->setPending($this->jsonContent->stats->pending) ->setPasses($this->jsonContent->stats->passes) ->setFailures($this->jsonContent->stats->failures) - ->setInsertionStartDate(new DateTime()) + ->setInsertionStartDate(new \DateTime()) ; $this->entityManager->persist($execution); $this->entityManager->flush(); - foreach($this->jsonContent->results as $suite) { + foreach ($this->jsonContent->results as $suite) { $this->insertExecutionSuite($execution, $suite, self::FORMAT_DATE_MOCHA6); } // Calculate comparison with last execution $execution = $this->compareReportData($execution); - $execution->setInsertionEndDate(new DateTime()); + $execution->setInsertionEndDate(new \DateTime()); $this->entityManager->persist($execution); $this->entityManager->flush(); @@ -227,7 +224,7 @@ public function importReport(Request $request): JsonResponse ]); } - private function insertExecutionSuite(Execution $execution, \stdClass $suite, string $dateFormat, ?int $parentSuiteId = null) + private function insertExecutionSuite(Execution $execution, \stdClass $suite, string $dateFormat, int $parentSuiteId = null) { $isMocha6 = $dateFormat === self::FORMAT_DATE_MOCHA6; @@ -362,7 +359,7 @@ public function compareReportData(Execution $execution): Execution if (!$executionPrevious) { return $execution; } - + $data = $this->testRepository->findComparisonDate($execution, $executionPrevious); if (empty($data)) { return $execution; @@ -374,7 +371,7 @@ public function compareReportData(Execution $execution): Execution ->setBrokenSinceLast(0) ->setEqualSinceLast(0) ; - foreach($data as $datum) { + foreach ($data as $datum) { if ($datum['old_test_state'] == 'failed' && $datum['current_test_state'] == 'failed') { $execution->setEqualSinceLast($execution->getEqualSinceLast() + 1); } @@ -385,6 +382,7 @@ public function compareReportData(Execution $execution): Execution $execution->setFixedSinceLast($execution->getFixedSinceLast() + 1); } } + return $execution; } -} \ No newline at end of file +} diff --git a/src/Controller/ReportController.php b/src/Controller/ReportController.php index 42cde171..02039101 100644 --- a/src/Controller/ReportController.php +++ b/src/Controller/ReportController.php @@ -1,11 +1,10 @@ query->has('filter_platform')) { $executionFilters['platform'] = $request->query->get('filter_platform'); } elseif ($request->query->has('filter_browser')) { @@ -51,7 +50,7 @@ public function reports(Request $request): JsonResponse $executionFilters['version'] = $request->query->get('filter_version'); } $executions = $this->executionRepository->findBy($executionFilters, [ - 'start_date' => 'DESC' + 'start_date' => 'DESC', ]); $reportListing = []; @@ -99,7 +98,7 @@ public function reports(Request $request): JsonResponse ]; } - //merge two arrays in one and sort them by date + // merge two arrays in one and sort them by date usort($reports, function ($dt1, $dt2) { $tm1 = isset($dt1['start_date']) ? $dt1['start_date'] : $dt1['date']; $tm2 = isset($dt2['start_date']) ? $dt2['start_date'] : $dt2['date']; @@ -116,7 +115,7 @@ public function report(int $idReport, Request $request): JsonResponse $execution = $this->executionRepository->findOneById($idReport); if (!$execution) { return new JsonResponse([ - 'message' => 'Execution not found' + 'message' => 'Execution not found', ], Response::HTTP_NOT_FOUND); } @@ -132,8 +131,8 @@ public function report(int $idReport, Request $request): JsonResponse 'campaign' => $execution->getCampaign(), 'browser' => $execution->getPlatform(), // retro-compatibility 'platform' => $execution->getPlatform(), - 'start_date' => $execution->getStartDate()->setTimezone(new DateTimeZone('-01:00'))->format('Y-m-d H:i:s'), - 'end_date' => $execution->getEndDate()->setTimezone(new DateTimeZone('-01:00'))->format('Y-m-d H:i:s'), + 'start_date' => $execution->getStartDate()->setTimezone(new \DateTimeZone('-01:00'))->format('Y-m-d H:i:s'), + 'end_date' => $execution->getEndDate()->setTimezone(new \DateTimeZone('-01:00'))->format('Y-m-d H:i:s'), 'duration' => $execution->getDuration(), 'suites' => $execution->getSuites(), 'tests' => $execution->getTests(), @@ -160,7 +159,7 @@ public function reportSuite(int $idReport, int $idSuite, Request $request): Json $execution = $this->executionRepository->findOneById($idReport); if (!$execution) { return new JsonResponse([ - 'message' => 'Execution not found' + 'message' => 'Execution not found', ], Response::HTTP_NOT_FOUND); } @@ -173,4 +172,4 @@ public function reportSuite(int $idReport, int $idSuite, Request $request): Json return new JsonResponse($return); } -} \ No newline at end of file +} diff --git a/src/Entity/Suite.php b/src/Entity/Suite.php index d0c645bd..efc5072a 100644 --- a/src/Entity/Suite.php +++ b/src/Entity/Suite.php @@ -321,12 +321,13 @@ public function getTests(): Collection */ public function setTests(array $tests): static { - foreach($this->tests as $test) { + foreach ($this->tests as $test) { $this->removeTest($test); } - foreach($tests as $test) { + foreach ($tests as $test) { $this->addTest($test); } + return $this; } diff --git a/src/Repository/ExecutionRepository.php b/src/Repository/ExecutionRepository.php index fd0a1e0c..17fd26e1 100644 --- a/src/Repository/ExecutionRepository.php +++ b/src/Repository/ExecutionRepository.php @@ -3,7 +3,6 @@ namespace App\Repository; use App\Entity\Execution; -use DateTime; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; @@ -12,8 +11,8 @@ * * @method Execution|null find($id, $lockMode = null, $lockVersion = null) * @method Execution|null findOneBy(array $criteria, array $orderBy = null) - * @method Execution[] findAll() - * @method Execution[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + * @method Execution[] findAll() + * @method Execution[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ class ExecutionRepository extends ServiceEntityRepository { @@ -27,8 +26,7 @@ public function findOneByNightly( string $platform, string $campaign, string $date - ): ?Execution - { + ): ?Execution { $qb = $this->createQueryBuilder('e') ->andWhere('e.version = :version') ->andWhere('e.platform = :platform') @@ -49,9 +47,8 @@ public function findOneByNightlyBefore( string $version, string $platform, string $campaign, - DateTime $date - ): ?Execution - { + \DateTime $date + ): ?Execution { $qb = $this->createQueryBuilder('e') ->andWhere('e.version = :version') ->andWhere('e.platform = :platform') @@ -97,13 +94,13 @@ public function findAllVersions(): array continue; } $results[] = $datum['version']; - }; + } + return $results; } public function findAllBetweenDates(string $version, string $startDate, string $endDate): array { - $qb = $this->createQueryBuilder('e') ->andWhere('e.version = :version') ->andWhere('e.start_date >= :start_date') diff --git a/src/Repository/SettingsRepository.php b/src/Repository/SettingsRepository.php index b41d8fc2..86864577 100644 --- a/src/Repository/SettingsRepository.php +++ b/src/Repository/SettingsRepository.php @@ -11,8 +11,8 @@ * * @method Settings|null find($id, $lockMode = null, $lockVersion = null) * @method Settings|null findOneBy(array $criteria, array $orderBy = null) - * @method Settings[] findAll() - * @method Settings[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + * @method Settings[] findAll() + * @method Settings[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ class SettingsRepository extends ServiceEntityRepository { @@ -21,28 +21,28 @@ public function __construct(ManagerRegistry $registry) parent::__construct($registry, Settings::class); } -// /** -// * @return Settings[] Returns an array of Settings objects -// */ -// public function findByExampleField($value): array -// { -// return $this->createQueryBuilder('s') -// ->andWhere('s.exampleField = :val') -// ->setParameter('val', $value) -// ->orderBy('s.id', 'ASC') -// ->setMaxResults(10) -// ->getQuery() -// ->getResult() -// ; -// } + // /** + // * @return Settings[] Returns an array of Settings objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('s') + // ->andWhere('s.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('s.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } -// public function findOneBySomeField($value): ?Settings -// { -// return $this->createQueryBuilder('s') -// ->andWhere('s.exampleField = :val') -// ->setParameter('val', $value) -// ->getQuery() -// ->getOneOrNullResult() -// ; -// } + // public function findOneBySomeField($value): ?Settings + // { + // return $this->createQueryBuilder('s') + // ->andWhere('s.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } } diff --git a/src/Repository/SuiteRepository.php b/src/Repository/SuiteRepository.php index 6bc33dc6..5a39b4e3 100644 --- a/src/Repository/SuiteRepository.php +++ b/src/Repository/SuiteRepository.php @@ -11,8 +11,8 @@ * * @method Suite|null find($id, $lockMode = null, $lockVersion = null) * @method Suite|null findOneBy(array $criteria, array $orderBy = null) - * @method Suite[] findAll() - * @method Suite[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + * @method Suite[] findAll() + * @method Suite[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ class SuiteRepository extends ServiceEntityRepository { @@ -21,28 +21,28 @@ public function __construct(ManagerRegistry $registry) parent::__construct($registry, Suite::class); } -// /** -// * @return Suite[] Returns an array of Suite objects -// */ -// public function findByExampleField($value): array -// { -// return $this->createQueryBuilder('s') -// ->andWhere('s.exampleField = :val') -// ->setParameter('val', $value) -// ->orderBy('s.id', 'ASC') -// ->setMaxResults(10) -// ->getQuery() -// ->getResult() -// ; -// } + // /** + // * @return Suite[] Returns an array of Suite objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('s') + // ->andWhere('s.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('s.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } -// public function findOneBySomeField($value): ?Suite -// { -// return $this->createQueryBuilder('s') -// ->andWhere('s.exampleField = :val') -// ->setParameter('val', $value) -// ->getQuery() -// ->getOneOrNullResult() -// ; -// } + // public function findOneBySomeField($value): ?Suite + // { + // return $this->createQueryBuilder('s') + // ->andWhere('s.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } } diff --git a/src/Repository/TestRepository.php b/src/Repository/TestRepository.php index 3fb7620d..99bd0da6 100644 --- a/src/Repository/TestRepository.php +++ b/src/Repository/TestRepository.php @@ -4,8 +4,8 @@ use App\Entity\Execution; use App\Entity\Test; -use Doctrine\ORM\Query\Expr; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; +use Doctrine\ORM\Query\Expr; use Doctrine\Persistence\ManagerRegistry; /** @@ -13,8 +13,8 @@ * * @method Test|null find($id, $lockMode = null, $lockVersion = null) * @method Test|null findOneBy(array $criteria, array $orderBy = null) - * @method Test[] findAll() - * @method Test[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + * @method Test[] findAll() + * @method Test[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ class TestRepository extends ServiceEntityRepository { @@ -46,28 +46,28 @@ public function findComparisonDate(Execution $current, Execution $previous): arr ; } -// /** -// * @return Test[] Returns an array of Test objects -// */ -// public function findByExampleField($value): array -// { -// return $this->createQueryBuilder('t') -// ->andWhere('t.exampleField = :val') -// ->setParameter('val', $value) -// ->orderBy('t.id', 'ASC') -// ->setMaxResults(10) -// ->getQuery() -// ->getResult() -// ; -// } + // /** + // * @return Test[] Returns an array of Test objects + // */ + // public function findByExampleField($value): array + // { + // return $this->createQueryBuilder('t') + // ->andWhere('t.exampleField = :val') + // ->setParameter('val', $value) + // ->orderBy('t.id', 'ASC') + // ->setMaxResults(10) + // ->getQuery() + // ->getResult() + // ; + // } -// public function findOneBySomeField($value): ?Test -// { -// return $this->createQueryBuilder('t') -// ->andWhere('t.exampleField = :val') -// ->setParameter('val', $value) -// ->getQuery() -// ->getOneOrNullResult() -// ; -// } + // public function findOneBySomeField($value): ?Test + // { + // return $this->createQueryBuilder('t') + // ->andWhere('t.exampleField = :val') + // ->setParameter('val', $value) + // ->getQuery() + // ->getOneOrNullResult() + // ; + // } } diff --git a/src/Service/ReportLister.php b/src/Service/ReportLister.php index 2c0b0d9e..7494134d 100644 --- a/src/Service/ReportLister.php +++ b/src/Service/ReportLister.php @@ -2,9 +2,7 @@ namespace App\Service; -use SimpleXMLElement; - -class ReportLister +class ReportLister { public string $url; @@ -21,19 +19,19 @@ public function get(): array } $listing = []; - - $xml = new SimpleXMLElement($return); + + $xml = new \SimpleXMLElement($return); foreach ($xml->Contents as $content) { $buildName = (string) $content->Key; - foreach(['xml', 'zip'] as $extension) { + foreach (['xml', 'zip'] as $extension) { if (strpos($buildName, '.' . $extension) === false) { continue; } // Extract version and date preg_match( - '/([0-9]{4}-[0-9]{2}-[0-9]{2})-([A-z0-9\.]*)-prestashop_(.*)\.' . $extension. '/', + '/([0-9]{4}-[0-9]{2}-[0-9]{2})-([A-z0-9\.]*)-prestashop_(.*)\.' . $extension . '/', $buildName, $matches ); @@ -52,4 +50,4 @@ public function get(): array return $listing; } -} \ No newline at end of file +} diff --git a/src/Service/ReportSuiteBuilder.php b/src/Service/ReportSuiteBuilder.php index 1120d803..00a50530 100644 --- a/src/Service/ReportSuiteBuilder.php +++ b/src/Service/ReportSuiteBuilder.php @@ -6,10 +6,8 @@ use App\Entity\Suite; use App\Entity\Test; use App\Repository\SuiteRepository; -use DateTimeZone; -use Doctrine\Common\Collections\Collection; -class ReportSuiteBuilder +class ReportSuiteBuilder { public const FILTER_STATE_FAILED = 'failed'; public const FILTER_STATE_PASSED = 'passed'; @@ -45,21 +43,24 @@ public function __construct(SuiteRepository $suiteRepository) $this->suiteRepository = $suiteRepository; } - public function filterSearch(?string $search = null): self + public function filterSearch(string $search = null): self { $this->filterSearch = $search; + return $this; } public function filterStates(array $states = self::FILTER_STATES): self { $this->filterStates = $states; + return $this; } public function filterSuite(int $suiteId = null): self { $this->filterSuiteId = $suiteId; + return $this; } @@ -82,7 +83,7 @@ public function build(Execution $execution): self $mainSuiteId = null; break; } - + $hasOnlyOneMainSuite = true; $mainSuiteId = $suite->getId(); } @@ -92,6 +93,7 @@ public function build(Execution $execution): self // Build the recursive tree $this->suites = $this->buildTree($mainSuiteId, true); $this->suites = $this->filterTree($this->suites, true); + return $this; } @@ -106,7 +108,7 @@ public function toArray(): array { $data = []; - foreach($this->suites as $suite) { + foreach ($this->suites as $suite) { $data[$suite->getId()] = $this->formatSuite($suite); } @@ -116,10 +118,10 @@ public function toArray(): array private function formatSuite(Suite $suite): array { $suites = $tests = []; - foreach($suite->getSuites() as $suiteChild) { + foreach ($suite->getSuites() as $suiteChild) { $suites[$suiteChild->getId()] = $this->formatSuite($suiteChild); } - foreach($suite->getTests() as $test) { + foreach ($suite->getTests() as $test) { $tests[] = $this->formatTest($test); } @@ -143,14 +145,14 @@ private function formatSuite(Suite $suite): array 'hasTests' => $suite->getHasTests(), 'parent_id' => $suite->getParentId(), 'insertion_date' => $suite->getInsertionDate() - ->setTimezone(new DateTimeZone('-01:00')) + ->setTimezone(new \DateTimeZone('-01:00')) ->format('Y-m-d H:i:s'), 'suites' => $suites, 'tests' => $tests, - 'childrenData' => $this->stats[$suite->getId()] ?? [] + 'childrenData' => $this->stats[$suite->getId()] ?? [], ]; - return array_filter($data, function($value): bool { + return array_filter($data, function ($value): bool { return !is_array($value) || !empty($value); }); } @@ -169,7 +171,7 @@ private function formatTest(Test $test): array 'stack_trace' => $test->getStackTrace(), 'diff' => $test->getDiff(), 'insertion_date' => $test->getInsertionDate() - ->setTimezone(new DateTimeZone('-01:00')) + ->setTimezone(new \DateTimeZone('-01:00')) ->format('Y-m-d H:i:s'), ]; @@ -183,8 +185,8 @@ private function formatTest(Test $test): array private function getTests(): array { $tests = []; - foreach($this->suites as $suite) { - foreach($suite->getTests() as $test) { + foreach ($this->suites as $suite) { + foreach ($suite->getTests() as $test) { if ($test->getState() == 'failed' && $test->getStackTrace()) { $stackTrace = str_replace(' at', '
    at', htmlentities($test->getStackTrace())); $test->setStackTraceFormatted($stackTrace); @@ -246,8 +248,8 @@ private function buildTree(?int $parentId, bool $isRoot): array continue; } // When the "passed" toggle is turned on and we didn't accept this suite, it must only be shown if - //it hasn't any pending or failed test - //this prevents showing a suite with passed and failed test when we hide failed tests for example + // it hasn't any pending or failed test + // this prevents showing a suite with passed and failed test when we hide failed tests for example if (in_array('passed', $this->filterStates) && $this->stats[$suite->getId()]['totalPasses'] > 0 && $this->stats[$suite->getId()]['totalFailures'] == 0 @@ -267,7 +269,7 @@ private function countStatus(int $basis, array $suites, string $status): int $num = $basis; foreach ($suites as $suite) { - $num += $suite->{'getTotal'.ucfirst($status)}(); + $num += $suite->{'getTotal' . ucfirst($status)}(); if ($suite->getHasSuites() == 1) { $num += $this->countStatus(0, $suite->getSuites(), $status); @@ -279,13 +281,14 @@ private function countStatus(int $basis, array $suites, string $status): int /** * Filter the whole tree when using fulltext search + * * @param $suites * @param callable|null $function + * * @return array */ private function filterTree(array $suites, bool $isRoot): array { - if ($isRoot) { foreach ($suites as $key => &$suite) { } @@ -332,4 +335,4 @@ private function filterSuiteSearch(Suite $suite): bool return false; } -} \ No newline at end of file +} diff --git a/symfony.lock b/symfony.lock index 0e3c39ee..de9ddb02 100644 --- a/symfony.lock +++ b/symfony.lock @@ -26,6 +26,18 @@ "migrations/.gitignore" ] }, + "friendsofphp/php-cs-fixer": { + "version": "3.45", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "3.0", + "ref": "be2103eb4a20942e28a6dd87736669b757132435" + }, + "files": [ + ".php-cs-fixer.dist.php" + ] + }, "phpunit/phpunit": { "version": "9.6", "recipe": { diff --git a/tests/Controller/DataControllerTest.php b/tests/Controller/DataControllerTest.php index 27575ca5..e872ade1 100644 --- a/tests/Controller/DataControllerTest.php +++ b/tests/Controller/DataControllerTest.php @@ -71,4 +71,4 @@ public function testBadgeSvgNotFound(): void $content = $response->getContent(); $this->assertEquals('Execution not found', $content); } -} \ No newline at end of file +} diff --git a/tests/Controller/GraphControllerTest.php b/tests/Controller/GraphControllerTest.php index 13054da4..5d7a73e3 100644 --- a/tests/Controller/GraphControllerTest.php +++ b/tests/Controller/GraphControllerTest.php @@ -18,7 +18,7 @@ public function testGraph(): void $content = json_decode($response->getContent(), true); $this->assertGreaterThan(0, count($content)); - foreach($content as $item) { + foreach ($content as $item) { $this->assertArrayHasKey('id', $item); $this->assertIsInt($item['id']); $this->assertArrayHasKey('start_date', $item); @@ -67,7 +67,7 @@ public function testParameters(): void $this->assertEquals('last_year', $content['periods']['values'][2]['value']); $this->assertArrayHasKey('default', $content['periods']); $this->assertEquals('last_month', $content['periods']['default']); - + $this->assertArrayHasKey('versions', $content); $this->assertIsArray($content['versions']); $this->assertArrayHasKey('type', $content['versions']); @@ -81,4 +81,4 @@ public function testParameters(): void $this->assertArrayHasKey('default', $content['versions']); $this->assertEquals('develop', $content['versions']['default']); } -} \ No newline at end of file +} diff --git a/tests/Controller/HealthCheckControllerTest.php b/tests/Controller/HealthCheckControllerTest.php index fee7e091..c3b2a433 100644 --- a/tests/Controller/HealthCheckControllerTest.php +++ b/tests/Controller/HealthCheckControllerTest.php @@ -22,4 +22,4 @@ public function testHealthcheck(): void $this->assertArrayHasKey('gcp', $content); $this->assertEquals(true, $content['gcp']); } -} \ No newline at end of file +} diff --git a/tests/Controller/ImportControllerTest.php b/tests/Controller/ImportControllerTest.php index fc936912..3a3ace34 100644 --- a/tests/Controller/ImportControllerTest.php +++ b/tests/Controller/ImportControllerTest.php @@ -2,7 +2,6 @@ namespace App\Tests\Controller; -use App\Controller\ReportController; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class ImportControllerTest extends WebTestCase @@ -153,7 +152,6 @@ public function testOldReportAlreadyExisting(): void $this->assertEquals('A similar entry was found (criteria: version develop, platform cli, campaign autoupgrade, date 2024-01-01).', $content['message']); } - public function testReportWithNoParameters(): void { $client = static::createClient(); @@ -299,4 +297,4 @@ public function testReportAlreadyExisting(): void $this->assertArrayHasKey('message', $content); $this->assertEquals('A similar entry was found (criteria: version develop, platform chromium, campaign functional, date 2024-01-01).', $content['message']); } -} \ No newline at end of file +} diff --git a/tests/Controller/ReportControllerTest.php b/tests/Controller/ReportControllerTest.php index 3fcda846..95406160 100644 --- a/tests/Controller/ReportControllerTest.php +++ b/tests/Controller/ReportControllerTest.php @@ -21,7 +21,7 @@ public function testReports(): void $content = json_decode($response->getContent(), true); $this->assertGreaterThan(0, count($content)); $datePrevious = null; - foreach($content as $item) { + foreach ($content as $item) { if ($datePrevious) { $this->assertGreaterThanOrEqual($item['start_date'], $datePrevious); } @@ -33,9 +33,9 @@ public function testReports(): void $this->assertArrayHasKey('campaign', $item); $this->assertContains($item['campaign'], ImportController::FILTER_CAMPAIGNS); $this->assertArrayHasKey('browser', $item); - $this->assertContains($item['browser'], ReportController::FILTER_PLATFORMS); + $this->assertContains($item['browser'], ImportController::FILTER_PLATFORMS); $this->assertArrayHasKey('platform', $item); - $this->assertContains($item['platform'], ReportController::FILTER_PLATFORMS); + $this->assertContains($item['platform'], ImportController::FILTER_PLATFORMS); $this->assertEquals($item['browser'], $item['platform']); $this->assertArrayHasKey('start_date', $item); $this->assertArrayHasKey('end_date', $item); @@ -91,11 +91,11 @@ public function testReportID(): void $this->assertArrayHasKey('date', $content); $this->assertArrayHasKey('version', $content); $this->assertArrayHasKey('campaign', $content); - $this->assertContains($content['campaign'], ReportController::FILTER_CAMPAIGNS); + $this->assertContains($content['campaign'], ImportController::FILTER_CAMPAIGNS); $this->assertArrayHasKey('browser', $content); - $this->assertContains($content['browser'], ReportController::FILTER_PLATFORMS); + $this->assertContains($content['browser'], ImportController::FILTER_PLATFORMS); $this->assertArrayHasKey('platform', $content); - $this->assertContains($content['platform'], ReportController::FILTER_PLATFORMS); + $this->assertContains($content['platform'], ImportController::FILTER_PLATFORMS); $this->assertEquals($content['browser'], $content['platform']); $this->assertArrayHasKey('start_date', $content); $this->assertArrayHasKey('end_date', $content); @@ -119,10 +119,10 @@ public function testReportID(): void $this->assertIsInt($content['passes']); $this->assertArrayHasKey('failures', $content); $this->assertIsInt($content['failures']); - + $this->assertArrayHasKey('suites_data', $content); $this->assertIsArray($content['suites_data']); - foreach($content['suites_data'] as $suiteId => $suiteItem) { + foreach ($content['suites_data'] as $suiteId => $suiteItem) { $this->partialTestSuite($content['id'], $suiteId, $suiteItem, null, true); } } @@ -183,7 +183,7 @@ public function testCompareReportFilterState(): void foreach ($states as $stateRemoved) { $query = []; - foreach($states as $state) { + foreach ($states as $state) { if ($state === $stateRemoved) { continue; } @@ -216,7 +216,7 @@ public function testCompareSuite(): void $this->assertEquals($data, $content); } - private function partialTestSuite(int $executionId, int $id, array $item, ?int $idParent = null, ?bool $hasChildrenData = null): void + private function partialTestSuite(int $executionId, int $id, array $item, int $idParent = null, bool $hasChildrenData = null): void { $this->assertIsInt($id); @@ -260,7 +260,7 @@ private function partialTestSuite(int $executionId, int $id, array $item, ?int $ $this->assertArrayHasKey('suites', $item); $this->assertIsArray($item['suites']); $this->assertGreaterThan(0, count($item['suites'])); - foreach($item['suites'] as $suiteChildId => $suiteChild) { + foreach ($item['suites'] as $suiteChildId => $suiteChild) { $this->assertIsInt($suiteChildId); $this->partialTestSuite($executionId, $suiteChildId, $suiteChild, $id); } @@ -269,7 +269,7 @@ private function partialTestSuite(int $executionId, int $id, array $item, ?int $ $this->assertArrayHasKey('tests', $item); $this->assertIsArray($item['tests']); $this->assertGreaterThan(0, count($item['tests'])); - foreach($item['tests'] as $testItem) { + foreach ($item['tests'] as $testItem) { $this->partialTestTest($item['id'], $testItem); } } @@ -310,4 +310,4 @@ private function partialTestTest(int $suiteId, array $test): void $this->assertArrayHasKey('diff', $test); $this->assertArrayHasKey('insertion_date', $test); } -} \ No newline at end of file +} diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 3181151d..1e75e32d 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -2,12 +2,12 @@ use Symfony\Component\Dotenv\Dotenv; -require dirname(__DIR__).'/vendor/autoload.php'; +require dirname(__DIR__) . '/vendor/autoload.php'; -if (file_exists(dirname(__DIR__).'/config/bootstrap.php')) { - require dirname(__DIR__).'/config/bootstrap.php'; +if (file_exists(dirname(__DIR__) . '/config/bootstrap.php')) { + require dirname(__DIR__) . '/config/bootstrap.php'; } elseif (method_exists(Dotenv::class, 'bootEnv')) { - (new Dotenv())->bootEnv(dirname(__DIR__).'/.env'); + (new Dotenv())->bootEnv(dirname(__DIR__) . '/.env'); } if ($_SERVER['APP_DEBUG']) {