diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..e6e36d0 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,218 @@ + +version: 2.1 + +orbs: + codecov: 'codecov/codecov@3.0.0' + +.env_app: &env_app + SHELL: '/bin/bash' + +.env_composer: &env_composer + COMPOSER_NO_INTERACTION: '1' + COMPOSER_MEMORY_LIMIT: '-1' + COMPOSER_DISABLE_XDEBUG_WARN: '1' + COMPOSER_CACHE_DIR: '/home/circleci/.cache/composer' + +executors: + php_min: + resource_class: 'small' + environment: + <<: *env_app + <<: *env_composer + docker: + - + name: 'main' + image: 'cimg/php:7.2' + + php_plus1: + resource_class: 'small' + environment: + <<: *env_app + <<: *env_composer + docker: + - + name: 'main' + image: 'cimg/php:7.3' + + php_plus2: + resource_class: 'small' + environment: + <<: *env_app + <<: *env_composer + docker: + - + name: 'main' + image: 'cimg/php:7.4' + + php_plus3: + resource_class: 'small' + environment: + <<: *env_app + <<: *env_composer + docker: + - + name: 'main' + image: 'cimg/php:8.0' + + php_plus4: + resource_class: 'small' + environment: + <<: *env_app + <<: *env_composer + docker: + - + name: 'main' + image: 'cimg/php:8.1' + + php_plus5: + resource_class: 'small' + environment: + <<: *env_app + <<: *env_composer + docker: + - + name: 'main' + image: 'cimg/php:8.2' + + php_plus6: + resource_class: 'small' + environment: + <<: *env_app + <<: *env_composer + docker: + - + name: 'main' + image: 'cimg/php:8.3' + +commands: + install_php_extension_pcov: + description: 'Install PCOV PHP extension' + steps: + - + run: + name: 'Install PCOV PHP extension - pecl install pcov' + command: |- + if php -m | grep pcov ; then + exit 0 + fi + + sudo pecl install pcov + if php -m | grep pcov ; then + exit 0 + fi + + scanDir="$(php -i | grep --color=never --only-matching --perl-regexp '(?<=^Scan this dir for additional \.ini files => ).+')" + echo 'extension=pcov' | sudo tee "${scanDir}/pcov.ini" + php -m | grep pcov + + composer_install: + description: 'Install Composer dependencies with cache restore and save' + steps: + - + restore_cache: + name: 'Composer - cache restore' + keys: + - 'composer-{{ checksum "./composer.lock" }}-2' + + - + run: + name: 'Composer - install' + command: > + composer install --ansi --no-progress + + - + save_cache: + name: 'Composer - cache save' + key: 'composer-{{ checksum "./composer.lock" }}-2' + paths: + - '~/.cache/composer/' + + lint: + description: 'Run linters' + steps: + - + run: + name: 'Run composer validate' + command: |- + composer validate + - + run: + name: 'Run PHPCS' + command: |- + "$(composer config 'bin-dir')/phpcs" + + test: + description: 'Run tests' + parameters: + executor: + type: 'string' + steps: + - + run: + name: 'Test - Unit' + command: |- + mkdir -p '.cache' 'reports/human' 'reports/machine' + "$(composer config 'bin-dir')/phpunit" --testsuite='Unit' + - + when: + condition: + equal: ['<>', 'php_min'] + steps: + - + codecov/upload: + flags: 'unit' + file: './reports/machine/coverage.clover.xml' + - + store_test_results: + name: 'Store unit test results' + path: './reports/machine/result.junit.xml' + +jobs: + build: + executor: 'php_min' + steps: + - 'checkout' + - 'composer_install' + lint: + executor: 'php_min' + steps: + - 'checkout' + - 'composer_install' + - 'lint' + test: + parameters: + executor: + type: 'string' + executor: '<>' + steps: + - 'checkout' + - 'install_php_extension_pcov' + - 'composer_install' + - + test: + executor: '<>' + +workflows: + lint_and_test: + jobs: + - + build: {} + - + lint: + requires: + - 'build' + - + test: + name: 'test_<>' + requires: + - 'build' + matrix: + parameters: + executor: + - 'php_min' + - 'php_plus1' + - 'php_plus2' + - 'php_plus3' + - 'php_plus4' + - 'php_plus5' + - 'php_plus6' diff --git a/.coveralls.yml b/.coveralls.yml deleted file mode 100644 index 90cf2a6..0000000 --- a/.coveralls.yml +++ /dev/null @@ -1,3 +0,0 @@ -service_name: travis-ci -coverage_clover: build/logs/clover.xml -json_path: build/logs/coveralls-upload.json \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..0d0b894 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[*] +end_of_line = LF +indent_style = space +indent_size = 4 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[tests/fixtures/**] +indent_style = unset +indent_size = unset +trim_trailing_whitespace = false +insert_final_newline = false diff --git a/.gitignore b/.gitignore index d973270..de7157f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,20 @@ -.idea -vendor/ -coverage/ -composer.lock \ No newline at end of file +### Common places for toolings. +/.cache/ +/reports/ + + +### Composer. +/vendor/ +/mindscreen-yarnlock-*.tar +/mindscreen-yarnlock-*.tar.bz2 +/mindscreen-yarnlock-*.tar.gz +/mindscreen-yarnlock-*.tgz +/mindscreen-yarnlock-*.zip + + +### PHPCS. +/phpcs.xml + + +### PHPUnit. +/phpunit.xml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 49c8169..0000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: php -php: - - 5.6 - - 7.0 - - -install: - # Install composer packages - - travis_retry composer install --no-interaction --no-suggest - # Install coveralls.phar - - wget -c -nc --retry-connrefused --tries=0 https://github.com/php-coveralls/php-coveralls/releases/download/v2.0.0/php-coveralls.phar -O coveralls.phar - - chmod +x coveralls.phar - - php coveralls.phar --version - -# Create a storage folder for coverage report -before_script: - - mkdir -p build/logs - - ls -al - -script: - - ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml - -after_success: -# Submit coverage report to Coveralls servers, see .coveralls.yml - - travis_retry php coveralls.phar -v -# Submit coverage report to codecov.io - - bash <(curl -s https://codecov.io/bash) - -branches: - only: master \ No newline at end of file diff --git a/readme.md b/README.md similarity index 82% rename from readme.md rename to README.md index 74e9874..7051332 100644 --- a/readme.md +++ b/README.md @@ -1,8 +1,9 @@ -[![Build Status](https://travis-ci.org/mindscreen/yarnlock.svg?branch=master)](https://travis-ci.org/mindscreen/yarnlock) -[![Coverage Status](https://coveralls.io/repos/github/mindscreen/yarnlock/badge.svg?branch=master)](https://coveralls.io/github/mindscreen/yarnlock?branch=master) - # Mindscreen\YarnLock +[![CircleCI](https://circleci.com/gh/mindscreen/yarnlock/tree/master.svg?style=svg)](https://circleci.com/gh/mindscreen/yarnlock/?branch=master) +[![codecov](https://codecov.io/gh/mindscreen/yarnlock/branch/master/graph/badge.svg?token=HSF16OGPyr)](https://app.codecov.io/gh/mindscreen/yarnlock/branch/master) + + A php-package for parsing and evaluating the [yarn.lock](https://yarnpkg.com/lang/en/docs/yarn-lock/) format. ## Basic Usage @@ -35,4 +36,4 @@ $yarnLock->calculateDepth($rootDependencies); // get the first two levels; the second argument is the exclusive upper limit $yarnLock->getPackagesByDepth(0, 2); -``` \ No newline at end of file +``` diff --git a/composer.json b/composer.json index 313f413..ae66356 100644 --- a/composer.json +++ b/composer.json @@ -9,16 +9,42 @@ "email": "matthias.klatte@mindscreen.de" } ], - "scripts": { - "test": "phpunit tests" + "config": { + "platform": { + "php": "7.2" + }, + "optimize-autoloader": true, + "sort-packages": true + }, + "require": { + "php": ">=7.2", + "ext-ctype": "*" + }, + "require-dev": { + "phpunit/phpunit": "^8.5", + "squizlabs/php_codesniffer": "^3.9" }, - "require": {}, "autoload": { "psr-4": { "Mindscreen\\YarnLock\\": "src/" } }, - "require-dev": { - "phpunit/phpunit": "^5" + "autoload-dev": { + "psr-4": { + "Mindscreen\\YarnLock\\Tests\\": "tests/src/" + } + }, + "scripts": { + "lint": [ + "@lint:composer-validate", + "@lint:phpcs" + ], + "lint:composer-validate": "\"${COMPOSER_BINARY}\" validate", + "lint:phpcs": "phpcs", + "test": [ + "mkdir -p '.cache' 'reports/human' 'reports/machine'", + "@test:phpunit" + ], + "test:phpunit": "phpunit" } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..cc9bb0e --- /dev/null +++ b/composer.lock @@ -0,0 +1,1519 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "3fcb13280e03896a6bd6c1c73d3760d8", + "packages": [], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9 || ^11", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.30 || ^5.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2022-12-30T00:15:36+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.11.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2023-03-08T13:26:56+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.3" + }, + "time": "2021-07-20T11:28:43+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "7.0.15", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "819f92bba8b001d4363065928088de22f25a3a48" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/819f92bba8b001d4363065928088de22f25a3a48", + "reference": "819f92bba8b001d4363065928088de22f25a3a48", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": ">=7.2", + "phpunit/php-file-iterator": "^2.0.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.1.3 || ^4.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^4.2.2", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1.3" + }, + "require-dev": { + "phpunit/phpunit": "^8.2.2" + }, + "suggest": { + "ext-xdebug": "^2.7.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/7.0.15" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-07-26T12:20:09+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:42:26+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" + }, + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "2.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:20:02+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "3.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "9c1da83261628cb24b6a6df371b6e312b3954768" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9c1da83261628cb24b6a6df371b6e312b3954768", + "reference": "9c1da83261628cb24b6a6df371b6e312b3954768", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", + "source": "https://github.com/sebastianbergmann/php-token-stream/tree/3.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "abandoned": true, + "time": "2021-07-26T12:15:06+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "8.5.36", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "9652df58e06a681429d8cfdaec3c43d6de581d5a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9652df58e06a681429d8cfdaec3c43d6de581d5a", + "reference": "9652df58e06a681429d8cfdaec3c43d6de581d5a", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.3.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.0", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.2", + "phpunit/php-code-coverage": "^7.0.12", + "phpunit/php-file-iterator": "^2.0.4", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.1.2", + "sebastian/comparator": "^3.0.5", + "sebastian/diff": "^3.0.2", + "sebastian/environment": "^4.2.3", + "sebastian/exporter": "^3.1.5", + "sebastian/global-state": "^3.0.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0.1", + "sebastian/type": "^1.1.3", + "sebastian/version": "^2.0.1" + }, + "suggest": { + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage", + "phpunit/php-invoker": "To allow enforcing time limits" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "8.5-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.36" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" + } + ], + "time": "2023-12-01T16:52:15+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:15:22+00:00" + }, + { + "name": "sebastian/comparator", + "version": "3.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "1dc7ceb4a24aede938c7af2a9ed1de09609ca770" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dc7ceb4a24aede938c7af2a9ed1de09609ca770", + "reference": "1dc7ceb4a24aede938c7af2a9ed1de09609ca770", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T12:31:48+00:00" + }, + { + "name": "sebastian/diff", + "version": "3.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "6296a0c086dd0117c1b78b059374d7fcbe7545ae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/6296a0c086dd0117c1b78b059374d7fcbe7545ae", + "reference": "6296a0c086dd0117c1b78b059374d7fcbe7545ae", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "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": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/3.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-05-07T05:30:20+00:00" + }, + { + "name": "sebastian/environment", + "version": "4.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/4.2.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:53:42+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "73a9676f2833b9a7c36968f9d882589cd75511e6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/73a9676f2833b9a7c36968f9d882589cd75511e6", + "reference": "73a9676f2833b9a7c36968f9d882589cd75511e6", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^8.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T06:00:17+00:00" + }, + { + "name": "sebastian/global-state", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "66783ce213de415b451b904bfef9dda0cf9aeae0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/66783ce213de415b451b904bfef9dda0cf9aeae0", + "reference": "66783ce213de415b451b904bfef9dda0cf9aeae0", + "shasum": "" + }, + "require": { + "php": ">=7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^8.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-08-02T09:23:32+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:40:27+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:37:18+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:34:24+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:30:19+00:00" + }, + { + "name": "sebastian/type", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/0150cfbc4495ed2df3872fb31b26781e4e077eb4", + "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/1.1.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:25:11+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/master" + }, + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.9.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/d63cee4890a8afaf86a22e51ad4d97c91dd4579b", + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + }, + "bin": [ + "bin/phpcbf", + "bin/phpcs" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-02-16T15:06:51+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.2" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2023-11-20T00:12:19+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=7.2", + "ext-ctype": "*" + }, + "platform-dev": [], + "platform-overrides": { + "php": "7.2" + }, + "plugin-api-version": "2.6.0" +} diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 0000000..b4d3501 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,11 @@ + + + + ./src/ + ./tests/src/ + + + diff --git a/phpunit.xml b/phpunit.xml deleted file mode 100644 index 5a88db9..0000000 --- a/phpunit.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - ./tests/ - - - - - - ./src/ - - - \ No newline at end of file diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..b6bd97a --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,34 @@ + + + + + + tests/src/Unit/ + + + + + + ./src/ + + + + + + + + + + + + diff --git a/src/Package.php b/src/Package.php index dd28001..d5089fd 100644 --- a/src/Package.php +++ b/src/Package.php @@ -59,7 +59,7 @@ class Package * * @var Package[] */ - protected $resolves; + protected $resolves = []; /** * Depth in the dependency tree. Only initialized once the YarnLock computes @@ -265,4 +265,4 @@ public function __toString() { return $this->getName() . '@' . $this->getVersion(); } -} \ No newline at end of file +} diff --git a/src/Parser.php b/src/Parser.php index c6bd6de..43294c2 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -50,10 +50,17 @@ public function parse($input, $assoc = false) $indentationDepth = $i; } else { if ($i % $indentationDepth !== 0) { - throw new ParserException(sprintf('Indentation depth is not constant at line %s', $l), 1519140379); + throw new ParserException( + sprintf('Indentation depth is not constant at line %s', $l), + 1519140379 + ); } + if ($i / $indentationDepth > $indentationLevel) { - throw new ParserException(sprintf('Unexpected indentation at line %s', $l), 1519140493); + throw new ParserException( + sprintf('Unexpected indentation at line %s', $l), + 1519140493 + ); } } $newIndentationLevel = $i / $indentationDepth; @@ -165,7 +172,9 @@ protected static function convertObjectToArray($object) * If parts of keys contain spaces, they are surrounded with quotes, * e.g. `minimatch@^3.0.0, minimatch@^3.0.2, "minimatch@2 || 3"`, which would * fail when simply splitting on spaces. + * * @param string $key + * * @return string[] */ public static function parseVersionStrings($key) @@ -197,8 +206,13 @@ public static function parseVersionStrings($key) $result[] = $currentKey; } } - $result = array_map(function($e) { return trim($e); }, $result); - return $result; + + return array_map( + function ($e) { + return trim($e); + }, + $result + ); } /** @@ -206,6 +220,7 @@ public static function parseVersionStrings($key) * package name. * * @param string $versionString + * * @return string[] */ public static function splitVersionString($versionString) @@ -217,4 +232,4 @@ public static function splitVersionString($versionString) $version ]; } -} \ No newline at end of file +} diff --git a/src/YarnLock.php b/src/YarnLock.php index 25ca7e5..2ee0be0 100644 --- a/src/YarnLock.php +++ b/src/YarnLock.php @@ -1,6 +1,6 @@ $dependencyInformation) { $packageVersionStrings = Parser::parseVersionStrings($packageVersions); $packageName = Parser::splitVersionString($packageVersionStrings[0])[0]; @@ -64,14 +65,14 @@ protected static function evaluatePackages($data) $allPackages[] = $package; } - foreach ($packageVersionMap as $packageName => $versions) { - foreach ($versions as $version => $packageInformation) { + foreach ($packageVersionMap as $versions) { + foreach ($versions as $packageInformation) { /** @var Package $package */ $package = $packageInformation['package']; - if (isset($package->__handled)) { + if (!empty($handledPackages[spl_object_id($package)])) { continue; } - $package->__handled = true; + $handledPackages[spl_object_id($package)] = true; $data = $packageInformation['data']; foreach ([ Package::DEPENDENCY_TYPE_DEFAULT, @@ -94,6 +95,7 @@ protected static function evaluatePackages($data) /** * Get all packages resolved in this lock file + * * @return Package[] */ public function getPackages() @@ -113,13 +115,19 @@ public function setPackages($packages) * A package might be required in multiple versions. * * @param string $packageName + * * @return Package[] */ public function getPackagesByName($packageName) { - return array_values(array_filter($this->packages, function(Package $package) use ($packageName) { - return $package->getName() === $packageName; - })); + return array_values( + array_filter( + $this->packages, + function (Package $package) use ($packageName) { + return $package->getName() === $packageName; + } + ) + ); } /** @@ -129,21 +137,31 @@ public function getPackagesByName($packageName) * * @param int $start * @param int $end + * * @return Package[] */ public function getPackagesByDepth($start, $end = 0) { + $this->calculateDepth(); if ($end === 0 || ($end !== null && $end < $start)) { $end = $start + 1; } - return array_values(array_filter($this->packages, function(Package $package) use ($start, $end) { - $depth = $package->getDepth(); - if ($depth === null) { - return $end === null; - } - $to = $end === null ? true : $depth < $end; - return $depth >= $start && $to; - })); + + return array_values( + array_filter( + $this->packages, + function (Package $package) use ($start, $end) { + $depth = $package->getDepth(); + if ($depth === null) { + return $end === null; + } + + $to = $end === null || ($depth < $end); + + return $depth >= $start && $to; + } + ) + ); } /** @@ -154,9 +172,14 @@ public function getPackagesByDepth($start, $end = 0) public function getDepth() { $this->calculateDepth(); - return array_reduce($this->packages, function($d, Package $package) { - return max($d, $package->getDepth()); - }, 0) + 1; + + return 1 + array_reduce( + $this->packages, + function ($d, Package $package) { + return max($d, $package->getDepth()); + }, + 0 + ); } /** @@ -168,6 +191,7 @@ public function getDepth() * * @param string $name * @param string $version + * * @return Package|null */ public function getPackage($name, $version = null) @@ -195,6 +219,7 @@ public function getPackage($name, $version = null) * * @param string $name * @param string $version + * * @return bool */ public function hasPackage($name, $version = null) @@ -215,9 +240,14 @@ public function calculateDepth(array $root = null) return; } if ($root === null) { - $root = array_values(array_filter($this->packages, function(Package $p) { - return count($p->getResolves()) === 0; - })); + $root = array_values( + array_filter( + $this->packages, + function (Package $p) { + return count($p->getResolves()) === 0; + } + ) + ); } /** @var Package $rootNode */ foreach ($root as $rootNode) { @@ -230,7 +260,8 @@ public function calculateDepth(array $root = null) * @param Package $node * @param int $depth */ - protected function calculateChildDepth(Package $node, $depth) { + protected function calculateChildDepth(Package $node, $depth) + { if ($node->getDepth() !== null && $node->getDepth() <= $depth) { return; } @@ -239,4 +270,4 @@ protected function calculateChildDepth(Package $node, $depth) { $this->calculateChildDepth($dependency, $depth + 1); } } -} \ No newline at end of file +} diff --git a/tests/parserinput/comments b/tests/fixtures/comments.txt similarity index 100% rename from tests/parserinput/comments rename to tests/fixtures/comments.txt diff --git a/tests/parserinput/datatypes b/tests/fixtures/datatypes.txt similarity index 100% rename from tests/parserinput/datatypes rename to tests/fixtures/datatypes.txt diff --git a/tests/parserinput/deep b/tests/fixtures/deep.txt similarity index 100% rename from tests/parserinput/deep rename to tests/fixtures/deep.txt diff --git a/tests/parserinput/example-yarn-package.lock b/tests/fixtures/example-yarn-package.txt similarity index 100% rename from tests/parserinput/example-yarn-package.lock rename to tests/fixtures/example-yarn-package.txt diff --git a/tests/parserinput/indentation_depth b/tests/fixtures/indentation_depth.txt similarity index 100% rename from tests/parserinput/indentation_depth rename to tests/fixtures/indentation_depth.txt diff --git a/tests/parserinput/missing_property b/tests/fixtures/missing_property.txt similarity index 100% rename from tests/parserinput/missing_property rename to tests/fixtures/missing_property.txt diff --git a/tests/parserinput/missing_property2 b/tests/fixtures/missing_property2.txt similarity index 100% rename from tests/parserinput/missing_property2 rename to tests/fixtures/missing_property2.txt diff --git a/tests/parserinput/missing_property_eof b/tests/fixtures/missing_property_eof.txt similarity index 100% rename from tests/parserinput/missing_property_eof rename to tests/fixtures/missing_property_eof.txt diff --git a/tests/parserinput/mixed_indentation b/tests/fixtures/mixed_indentation.txt similarity index 100% rename from tests/parserinput/mixed_indentation rename to tests/fixtures/mixed_indentation.txt diff --git a/tests/parserinput/mixed_indentation_depth b/tests/fixtures/mixed_indentation_depth.txt similarity index 100% rename from tests/parserinput/mixed_indentation_depth rename to tests/fixtures/mixed_indentation_depth.txt diff --git a/tests/parserinput/quoted-key b/tests/fixtures/quoted-key.txt similarity index 100% rename from tests/parserinput/quoted-key rename to tests/fixtures/quoted-key.txt diff --git a/tests/parserinput/unexpected_indentation b/tests/fixtures/unexpected_indentation.txt similarity index 100% rename from tests/parserinput/unexpected_indentation rename to tests/fixtures/unexpected_indentation.txt diff --git a/tests/parserinput/valid_input b/tests/fixtures/valid_input.txt similarity index 100% rename from tests/parserinput/valid_input rename to tests/fixtures/valid_input.txt diff --git a/tests/PackageTest.php b/tests/src/Unit/PackageTest.php similarity index 57% rename from tests/PackageTest.php rename to tests/src/Unit/PackageTest.php index 2c7f5c5..85baf93 100644 --- a/tests/PackageTest.php +++ b/tests/src/Unit/PackageTest.php @@ -1,10 +1,16 @@ setName('package1'); $package1->setVersion('1.0.1'); @@ -17,7 +23,7 @@ public function testAvoidDuplicates() { $package1->addDependency($package2); $package2->addResolves($package1); - $this->assertEquals(1, count($package1->getDependencies())); - $this->assertEquals(1, count($package2->getResolves())); + static::assertSame(1, count($package1->getDependencies())); + static::assertSame(1, count($package2->getResolves())); } } diff --git a/tests/ParserTest.php b/tests/src/Unit/ParserTest.php similarity index 60% rename from tests/ParserTest.php rename to tests/src/Unit/ParserTest.php index 1bd7a50..b857699 100644 --- a/tests/ParserTest.php +++ b/tests/src/Unit/ParserTest.php @@ -1,10 +1,14 @@ parser = new Parser(); } /** - * Not using valid input should throw an exception + * Not using valid input should throw an exception. + * * @throws ParserException */ public function testNullInput() { - $this->expectException(InvalidArgumentException::class); + $this->expectException(\InvalidArgumentException::class); $this->expectExceptionCode(1519142104); $this->parser->parse(null); } @@ -34,16 +40,19 @@ public function testNullInput() */ public function testComments() { - $fileContents = file_get_contents('tests/parserinput/comments'); + $fileContents = static::getInput('comments.txt'); $result = $this->parser->parse($fileContents, true); - $this->assertEquals([ - 'foo' => 4, - 'bar' => [ - 'foo' => false, - 'baz' => null, + static::assertSame( + [ + 'foo' => 4, + 'bar' => [ + 'foo' => false, + 'baz' => null, + ], + 'baz' => true, ], - 'baz' => true, - ], $result); + $result + ); } /** @@ -54,7 +63,7 @@ public function testMixedIndentations() { $this->expectException(ParserException::class); $this->expectExceptionCode(1519140104); - $fileContents = file_get_contents('tests/parserinput/mixed_indentation'); + $fileContents = static::getInput('mixed_indentation.txt'); $this->parser->parse($fileContents, true); } @@ -66,7 +75,7 @@ public function testMixedIndentationDepth() { $this->expectException(ParserException::class); $this->expectExceptionCode(1519140379); - $fileContents = file_get_contents('tests/parserinput/mixed_indentation_depth'); + $fileContents = static::getInput('mixed_indentation_depth.txt'); $this->parser->parse($fileContents, true); } @@ -76,16 +85,19 @@ public function testMixedIndentationDepth() */ public function testDifferentIndentationDepth() { - $fileContents = file_get_contents('tests/parserinput/indentation_depth'); + $fileContents = static::getInput('indentation_depth.txt'); $result = $this->parser->parse($fileContents, true); - $this->assertEquals([ - 'foo' => [ - 'bar' => 'bar', - 'baz' => [ - 'foobar' => true - ] - ] - ], $result); + static::assertSame( + [ + 'foo' => [ + 'bar' => 'bar', + 'baz' => [ + 'foobar' => true, + ], + ], + ], + $result + ); } /** @@ -96,7 +108,7 @@ public function testUnexpectedIndentation() { $this->expectException(ParserException::class); $this->expectExceptionCode(1519140493); - $fileContents = file_get_contents('tests/parserinput/unexpected_indentation'); + $fileContents = static::getInput('unexpected_indentation.txt'); $this->parser->parse($fileContents, true); } @@ -108,7 +120,7 @@ public function testMissingProperty() { $this->expectException(ParserException::class); $this->expectExceptionCode(1519142311); - $fileContents = file_get_contents('tests/parserinput/missing_property'); + $fileContents = static::getInput('missing_property.txt'); $this->parser->parse($fileContents, true); } @@ -120,7 +132,7 @@ public function testMissingProperty2() { $this->expectException(ParserException::class); $this->expectExceptionCode(1519142311); - $fileContents = file_get_contents('tests/parserinput/missing_property2'); + $fileContents = static::getInput('missing_property2.txt'); $this->parser->parse($fileContents, true); } @@ -132,7 +144,7 @@ public function testMissingPropertyEof() { $this->expectException(ParserException::class); $this->expectExceptionCode(1519142311); - $fileContents = file_get_contents('tests/parserinput/missing_property_eof'); + $fileContents = static::getInput('missing_property_eof.txt'); $this->parser->parse($fileContents, true); } @@ -153,16 +165,16 @@ public function testMissingPropertyValue() */ public function testDataTypes() { - $fileContents = file_get_contents('tests/parserinput/datatypes'); + $fileContents = static::getInput('datatypes.txt'); $result = $this->parser->parse($fileContents); - $this->assertSame(true, $result->bool_t); - $this->assertSame(false, $result->bool_f); - $this->assertSame(null, $result->unset); - $this->assertSame(42, $result->int); - $this->assertSame(13.37, $result->float); - $this->assertSame('true', $result->string_t); - $this->assertSame('string string', $result->string); - $this->assertSame('12.13.14', $result->other); + static::assertSame(true, $result->bool_t); + static::assertSame(false, $result->bool_f); + static::assertSame(null, $result->unset); + static::assertSame(42, $result->int); + static::assertSame(13.37, $result->float); + static::assertSame('true', $result->string_t); + static::assertSame('string string', $result->string); + static::assertSame('12.13.14', $result->other); } /** @@ -171,18 +183,18 @@ public function testDataTypes() */ public function testYarnExampleObject() { - $fileContents = file_get_contents('tests/parserinput/valid_input'); + $fileContents = static::getInput('valid_input.txt'); $result = $this->parser->parse($fileContents); - $this->assertEquals(true, $result instanceof \stdClass); - $this->assertEquals(4, count(get_object_vars($result))); - $this->assertObjectHasAttribute('package-1@^1.0.0', $result); + static::assertSame(true, $result instanceof \stdClass); + static::assertSame(4, count(get_object_vars($result))); + static::assertObjectHasAttribute('package-1@^1.0.0', $result); $key = 'package-3@^3.0.0'; $package3 = $result->$key; - $this->assertObjectHasAttribute('version', $package3); - $this->assertObjectHasAttribute('resolved', $package3); - $this->assertObjectHasAttribute('dependencies', $package3); + static::assertObjectHasAttribute('version', $package3); + static::assertObjectHasAttribute('resolved', $package3); + static::assertObjectHasAttribute('dependencies', $package3); $package3_dependencies = $package3->dependencies; - $this->assertEquals(1, count(get_object_vars($package3_dependencies))); + static::assertSame(1, count(get_object_vars($package3_dependencies))); } /** @@ -191,18 +203,18 @@ public function testYarnExampleObject() */ public function testYarnExampleArray() { - $fileContents = file_get_contents('tests/parserinput/valid_input'); + $fileContents = static::getInput('valid_input.txt'); $result = $this->parser->parse($fileContents, true); - $this->assertEquals(true, is_array($result)); - $this->assertEquals(4, count($result)); - $this->assertArrayHasKey('package-1@^1.0.0', $result); + static::assertSame(true, is_array($result)); + static::assertSame(4, count($result)); + static::assertArrayHasKey('package-1@^1.0.0', $result); $package3 = $result['package-3@^3.0.0']; - $this->assertArrayHasKey('version', $package3); - $this->assertArrayHasKey('resolved', $package3); - $this->assertArrayHasKey('dependencies', $package3); + static::assertArrayHasKey('version', $package3); + static::assertArrayHasKey('resolved', $package3); + static::assertArrayHasKey('dependencies', $package3); $package3_dependencies = $package3['dependencies']; - $this->assertEquals(true, is_array($package3_dependencies)); - $this->assertEquals(1, count($package3_dependencies)); + static::assertSame(true, is_array($package3_dependencies)); + static::assertSame(1, count($package3_dependencies)); } /** @@ -210,12 +222,12 @@ public function testYarnExampleArray() */ public function testVersionSplitting() { - $this->assertEquals( + static::assertSame( ['gulp-sourcemaps', '2.6.4'], Parser::splitVersionString('gulp-sourcemaps@2.6.4') ); - $this->assertEquals( + static::assertSame( ['@gulp-sourcemaps/identity-map', '1.X'], Parser::splitVersionString('@gulp-sourcemaps/identity-map@1.X') ); @@ -227,12 +239,12 @@ public function testVersionSplitting() */ public function testQuotedKeys() { - $fileContents = file_get_contents('tests/parserinput/quoted-key'); + $fileContents = static::getInput('quoted-key.txt'); $result = $this->parser->parse($fileContents, true); $data = $result['test']; foreach (['foo', 'bar', 'foo bar', 'foobar'] as $item) { - $this->assertArrayHasKey($item, $data); - $this->assertEquals($item, $data[$item]); + static::assertArrayHasKey($item, $data); + static::assertSame($item, $data[$item]); } } @@ -240,22 +252,22 @@ public function testParseVersionStrings() { $input = 'minimatch@^3.0.0, minimatch@^3.0.2, "minimatch@2 || 3"'; $versionStrings = Parser::parseVersionStrings($input); - $this->assertEquals(['minimatch@^3.0.0', 'minimatch@^3.0.2', 'minimatch@2 || 3'], $versionStrings); + static::assertSame(['minimatch@^3.0.0', 'minimatch@^3.0.2', 'minimatch@2 || 3'], $versionStrings); $input = 'babel-types@^6.10.2, babel-types@^6.14.0, babel-types@^6.15.0'; $versionStrings = Parser::parseVersionStrings($input); - $this->assertEquals(['babel-types@^6.10.2', 'babel-types@^6.14.0', 'babel-types@^6.15.0'], $versionStrings); + static::assertSame(['babel-types@^6.10.2', 'babel-types@^6.14.0', 'babel-types@^6.15.0'], $versionStrings); $input = 'array-uniq@^1.0.1'; $versionStrings = Parser::parseVersionStrings($input); - $this->assertEquals(['array-uniq@^1.0.1'], $versionStrings); + static::assertSame(['array-uniq@^1.0.1'], $versionStrings); $input = '"cssom@>= 0.3.0 < 0.4.0", cssom@0.3.x'; $versionStrings = Parser::parseVersionStrings($input); - $this->assertEquals(['cssom@>= 0.3.0 < 0.4.0', 'cssom@0.3.x'], $versionStrings); + static::assertSame(['cssom@>= 0.3.0 < 0.4.0', 'cssom@0.3.x'], $versionStrings); $input = '"graceful-readlink@>= 1.0.0"'; $versionStrings = Parser::parseVersionStrings($input); - $this->assertEquals(['graceful-readlink@>= 1.0.0'], $versionStrings); + static::assertSame(['graceful-readlink@>= 1.0.0'], $versionStrings); } } diff --git a/tests/src/Unit/TestBase.php b/tests/src/Unit/TestBase.php new file mode 100644 index 0000000..36c41aa --- /dev/null +++ b/tests/src/Unit/TestBase.php @@ -0,0 +1,34 @@ +expectException(InvalidArgumentException::class); + $this->expectException(\InvalidArgumentException::class); $this->expectExceptionCode(1519201965); YarnLock::fromString(null); } - protected function setUp() + protected function setUp(): void { - $yarnLockContents = file_get_contents('tests/parserinput/example-yarn-package.lock'); + $yarnLockContents = static::getInput('example-yarn-package.txt'); $this->yarnLock = YarnLock::fromString($yarnLockContents); } @@ -35,12 +38,12 @@ protected function setUp() public function testPackageExists() { // babel-core@^6.0.0, babel-core@^6.11.4, babel-core@^6.14.0: - $this->assertTrue($this->yarnLock->hasPackage('babel-core')); - $this->assertTrue($this->yarnLock->hasPackage('babel-core', '^6.0.0')); - $this->assertTrue($this->yarnLock->hasPackage('babel-core', '^6.11.4')); - $this->assertTrue($this->yarnLock->hasPackage('babel-core', '^6.14.0')); - $this->assertTrue($this->yarnLock->hasPackage('babel-core', '6.14.0')); - $this->assertFalse($this->yarnLock->hasPackage('babel-core', '6.15.0')); + static::assertTrue($this->yarnLock->hasPackage('babel-core')); + static::assertTrue($this->yarnLock->hasPackage('babel-core', '^6.0.0')); + static::assertTrue($this->yarnLock->hasPackage('babel-core', '^6.11.4')); + static::assertTrue($this->yarnLock->hasPackage('babel-core', '^6.14.0')); + static::assertTrue($this->yarnLock->hasPackage('babel-core', '6.14.0')); + static::assertFalse($this->yarnLock->hasPackage('babel-core', '6.15.0')); } /** @@ -51,17 +54,17 @@ public function testGetPackage() { $packageName = 'babel-core'; $package = $this->yarnLock->getPackage($packageName); - $this->assertEquals($packageName, $package->getName()); + static::assertSame($packageName, $package->getName()); $packageVersion = '6.14.0'; $package = $this->yarnLock->getPackage($packageName, $packageVersion); - $this->assertEquals($packageVersion, $package->getVersion()); + static::assertSame($packageVersion, $package->getVersion()); $package = $this->yarnLock->getPackage($packageName, '^6.11.4'); - $this->assertEquals($packageVersion, $package->getVersion()); + static::assertSame($packageVersion, $package->getVersion()); $package = $this->yarnLock->getPackage('foo'); - $this->assertNull($package); + static::assertNull($package); } /** @@ -69,7 +72,7 @@ public function testGetPackage() */ public function testDepth() { - $this->assertEquals(10, $this->yarnLock->getDepth()); + static::assertSame(10, $this->yarnLock->getDepth()); } /** @@ -79,7 +82,14 @@ public function testDepth() */ protected function getPackageStrings(array $packages) { - return array_values(array_map(function(Package $p) { return $p->__toString(); }, $packages)); + return array_values( + array_map( + function (Package $p) { + return $p->__toString(); + }, + $packages + ) + ); } /** @@ -93,20 +103,19 @@ public function testGetPackagesByDepth() ]; $this->yarnLock->calculateDepth($rootPackages); $depth0 = $this->yarnLock->getPackagesByDepth(0); - $this->assertEquals(count($rootPackages), count($depth0)); + static::assertSame(count($rootPackages), count($depth0)); $depth1 = $this->yarnLock->getPackagesByDepth(1); $depth2 = $this->yarnLock->getPackagesByDepth(2); $depth12 = $this->yarnLock->getPackagesByDepth(1, 3); - $this->assertEquals(count($depth1) + count($depth2), count($depth12)); + static::assertSame(count($depth1) + count($depth2), count($depth12)); // should not be calculated again $this->yarnLock->calculateDepth(); $depthStart = $this->yarnLock->getPackagesByDepth(0, 2); $depthRest = $this->yarnLock->getPackagesByDepth(2, null); - var_dump(count($depthRest)); $allPackages = $this->yarnLock->getPackages(); - $this->assertEquals(count($allPackages), count($depthStart) + count($depthRest)); + static::assertSame(count($allPackages), count($depthStart) + count($depthRest)); } /** @@ -115,16 +124,21 @@ public function testGetPackagesByDepth() public function testGetPackagesByName() { $packages = $this->yarnLock->getPackagesByName('source-map'); - $this->assertEquals(4, count($packages)); + static::assertSame(4, count($packages)); $expectedVersions = [ ['^0.4.4'], ['^0.5.0', '^0.5.3', '~0.5.1'], ['~0.2.0'], ['0.1.32'], ]; - $versions = array_map(function(Package $p) { return $p->getSatisfiedVersions(); }, $packages); + $versions = array_map( + function (Package $p) { + return $p->getSatisfiedVersions(); + }, + $packages + ); $versions = array_values($versions); - $this->assertEquals($expectedVersions, $versions); + static::assertSame($expectedVersions, $versions); } /** @@ -133,7 +147,7 @@ public function testGetPackagesByName() public function testPackageString() { foreach ($this->yarnLock->getPackages() as $package) { - $this->assertEquals($package->getName() . '@' . $package->getVersion(), $package->__toString()); + static::assertSame($package->getName() . '@' . $package->getVersion(), $package->__toString()); } } @@ -143,14 +157,14 @@ public function testPackageString() public function testResolvedSet() { foreach ($this->yarnLock->getPackages() as $package) { - $this->assertNotEmpty($package->getResolved()); + static::assertNotEmpty($package->getResolved()); } } public function testYarnExample() { - $yarnLockContents = file_get_contents('tests/parserinput/deep'); + $yarnLockContents = static::getInput('deep.txt'); $yarnLock = YarnLock::fromString($yarnLockContents); - $this->assertEquals(4, count($yarnLock->getPackages())); + static::assertSame(4, count($yarnLock->getPackages())); } }