diff --git a/.appveyor.yml b/.appveyor.yml index 8b529e45537..92006505103 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -4,7 +4,7 @@ clone_folder: C:\projects\yii2 environment: matrix: - - php_ver: 7.2.4 + - php_ver: 7.3.0 cache: - '%APPDATA%\Composer' @@ -30,7 +30,7 @@ install: - echo extension=php_mbstring.dll >> php.ini - echo extension=php_openssl.dll >> php.ini - echo extension=php_pdo_sqlite.dll >> php.ini - - IF NOT EXIST C:\tools\composer.phar (cd C:\tools && appveyor DownloadFile https://getcomposer.org/download/1.4.1/composer.phar) + - IF NOT EXIST C:\tools\composer.phar (cd C:\tools && appveyor DownloadFile https://getcomposer.org/download/2.6.3/composer.phar) before_test: - cd C:\projects\yii2 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 30b988edb4f..84003c493bf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,32 +21,8 @@ jobs: fail-fast: false matrix: include: - - php: 5.4 - coverage: none - extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached - os: ubuntu-latest - - php: 5.5 - coverage: none - extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached - os: ubuntu-latest - - php: 5.6 - coverage: none - extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached - os: ubuntu-latest - - php: 7.0 - coverage: none - extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached - os: ubuntu-latest - - php: 7.1 - coverage: none - extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached - os: ubuntu-latest - - php: 7.2 - coverage: none - extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached - os: ubuntu-latest - php: 7.3 - coverage: none + coverage: xdebug extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached os: ubuntu-latest - php: 7.4 @@ -65,6 +41,10 @@ jobs: extensions: apcu, curl, dom, imagick, intl, mbstring, mcrypt, memcached coverage: none os: ubuntu-latest + - php: 8.3 + extensions: apcu, curl, dom, imagick, intl, mbstring, mcrypt, memcached + coverage: none + os: ubuntu-latest steps: - name: Generate french locale. diff --git a/.github/workflows/ci-mssql.yml b/.github/workflows/ci-mssql.yml index 94255d93ebe..0df2a6b70b0 100644 --- a/.github/workflows/ci-mssql.yml +++ b/.github/workflows/ci-mssql.yml @@ -29,6 +29,8 @@ jobs: mssql: server:2019-latest - php: 8.2 mssql: server:2022-latest + - php: 8.3 + mssql: server:2022-latest services: mssql: diff --git a/.github/workflows/ci-mysql.yml b/.github/workflows/ci-mysql.yml index a948a9e4cae..28e33b92e52 100644 --- a/.github/workflows/ci-mysql.yml +++ b/.github/workflows/ci-mysql.yml @@ -27,6 +27,7 @@ jobs: - 8.0 - 8.1 - 8.2 + - 8.3 mysql: - 5.7 diff --git a/.github/workflows/ci-pgsql.yml b/.github/workflows/ci-pgsql.yml index edaf4a5df5d..e41a01c3f88 100644 --- a/.github/workflows/ci-pgsql.yml +++ b/.github/workflows/ci-pgsql.yml @@ -26,6 +26,7 @@ jobs: - 7.4 - 8.0 - 8.1 + - 8.3 pgsql: - 10 @@ -34,6 +35,7 @@ jobs: - 13 - 14 - 15 + - 16 services: postgres: diff --git a/.github/workflows/ci-sqlite.yml b/.github/workflows/ci-sqlite.yml index b82d187ef9a..07c6057416c 100644 --- a/.github/workflows/ci-sqlite.yml +++ b/.github/workflows/ci-sqlite.yml @@ -28,6 +28,7 @@ jobs: - 8.0 - 8.1 - 8.2 + - 8.3 steps: - name: Checkout. diff --git a/composer.json b/composer.json index ed19e7cce4c..060448ef611 100644 --- a/composer.json +++ b/composer.json @@ -68,7 +68,7 @@ "yiisoft/yii2": "self.version" }, "require": { - "php": ">=5.4.0", + "php": ">=7.3.0", "ext-mbstring": "*", "ext-ctype": "*", "lib-pcre": "*", @@ -82,11 +82,10 @@ "paragonie/random_compat": ">=1" }, "require-dev": { - "cweagans/composer-patches": "^1.7", - "phpunit/phpunit": "4.8.34", + "dms/phpunit-arraysubset-asserts": "^0.5", + "phpunit/phpunit": "^9.6.0", "cebe/indent": "~1.0.2", - "friendsofphp/php-cs-fixer": "~2.2.3 | ^3.0", - "johnkary/phpunit-speedtrap": "^1.0" + "friendsofphp/php-cs-fixer": "~2.2.3 | ^3.0" }, "repositories": [ { @@ -111,7 +110,6 @@ }, "config": { "allow-plugins": { - "cweagans/composer-patches": true, "yiisoft/yii2-composer": true } }, @@ -121,20 +119,6 @@ "extra": { "branch-alias": { "dev-master": "2.0.x-dev" - }, - "composer-exit-on-patch-failure": true, - "patches": { - "phpunit/phpunit-mock-objects": { - "Fix PHP 7 and 8 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_mock_objects.patch" - }, - "phpunit/php-file-iterator": { - "Fix PHP 8.1 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_path_file_iterator.patch" - }, - "phpunit/phpunit": { - "Fix PHP 7 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php7.patch", - "Fix PHP 8 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php8.patch", - "Fix PHP 8.1 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php81.patch" - } } } } diff --git a/composer.lock b/composer.lock index 97f39ee4db3..3190b2d73c3 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": "80e3f228bae519816def145a5a1d47ae", + "content-hash": "1431e21b5959846da9557d3544fe67f9", "packages": [ { "name": "bower-asset/inputmask", @@ -590,89 +590,31 @@ "time": "2022-02-25T21:32:43+00:00" }, { - "name": "cweagans/composer-patches", - "version": "1.7.3", + "name": "dms/phpunit-arraysubset-asserts", + "version": "v0.5.0", "source": { "type": "git", - "url": "https://github.com/cweagans/composer-patches.git", - "reference": "e190d4466fe2b103a55467dfa83fc2fecfcaf2db" + "url": "https://github.com/rdohms/phpunit-arraysubset-asserts.git", + "reference": "aa6b9e858414e91cca361cac3b2035ee57d212e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweagans/composer-patches/zipball/e190d4466fe2b103a55467dfa83fc2fecfcaf2db", - "reference": "e190d4466fe2b103a55467dfa83fc2fecfcaf2db", + "url": "https://api.github.com/repos/rdohms/phpunit-arraysubset-asserts/zipball/aa6b9e858414e91cca361cac3b2035ee57d212e0", + "reference": "aa6b9e858414e91cca361cac3b2035ee57d212e0", "shasum": "" }, "require": { - "composer-plugin-api": "^1.0 || ^2.0", - "php": ">=5.3.0" + "php": "^5.4 || ^7.0 || ^8.0", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0" }, "require-dev": { - "composer/composer": "~1.0 || ~2.0", - "phpunit/phpunit": "~4.6" - }, - "type": "composer-plugin", - "extra": { - "class": "cweagans\\Composer\\Patches" - }, - "autoload": { - "psr-4": { - "cweagans\\Composer\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Cameron Eagans", - "email": "me@cweagans.net" - } - ], - "description": "Provides a way to patch Composer packages.", - "support": { - "issues": "https://github.com/cweagans/composer-patches/issues", - "source": "https://github.com/cweagans/composer-patches/tree/1.7.3" - }, - "time": "2022-12-20T22:53:13+00:00" - }, - { - "name": "doctrine/annotations", - "version": "1.14.3", - "source": { - "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af", - "reference": "fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af", - "shasum": "" - }, - "require": { - "doctrine/lexer": "^1 || ^2", - "ext-tokenizer": "*", - "php": "^7.1 || ^8.0", - "psr/cache": "^1 || ^2 || ^3" - }, - "require-dev": { - "doctrine/cache": "^1.11 || ^2.0", - "doctrine/coding-standard": "^9 || ^10", - "phpstan/phpstan": "~1.4.10 || ^1.8.0", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "symfony/cache": "^4.4 || ^5.4 || ^6", - "vimeo/psalm": "^4.10" - }, - "suggest": { - "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" + "dms/coding-standard": "^9" }, "type": "library", "autoload": { - "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" - } + "files": [ + "assertarraysubset-autoload.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -680,112 +622,43 @@ ], "authors": [ { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Docblock Annotations Parser", - "homepage": "https://www.doctrine-project.org/projects/annotations.html", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "support": { - "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/1.14.3" - }, - "time": "2023-02-01T09:20:38+00:00" - }, - { - "name": "doctrine/deprecations", - "version": "v1.1.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/deprecations.git", - "reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/612a3ee5ab0d5dd97b7cf3874a6efe24325efac3", - "reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9", - "phpstan/phpstan": "1.4.10 || 1.10.15", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "psalm/plugin-phpunit": "0.18.4", - "psr/log": "^1 || ^2 || ^3", - "vimeo/psalm": "4.30.0 || 5.12.0" - }, - "suggest": { - "psr/log": "Allows logging deprecations via PSR-3 logger implementation" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + "name": "Rafael Dohms", + "email": "rdohms@gmail.com" } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" ], - "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", - "homepage": "https://www.doctrine-project.org/", + "description": "This package provides ArraySubset and related asserts once deprecated in PHPUnit 8", "support": { - "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/v1.1.1" + "issues": "https://github.com/rdohms/phpunit-arraysubset-asserts/issues", + "source": "https://github.com/rdohms/phpunit-arraysubset-asserts/tree/v0.5.0" }, - "time": "2023-06-03T09:27:29+00:00" + "time": "2023-06-02T17:33:53+00:00" }, { "name": "doctrine/instantiator", - "version": "1.5.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^11", + "doctrine/coding-standard": "^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" + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" }, "type": "library", "autoload": { @@ -812,7 +685,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" }, "funding": [ { @@ -828,133 +701,55 @@ "type": "tidelift" } ], - "time": "2022-12-30T00:15:36+00:00" - }, - { - "name": "doctrine/lexer", - "version": "2.1.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", - "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", - "shasum": "" - }, - "require": { - "doctrine/deprecations": "^1.0", - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9 || ^10", - "phpstan/phpstan": "^1.3", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "psalm/plugin-phpunit": "^0.18.3", - "vimeo/psalm": "^4.11 || ^5.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Lexer\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "https://www.doctrine-project.org/projects/lexer.html", - "keywords": [ - "annotations", - "docblock", - "lexer", - "parser", - "php" - ], - "support": { - "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/2.1.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%2Flexer", - "type": "tidelift" - } - ], - "time": "2022-12-14T08:49:07+00:00" + "time": "2022-12-30T00:23:10+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.9.5", + "version": "v3.27.0", "source": { "type": "git", - "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "4465d70ba776806857a1ac2a6f877e582445ff36" + "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", + "reference": "e73ccaae1208f017bb7860986eebb3da48bd25d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/4465d70ba776806857a1ac2a6f877e582445ff36", - "reference": "4465d70ba776806857a1ac2a6f877e582445ff36", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/e73ccaae1208f017bb7860986eebb3da48bd25d6", + "reference": "e73ccaae1208f017bb7860986eebb3da48bd25d6", "shasum": "" }, "require": { - "composer/semver": "^3.2", + "composer/semver": "^3.3", "composer/xdebug-handler": "^3.0.3", - "doctrine/annotations": "^1.13", "ext-json": "*", "ext-tokenizer": "*", "php": "^7.4 || ^8.0", - "php-cs-fixer/diff": "^2.0", + "sebastian/diff": "^4.0 || ^5.0", "symfony/console": "^5.4 || ^6.0", "symfony/event-dispatcher": "^5.4 || ^6.0", "symfony/filesystem": "^5.4 || ^6.0", "symfony/finder": "^5.4 || ^6.0", "symfony/options-resolver": "^5.4 || ^6.0", - "symfony/polyfill-mbstring": "^1.23", - "symfony/polyfill-php80": "^1.25", - "symfony/polyfill-php81": "^1.25", + "symfony/polyfill-mbstring": "^1.27", + "symfony/polyfill-php80": "^1.27", + "symfony/polyfill-php81": "^1.27", "symfony/process": "^5.4 || ^6.0", "symfony/stopwatch": "^5.4 || ^6.0" }, "require-dev": { + "facile-it/paraunit": "^1.3 || ^2.0", "justinrainbow/json-schema": "^5.2", - "keradus/cli-executor": "^1.5", - "mikey179/vfsstream": "^1.6.10", - "php-coveralls/php-coveralls": "^2.5.2", + "keradus/cli-executor": "^2.0", + "mikey179/vfsstream": "^1.6.11", + "php-coveralls/php-coveralls": "^2.5.3", "php-cs-fixer/accessible-object": "^1.1", "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1", - "phpspec/prophecy": "^1.15", + "phpspec/prophecy": "^1.16", "phpspec/prophecy-phpunit": "^2.0", "phpunit/phpunit": "^9.5", - "phpunitgoodpractices/polyfill": "^1.5", - "phpunitgoodpractices/traits": "^1.9.1", - "symfony/phpunit-bridge": "^6.0", + "phpunitgoodpractices/polyfill": "^1.6", + "phpunitgoodpractices/traits": "^1.9.2", + "symfony/phpunit-bridge": "^6.2.3", "symfony/yaml": "^5.4 || ^6.0" }, "suggest": { @@ -985,9 +780,15 @@ } ], "description": "A tool to automatically fix PHP code style", + "keywords": [ + "Static code analysis", + "fixer", + "standards", + "static analysis" + ], "support": { - "issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues", - "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v3.9.5" + "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.27.0" }, "funding": [ { @@ -995,86 +796,102 @@ "type": "github" } ], - "time": "2022-07-22T08:43:51+00:00" + "time": "2023-09-17T14:37:54+00:00" }, { - "name": "johnkary/phpunit-speedtrap", - "version": "v1.1.0", + "name": "myclabs/deep-copy", + "version": "1.11.1", "source": { "type": "git", - "url": "https://github.com/johnkary/phpunit-speedtrap.git", - "reference": "f7cfe17c5a7076ed0ccca5450fe3bb981ec56361" + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/johnkary/phpunit-speedtrap/zipball/f7cfe17c5a7076ed0ccca5450fe3bb981ec56361", - "reference": "f7cfe17c5a7076ed0ccca5450fe3bb981ec56361", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { - "php": ">=5.6", - "phpunit/phpunit": ">=4.7,<6.0" + "php": "^7.1 || ^8.0" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } + "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": { - "psr-0": { - "JohnKary": "src/" + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "authors": [ - { - "name": "John Kary", - "email": "john@johnkary.net" - } - ], - "description": "Find slow tests in your PHPUnit test suite", - "homepage": "https://github.com/johnkary/phpunit-speedtrap", + "description": "Create deep copies (clones) of your objects", "keywords": [ - "phpunit", - "profile", - "slow" + "clone", + "copy", + "duplicate", + "object", + "object graph" ], "support": { - "issues": "https://github.com/johnkary/phpunit-speedtrap/issues", - "source": "https://github.com/johnkary/phpunit-speedtrap/tree/1.1" + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, - "time": "2017-03-25T17:14:26+00:00" + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2023-03-08T13:26:56+00:00" }, { - "name": "php-cs-fixer/diff", - "version": "v2.0.2", + "name": "nikic/php-parser", + "version": "v4.17.1", "source": { "type": "git", - "url": "https://github.com/PHP-CS-Fixer/diff.git", - "reference": "29dc0d507e838c4580d018bd8b5cb412474f7ec3" + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/29dc0d507e838c4580d018bd8b5cb412474f7ec3", - "reference": "29dc0d507e838c4580d018bd8b5cb412474f7ec3", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0 || ^8.0" + "ext-tokenizer": "*", + "php": ">=7.0" }, "require-dev": { - "phpunit/phpunit": "^5.7.23 || ^6.4.3 || ^7.0", - "symfony/process": "^3.3" + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" }, + "bin": [ + "bin/php-parse" + ], "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } + }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1082,49 +899,40 @@ ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" + "name": "Nikita Popov" } ], - "description": "sebastian/diff v3 backport support for PHP 5.6+", - "homepage": "https://github.com/PHP-CS-Fixer", + "description": "A PHP parser written in PHP", "keywords": [ - "diff" + "parser", + "php" ], "support": { - "issues": "https://github.com/PHP-CS-Fixer/diff/issues", - "source": "https://github.com/PHP-CS-Fixer/diff/tree/v2.0.2" + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" }, - "abandoned": true, - "time": "2020-10-14T08:32:19+00:00" + "time": "2023-08-13T19:53:39+00:00" }, { - "name": "phpdocumentor/reflection-docblock", - "version": "2.0.5", + "name": "phar-io/manifest", + "version": "2.0.3", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b" + "url": "https://github.com/phar-io/manifest.git", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e6a969a640b00d8daa3c66518b0405fb41ae0c4b", - "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", "shasum": "" }, "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { @@ -1133,127 +941,129 @@ } }, "autoload": { - "psr-0": { - "phpDocumentor": [ - "src/" - ] - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" + "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/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/release/2.x" + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.3" }, - "time": "2016-01-25T08:17:30+00:00" + "time": "2021-07-20T11:28:43+00:00" }, { - "name": "phpspec/prophecy", - "version": "v1.5.0", + "name": "phar-io/version", + "version": "3.2.1", "source": { "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7" + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7", - "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "phpdocumentor/reflection-docblock": "~2.0", - "sebastian/comparator": "~1.1" - }, - "require-dev": { - "phpspec/phpspec": "~2.0" + "php": "^7.2 || ^8.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" }, { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" } ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], + "description": "Library for handling version information and constraints", "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/master" + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2015-08-13T10:07:40+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "2.2.4", + "version": "9.2.29", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76", + "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76", "shasum": "" }, "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.15", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" + "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2.x-dev" + "dev-master": "9.2-dev" } }, "autoload": { @@ -1268,7 +1078,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1280,33 +1090,42 @@ "xunit" ], "support": { - "irc": "irc://irc.freenode.net/phpunit", "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/2.2" + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29" }, - "time": "2015-10-06T15:47:00+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-09-19T04:57:46+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.5", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1321,7 +1140,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1332,30 +1151,47 @@ "iterator" ], "support": { - "irc": "irc://irc.freenode.net/phpunit", "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/1.4.5" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" }, - "time": "2017-11-27T13:52:08+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:48:52+00:00" }, { - "name": "phpunit/php-text-template", - "version": "1.2.1", + "name": "phpunit/php-invoker", + "version": "3.1.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1372,38 +1208,49 @@ "role": "lead" } ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", "keywords": [ - "template" + "process" ], "support": { - "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" }, - "time": "2015-06-21T13:50:34+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" }, { - "name": "phpunit/php-timer", - "version": "1.0.8", + "name": "phpunit/php-text-template", + "version": "2.0.4", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "~4|~5" + "phpunit/phpunit": "^9.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1416,47 +1263,51 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", "keywords": [ - "timer" + "template" ], "support": { - "irc": "irc://irc.freenode.net/phpunit", - "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/master" + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" }, - "time": "2016-05-12T18:03:57+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" }, { - "name": "phpunit/php-token-stream", - "version": "1.4.12", + "name": "phpunit/php-timer", + "version": "5.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", - "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", "shasum": "" }, "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1471,58 +1322,73 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", "keywords": [ - "tokenizer" + "timer" ], "support": { - "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", - "source": "https://github.com/sebastianbergmann/php-token-stream/tree/1.4" + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" }, - "abandoned": true, - "time": "2017-12-04T08:55:13+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:16:10+00:00" }, { "name": "phpunit/phpunit", - "version": "4.8.34", + "version": "9.6.13", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "7eb45205d27edd94bd2b3614085ea158bd1e2bca" + "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7eb45205d27edd94bd2b3614085ea158bd1e2bca", - "reference": "7eb45205d27edd94bd2b3614085ea158bd1e2bca", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3d767f7f9e191eab4189abe41ab37797e30b1be", + "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be", "shasum": "" }, "require": { + "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~2.1", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.2.2", - "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.1|~3.0" + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.3", + "phpunit/php-code-coverage": "^9.2.28", + "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.8", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.5", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^3.2", + "sebastian/version": "^3.0.2" }, "suggest": { - "phpunit/php-invoker": "~1.1" + "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" }, "bin": [ "phpunit" @@ -1530,10 +1396,13 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.8.x-dev" + "dev-master": "9.6-dev" } }, "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], "classmap": [ "src/" ] @@ -1558,84 +1427,140 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/4.8.34" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.13" }, - "time": "2017-01-26T16:15:36+00:00" + "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-09-19T05:39:22+00:00" }, { - "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", + "name": "psr/container", + "version": "2.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" + "php": ">=7.4.0" }, - "require-dev": { - "phpunit/phpunit": "~4.4" + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } }, - "suggest": { - "ext-soap": "*" + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" } ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "description": "Standard interfaces for event handling.", "keywords": [ - "mock", - "xunit" + "events", + "psr", + "psr-14" ], "support": { - "irc": "irc://irc.freenode.net/phpunit", - "issues": "https://github.com/sebastianbergmann/phpunit-mock-objects/issues", - "source": "https://github.com/sebastianbergmann/phpunit-mock-objects/tree/2.3" + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" }, - "abandoned": true, - "time": "2015-10-02T06:51:40+00:00" + "time": "2019-01-08T18:20:26+00:00" }, { - "name": "psr/cache", + "name": "psr/log", "version": "3.0.0", "source": { "type": "git", - "url": "https://github.com/php-fig/cache.git", - "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" + "url": "https://github.com/php-fig/log.git", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", - "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", "shasum": "" }, "require": { @@ -1644,12 +1569,12 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Cache\\": "src/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -1662,196 +1587,611 @@ "homepage": "https://www.php-fig.org/" } ], - "description": "Common interface for caching libraries", + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ - "cache", + "log", "psr", - "psr-6" + "psr-3" ], "support": { - "source": "https://github.com/php-fig/cache/tree/3.0.0" + "source": "https://github.com/php-fig/log/tree/3.0.0" }, - "time": "2021-02-03T23:26:27+00:00" + "time": "2021-07-14T16:46:02+00:00" }, { - "name": "psr/container", + "name": "sebastian/cli-parser", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.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 for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:08:49+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.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": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "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": "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/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" + }, + { + "name": "sebastian/comparator", + "version": "4.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.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/4.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T12:41:17+00:00" + }, + { + "name": "sebastian/complexity", "version": "2.0.2", "source": { "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", "shasum": "" }, "require": { - "php": ">=7.4.0" + "nikic/php-parser": "^4.7", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:52:27+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" } }, + "autoload": { + "classmap": [ + "src/" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" + "diff", + "udiff", + "unidiff", + "unified diff" ], "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/2.0.2" + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" }, - "time": "2021-11-05T16:47:00+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-05-07T05:35:17+00:00" }, { - "name": "psr/event-dispatcher", - "version": "1.0.0", + "name": "sebastian/environment", + "version": "5.1.5", "source": { "type": "git", - "url": "https://github.com/php-fig/event-dispatcher.git", - "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", - "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "5.1-dev" } }, "autoload": { - "psr-4": { - "Psr\\EventDispatcher\\": "src/" + "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/5.1.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:03:51+00:00" + }, + { + "name": "sebastian/exporter", + "version": "4.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" } }, + "autoload": { + "classmap": [ + "src/" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "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": "Standard interfaces for event handling.", + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ - "events", - "psr", - "psr-14" + "export", + "exporter" ], "support": { - "issues": "https://github.com/php-fig/event-dispatcher/issues", - "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" }, - "time": "2019-01-08T18:20:26+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T06:03:37+00:00" }, { - "name": "psr/log", - "version": "3.0.0", + "name": "sebastian/global-state", + "version": "5.0.6", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bde739e7565280bda77be70044ac1047bc007e34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", + "reference": "bde739e7565280bda77be70044ac1047bc007e34", "shasum": "" }, "require": { - "php": ">=8.0.0" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-uopz": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.x-dev" + "dev-master": "5.0-dev" } }, "autoload": { - "psr-4": { - "Psr\\Log\\": "src" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", "keywords": [ - "log", - "psr", - "psr-3" + "global state" ], "support": { - "source": "https://github.com/php-fig/log/tree/3.0.0" + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" }, - "time": "2021-07-14T16:46:02+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-08-02T09:26:13+00:00" }, { - "name": "sebastian/comparator", - "version": "1.2.4", + "name": "sebastian/lines-of-code", + "version": "1.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" + "nikic/php-parser": "^4.6", + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.0-dev" } }, "autoload": { @@ -1864,60 +2204,52 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { - "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/1.2" + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" }, - "time": "2017-01-29T09:50:25+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:42:11+00:00" }, { - "name": "sebastian/diff", - "version": "1.4.1", + "name": "sebastian/object-enumerator", + "version": "4.0.4", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1930,50 +2262,49 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" } ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], + "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/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/master" + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" }, - "time": "2015-12-08T07:14:41+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" }, { - "name": "sebastian/environment", - "version": "1.3.7", + "name": "sebastian/object-reflector", + "version": "2.0.4", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716" + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716", - "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1991,45 +2322,44 @@ "email": "sebastian@phpunit.de" } ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], + "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/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/1.3.7" + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" }, - "time": "2016-05-17T03:18:57+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" }, { - "name": "sebastian/exporter", - "version": "1.2.2", + "name": "sebastian/recursion-context", + "version": "4.0.5", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" + "php": ">=7.3" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2042,66 +2372,57 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, { "name": "Adam Harvey", "email": "aharvey@php.net" } ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { - "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/master" + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, - "time": "2016-06-17T09:04:28+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:07:39+00:00" }, { - "name": "sebastian/global-state", - "version": "1.1.1", + "name": "sebastian/resource-operations", + "version": "3.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2119,41 +2440,44 @@ "email": "sebastian@phpunit.de" } ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], + "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/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/1.1.1" + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" }, - "time": "2015-10-12T03:26:01+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:45:17+00:00" }, { - "name": "sebastian/recursion-context", - "version": "1.0.5", + "name": "sebastian/type", + "version": "3.2.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -2166,42 +2490,49 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "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/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/master" + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" }, - "time": "2016-10-03T07:41:43+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:13:03+00:00" }, { "name": "sebastian/version", - "version": "1.0.6", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + "reference": "c6c1022351a901512170118436c764e473f6de8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", "shasum": "" }, + "require": { + "php": ">=7.3" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -2222,9 +2553,15 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/1.0.6" + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" }, - "time": "2015-06-21T13:59:46+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" }, { "name": "symfony/console", @@ -3517,75 +3854,54 @@ "time": "2023-07-05T08:41:27+00:00" }, { - "name": "symfony/yaml", - "version": "v3.4.47", + "name": "theseer/tokenizer", + "version": "1.2.1", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "88289caa3c166321883f67fe5130188ebbb47094" + "url": "https://github.com/theseer/tokenizer.git", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094", - "reference": "88289caa3c166321883f67fe5130188ebbb47094", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/console": "<3.4" - }, - "require-dev": { - "symfony/console": "~3.4|~4.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" } ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { - "source": "https://github.com/symfony/yaml/tree/v3.4.47" + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" }, "funding": [ { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", + "url": "https://github.com/theseer", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" } ], - "time": "2020-10-24T10:57:07+00:00" + "time": "2021-07-28T10:34:58+00:00" } ], "aliases": [], @@ -3596,7 +3912,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": ">=5.4.0", + "php": ">=7.3.0", "ext-mbstring": "*", "ext-ctype": "*", "lib-pcre": "*" diff --git a/framework/base/Object.php b/framework/base/Object.php deleted file mode 100644 index 20b68f16958..00000000000 --- a/framework/base/Object.php +++ /dev/null @@ -1,30 +0,0 @@ - - * @since 2.0 - * @deprecated since 2.0.13, the class name `Object` is invalid since PHP 7.2, use [[BaseObject]] instead. - * @see https://wiki.php.net/rfc/object-typehint - * @see https://github.com/yiisoft/yii2/issues/7936#issuecomment-315384669 - */ -class Object extends BaseObject -{ -} diff --git a/framework/composer.json b/framework/composer.json index 951679faec9..efd5a1eca40 100644 --- a/framework/composer.json +++ b/framework/composer.json @@ -63,7 +63,7 @@ "source": "https://github.com/yiisoft/yii2" }, "require": { - "php": ">=5.4.0", + "php": ">=7.3.0", "ext-mbstring": "*", "ext-ctype": "*", "lib-pcre": "*", diff --git a/framework/console/widgets/Table.php b/framework/console/widgets/Table.php index c0ece4d4d89..41d18a128bc 100644 --- a/framework/console/widgets/Table.php +++ b/framework/console/widgets/Table.php @@ -113,7 +113,6 @@ class Table extends Widget */ protected $listPrefix = '• '; - /** * Set table headers. * diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 2b9f7c6df55..9347786ca23 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,30 +1,35 @@ - - - - ./tests - - - - - framework/ - - - framework/i18n/GettextFile.php - framework/web/ResponseFormatterInterface.php - framework/.phpstorm.meta.php - framework/base - framework/bootstrap - - - - - + + + + ./tests + + + + + + framework/ + + + framework/.phpstorm.meta.php + framework/i18n/GettextFile.php + framework/web/ResponseFormatterInterface.php + framework/bootstrap + framework/base + framework/requirements + + diff --git a/tests/IsOneOfAssert.php b/tests/IsOneOfAssert.php index 5c630b7d041..bdb6b2bab89 100644 --- a/tests/IsOneOfAssert.php +++ b/tests/IsOneOfAssert.php @@ -14,38 +14,34 @@ */ class IsOneOfAssert extends \PHPUnit\Framework\Constraint\Constraint { - private $allowedValues; - /** - * IsOneOfAssert constructor. - * @param array $allowedValues + * @var array the expected values */ - public function __construct(array $allowedValues) + private $allowedValues = []; + + public function __construct($allowedValues) { - parent::__construct(); $this->allowedValues = $allowedValues; } - /** * Returns a string representation of the object. - * - * @return string */ - public function toString() + public function toString(): string { - $allowedValues = array_map(function ($value) { - return VarDumper::dumpAsString($value); - }, $this->allowedValues); + $allowedValues = []; + + foreach ($this->allowedValues as $value) { + $this->allowedValues[] = VarDumper::create($value)->asString(); + } + $expectedAsString = implode(', ', $allowedValues); + return "is one of $expectedAsString"; } - /** - * {@inheritdoc} - */ - protected function matches($other) + protected function matches($other): bool { - return in_array($other, $this->allowedValues, false); + return in_array($other, $this->allowedValues); } } diff --git a/tests/ResultPrinter.php b/tests/ResultPrinter.php index 89299f0557c..6a6fca92dcc 100644 --- a/tests/ResultPrinter.php +++ b/tests/ResultPrinter.php @@ -12,12 +12,18 @@ * to change default output to STDOUT and prevent some tests from fail when * they can not be executed after headers have been sent. */ -class ResultPrinter extends \PHPUnit\TextUI\ResultPrinter +class ResultPrinter extends \PHPUnit\TextUI\DefaultResultPrinter { + private $out = null; + + /** + * @param null|resource|string $out + * @param int|string $numberOfColumns + */ public function __construct( $out = null, $verbose = false, - $colors = \PHPUnit\TextUI\ResultPrinter::COLOR_DEFAULT, + $colors = \PHPUnit\TextUI\DefaultResultPrinter::COLOR_DEFAULT, $debug = false, $numberOfColumns = 80, $reverse = false @@ -29,7 +35,7 @@ public function __construct( parent::__construct($out, $verbose, $colors, $debug, $numberOfColumns, $reverse); } - public function flush() + public function flush(): void { if ($this->out !== STDOUT) { parent::flush(); diff --git a/tests/TestCase.php b/tests/TestCase.php index 5a8287f1f55..192a3ccb2a7 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -20,7 +20,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase /** * Clean up after test case. */ - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { parent::tearDownAfterClass(); $logger = Yii::getLogger(); @@ -46,7 +46,7 @@ public static function getParam($name, $default = null) * Clean up after test. * By default the application created with [[mockApplication]] will be destroyed. */ - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); $this->destroyApplication(); @@ -168,7 +168,7 @@ protected function assertContainsWithoutLE($needle, $haystack, $message = '') $needle = str_replace("\r\n", "\n", $needle); $haystack = str_replace("\r\n", "\n", $haystack); - $this->assertContains($needle, $haystack, $message); + $this->assertStringContainsString($needle, $haystack, $message); } /** diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 44714ab28da..35a3b1e4a90 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -28,5 +28,4 @@ Yii::setAlias('@runtime', getenv('TEST_RUNTIME_PATH')); } -require_once __DIR__ . '/compatibility.php'; require_once __DIR__ . '/TestCase.php'; diff --git a/tests/compatibility.php b/tests/compatibility.php deleted file mode 100644 index 5a14c6e36e2..00000000000 --- a/tests/compatibility.php +++ /dev/null @@ -1,75 +0,0 @@ -setExpectedException($exception); - } - - /** - * @param string $message - */ - public function expectExceptionMessage($message) - { - $parentClassMethods = get_class_methods('PHPUnit_Framework_TestCase'); - if (in_array('expectExceptionMessage', $parentClassMethods)) { - parent::expectExceptionMessage($message); - return; - } - $this->setExpectedException($this->getExpectedException(), $message); - } - - /** - * @param string $messageRegExp - */ - public function expectExceptionMessageRegExp($messageRegExp) - { - $parentClassMethods = get_class_methods('PHPUnit_Framework_TestCase'); - if (in_array('expectExceptionMessageRegExp', $parentClassMethods)) { - parent::expectExceptionMessageRegExp($messageRegExp); - return; - } - $this->setExpectedExceptionRegExp($this->getExpectedException(), $messageRegExp); - } - } - } -} diff --git a/tests/framework/BaseYiiTest.php b/tests/framework/BaseYiiTest.php index 4e17fff0668..b0c99e9787d 100644 --- a/tests/framework/BaseYiiTest.php +++ b/tests/framework/BaseYiiTest.php @@ -26,13 +26,13 @@ class BaseYiiTest extends TestCase { public $aliases; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->aliases = Yii::$aliases; } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); Yii::$aliases = $this->aliases; @@ -72,7 +72,7 @@ public function testGetVersion() public function testPowered() { - $this->assertInternalType('string', Yii::powered()); + $this->assertIsString(Yii::powered()); } public function testCreateObjectArray() diff --git a/tests/framework/ChangeLogTest.php b/tests/framework/ChangeLogTest.php index eef6cae4585..ad9ba6368d1 100644 --- a/tests/framework/ChangeLogTest.php +++ b/tests/framework/ChangeLogTest.php @@ -54,6 +54,6 @@ public function testContributorLine($line) * - Description ends without a "." * - Line ends with contributor name between "(" and ")". */ - $this->assertRegExp('/- (Bug|Enh|Chg|New)( #\d+(, #\d+)*)?(\s\(CVE-[\d-]+\))?: .*[^.] \(.+\)$/', $line); + $this->assertMatchesRegularExpression('/- (Bug|Enh|Chg|New)( #\d+(, #\d+)*)?(\s\(CVE-[\d-]+\))?: .*[^.] \(.+\)$/', $line); } } diff --git a/tests/framework/base/ActionFilterTest.php b/tests/framework/base/ActionFilterTest.php index 7a527beb77b..17419d16cb5 100644 --- a/tests/framework/base/ActionFilterTest.php +++ b/tests/framework/base/ActionFilterTest.php @@ -19,7 +19,7 @@ */ class ActionFilterTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); diff --git a/tests/framework/base/BaseObjectTest.php b/tests/framework/base/BaseObjectTest.php index 98280fef25e..02166626a68 100644 --- a/tests/framework/base/BaseObjectTest.php +++ b/tests/framework/base/BaseObjectTest.php @@ -20,14 +20,14 @@ class BaseObjectTest extends TestCase */ protected $object; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); $this->object = new NewObject(); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); $this->object = null; diff --git a/tests/framework/base/BehaviorTest.php b/tests/framework/base/BehaviorTest.php index b77a074d4be..47ecbf9e0fc 100644 --- a/tests/framework/base/BehaviorTest.php +++ b/tests/framework/base/BehaviorTest.php @@ -73,13 +73,13 @@ public function detach() */ class BehaviorTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); gc_enable(); diff --git a/tests/framework/base/ComponentTest.php b/tests/framework/base/ComponentTest.php index e2fdbc6e02b..e745c678262 100644 --- a/tests/framework/base/ComponentTest.php +++ b/tests/framework/base/ComponentTest.php @@ -33,14 +33,14 @@ class ComponentTest extends TestCase */ protected $component; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); $this->component = new NewComponent(); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); $this->component = null; diff --git a/tests/framework/base/DynamicModelTest.php b/tests/framework/base/DynamicModelTest.php index d3dca504b6f..6b368f08cd2 100644 --- a/tests/framework/base/DynamicModelTest.php +++ b/tests/framework/base/DynamicModelTest.php @@ -15,7 +15,7 @@ */ class DynamicModelTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); diff --git a/tests/framework/base/EventTest.php b/tests/framework/base/EventTest.php index f99d12bedb7..ab616d1572a 100644 --- a/tests/framework/base/EventTest.php +++ b/tests/framework/base/EventTest.php @@ -18,13 +18,13 @@ class EventTest extends TestCase { public $counter; - protected function setUp() + protected function setUp(): void { $this->counter = 0; Event::offAll(); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); Event::offAll(); diff --git a/tests/framework/base/ModelTest.php b/tests/framework/base/ModelTest.php index 5ed73163b8d..0670abf65de 100644 --- a/tests/framework/base/ModelTest.php +++ b/tests/framework/base/ModelTest.php @@ -20,7 +20,7 @@ */ class ModelTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); diff --git a/tests/framework/base/ModuleTest.php b/tests/framework/base/ModuleTest.php index bbe36311279..333180924e0 100644 --- a/tests/framework/base/ModuleTest.php +++ b/tests/framework/base/ModuleTest.php @@ -18,7 +18,7 @@ */ class ModuleTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); diff --git a/tests/framework/base/SecurityTest.php b/tests/framework/base/SecurityTest.php index d50fc0ab44d..0f1c6ab8394 100644 --- a/tests/framework/base/SecurityTest.php +++ b/tests/framework/base/SecurityTest.php @@ -22,7 +22,7 @@ class SecurityTest extends TestCase */ protected $security; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->security = new ExposedSecurity(); @@ -813,12 +813,14 @@ public function randomKeyInvalidInputs() /** * @dataProvider randomKeyInvalidInputs - * @expectedException \yii\base\InvalidParamException - * @param mixed $input + * + * @param int|string|array $input */ public function testRandomKeyInvalidInput($input) { - $key1 = $this->security->generateRandomKey($input); + $this->expectException(\yii\base\InvalidArgumentException::class); + + $this->security->generateRandomKey($input); } public function testGenerateRandomKey() @@ -826,10 +828,10 @@ public function testGenerateRandomKey() // test various string lengths for ($length = 1; $length < 64; $length++) { $key1 = $this->security->generateRandomKey($length); - $this->assertInternalType('string', $key1); + $this->assertIsString($key1); $this->assertEquals($length, strlen($key1)); $key2 = $this->security->generateRandomKey($length); - $this->assertInternalType('string', $key2); + $this->assertIsString($key2); $this->assertEquals($length, strlen($key2)); if ($length >= 7) { // avoid random test failure, short strings are likely to collide $this->assertNotEquals($key1, $key2); @@ -839,10 +841,10 @@ public function testGenerateRandomKey() // test for /dev/urandom, reading larger data to see if loop works properly $length = 1024 * 1024; $key1 = $this->security->generateRandomKey($length); - $this->assertInternalType('string', $key1); + $this->assertIsString($key1); $this->assertEquals($length, strlen($key1)); $key2 = $this->security->generateRandomKey($length); - $this->assertInternalType('string', $key2); + $this->assertIsString($key2); $this->assertEquals($length, strlen($key2)); $this->assertNotEquals($key1, $key2); } @@ -1103,11 +1105,11 @@ public function testUnMaskingInvalidStrings() $this->assertEquals('', $this->security->unmaskToken('1')); } - /** - * @expectedException \yii\base\InvalidParamException - */ public function testMaskingInvalidStrings() { + $this->expectException(\yii\base\InvalidArgumentException::class); + $this->expectExceptionMessage('First parameter ($length) must be greater than 0'); + $this->security->maskToken(''); } diff --git a/tests/framework/base/ThemeTest.php b/tests/framework/base/ThemeTest.php index 145380f3a7b..7b6ef72680e 100644 --- a/tests/framework/base/ThemeTest.php +++ b/tests/framework/base/ThemeTest.php @@ -16,7 +16,7 @@ */ class ThemeTest extends TestCase { - protected function setUp() + protected function setUp(): void { $config = ['aliases' => ['@web' => '']]; $this->mockWebApplication($config); diff --git a/tests/framework/base/ViewTest.php b/tests/framework/base/ViewTest.php index f568a5a7145..ead215455a1 100644 --- a/tests/framework/base/ViewTest.php +++ b/tests/framework/base/ViewTest.php @@ -24,7 +24,7 @@ class ViewTest extends TestCase */ protected $testViewPath = ''; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -33,7 +33,7 @@ public function setUp() FileHelper::createDirectory($this->testViewPath); } - public function tearDown() + public function tearDown(): void { FileHelper::removeDirectory($this->testViewPath); parent::tearDown(); diff --git a/tests/framework/base/WidgetTest.php b/tests/framework/base/WidgetTest.php index 9517fed7e5b..067e9480125 100644 --- a/tests/framework/base/WidgetTest.php +++ b/tests/framework/base/WidgetTest.php @@ -21,7 +21,7 @@ class WidgetTest extends TestCase /** * {@inheritdoc} */ - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); Widget::$counter = 0; diff --git a/tests/framework/behaviors/AttributeBehaviorTest.php b/tests/framework/behaviors/AttributeBehaviorTest.php index 3159603bac9..cbda9f68ede 100644 --- a/tests/framework/behaviors/AttributeBehaviorTest.php +++ b/tests/framework/behaviors/AttributeBehaviorTest.php @@ -26,14 +26,14 @@ class AttributeBehaviorTest extends TestCase */ protected $dbConnection; - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { if (!extension_loaded('pdo') || !extension_loaded('pdo_sqlite')) { static::markTestSkipped('PDO and SQLite extensions are required.'); } } - public function setUp() + public function setUp(): void { $this->mockApplication([ 'components' => [ @@ -52,7 +52,7 @@ public function setUp() Yii::$app->getDb()->createCommand()->createTable('test_attribute', $columns)->execute(); } - public function tearDown() + public function tearDown(): void { Yii::$app->getDb()->close(); parent::tearDown(); diff --git a/tests/framework/behaviors/AttributeTypecastBehaviorTest.php b/tests/framework/behaviors/AttributeTypecastBehaviorTest.php index a43b9346bbe..5af290672e1 100644 --- a/tests/framework/behaviors/AttributeTypecastBehaviorTest.php +++ b/tests/framework/behaviors/AttributeTypecastBehaviorTest.php @@ -22,14 +22,14 @@ */ class AttributeTypecastBehaviorTest extends TestCase { - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { if (!extension_loaded('pdo') || !extension_loaded('pdo_sqlite')) { static::markTestSkipped('PDO and SQLite extensions are required.'); } } - protected function setUp() + protected function setUp(): void { $this->mockApplication([ 'components' => [ @@ -51,7 +51,7 @@ protected function setUp() Yii::$app->getDb()->createCommand()->createTable('test_attribute_typecast', $columns)->execute(); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); AttributeTypecastBehavior::clearAutoDetectedAttributeTypes(); diff --git a/tests/framework/behaviors/AttributesBehaviorTest.php b/tests/framework/behaviors/AttributesBehaviorTest.php index d26ddbc8b48..1e1ce26d6dc 100644 --- a/tests/framework/behaviors/AttributesBehaviorTest.php +++ b/tests/framework/behaviors/AttributesBehaviorTest.php @@ -26,14 +26,14 @@ class AttributesBehaviorTest extends TestCase */ protected $dbConnection; - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { if (!extension_loaded('pdo') || !extension_loaded('pdo_sqlite')) { static::markTestSkipped('PDO and SQLite extensions are required.'); } } - public function setUp() + public function setUp(): void { $this->mockApplication([ 'components' => [ @@ -52,7 +52,7 @@ public function setUp() Yii::$app->getDb()->createCommand()->createTable('test_attribute', $columns)->execute(); } - public function tearDown() + public function tearDown(): void { Yii::$app->getDb()->close(); parent::tearDown(); diff --git a/tests/framework/behaviors/BlameableBehaviorConsoleTest.php b/tests/framework/behaviors/BlameableBehaviorConsoleTest.php index 4a220125521..15db5da4b5f 100755 --- a/tests/framework/behaviors/BlameableBehaviorConsoleTest.php +++ b/tests/framework/behaviors/BlameableBehaviorConsoleTest.php @@ -21,14 +21,14 @@ */ class BlameableBehaviorConsoleTest extends TestCase { - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { if (!extension_loaded('pdo') || !extension_loaded('pdo_sqlite')) { static::markTestSkipped('PDO and SQLite extensions are required.'); } } - public function setUp() + public function setUp(): void { $this->mockApplication([ 'components' => [ @@ -47,7 +47,7 @@ public function setUp() Yii::$app->getDb()->createCommand()->createTable('test_blame', $columns)->execute(); } - public function tearDown() + public function tearDown(): void { Yii::$app->getDb()->close(); parent::tearDown(); diff --git a/tests/framework/behaviors/BlameableBehaviorTest.php b/tests/framework/behaviors/BlameableBehaviorTest.php index b9e1a86b081..6be4626e988 100644 --- a/tests/framework/behaviors/BlameableBehaviorTest.php +++ b/tests/framework/behaviors/BlameableBehaviorTest.php @@ -21,14 +21,14 @@ */ class BlameableBehaviorTest extends TestCase { - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { if (!extension_loaded('pdo') || !extension_loaded('pdo_sqlite')) { static::markTestSkipped('PDO and SQLite extensions are required.'); } } - public function setUp() + public function setUp(): void { $this->mockApplication([ 'components' => [ @@ -52,7 +52,7 @@ public function setUp() $this->getUser()->login(10); } - public function tearDown() + public function tearDown(): void { Yii::$app->getDb()->close(); parent::tearDown(); diff --git a/tests/framework/behaviors/CacheableWidgetBehaviorTest.php b/tests/framework/behaviors/CacheableWidgetBehaviorTest.php index fdcf5e0d3cd..9ff9d0826f5 100644 --- a/tests/framework/behaviors/CacheableWidgetBehaviorTest.php +++ b/tests/framework/behaviors/CacheableWidgetBehaviorTest.php @@ -32,7 +32,7 @@ class CacheableWidgetBehaviorTest extends TestCase /** * {@inheritdoc} */ - protected function setUp() + protected function setUp(): void { $this->initializeApplicationMock(); $this->initializeWidgetMocks(); diff --git a/tests/framework/behaviors/OptimisticLockBehaviorTest.php b/tests/framework/behaviors/OptimisticLockBehaviorTest.php index fe041eab9af..5870d95e431 100644 --- a/tests/framework/behaviors/OptimisticLockBehaviorTest.php +++ b/tests/framework/behaviors/OptimisticLockBehaviorTest.php @@ -29,14 +29,14 @@ class OptimisticLockBehaviorTest extends TestCase */ protected $dbConnection; - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { if (!extension_loaded('pdo') || !extension_loaded('pdo_sqlite')) { static::markTestSkipped('PDO and SQLite extensions are required.'); } } - public function setUp() + public function setUp(): void { $this->mockApplication([ 'components' => [ @@ -60,7 +60,7 @@ public function setUp() Yii::$app->getDb()->createCommand()->createTable('test_auto_lock_version_string', $columns)->execute(); } - public function tearDown() + public function tearDown(): void { Yii::$app->getDb()->close(); parent::tearDown(); @@ -127,14 +127,13 @@ public function testNewRecord() $this->assertEquals(8, $model->version, 'init version should equal 8'); } - public function testUpdateRecord() { $request = new Request(); Yii::$app->set('request', $request); ActiveRecordLockVersion::$behaviors = [ - OptimisticLockBehavior::className(), + OptimisticLockBehavior::class, ]; $model = new ActiveRecordLockVersion(); $this->assertEquals(true, $model->save(false), 'model is successfully saved'); @@ -152,7 +151,7 @@ public function testUpdateRecord() try { $model->save(false); } catch (\yii\db\StaleObjectException $e) { - $this->assertContains('The object being updated is outdated.', $e->getMessage()); + $this->assertStringContainsString('The object being updated is outdated.', $e->getMessage()); $thrown = true; } @@ -168,7 +167,7 @@ public function testUpdateRecord() try { $model->save(false); } catch (\yii\db\StaleObjectException $e) { - $this->assertContains('The object being updated is outdated.', $e->getMessage()); + $this->assertStringContainsString('The object being updated is outdated.', $e->getMessage()); $thrown = true; } @@ -184,7 +183,7 @@ public function testUpdateRecord() try { $model->save(false); } catch (\yii\db\StaleObjectException $e) { - $this->assertContains('The object being updated is outdated.', $e->getMessage()); + $this->assertStringContainsString('The object being updated is outdated.', $e->getMessage()); $thrown = true; } @@ -211,13 +210,13 @@ public function testUpdateRecord() $this->assertEquals(3, $model->version, 'updated version should equal 3'); } - public function testDeleteRecord() + public function testDeleteRecord() { $request = new Request(); Yii::$app->set('request', $request); ActiveRecordLockVersion::$behaviors = [ - OptimisticLockBehavior::className(), + OptimisticLockBehavior::class, ]; $model = new ActiveRecordLockVersion(); $this->assertEquals(true, $model->save(false), 'model is successfully saved'); @@ -233,7 +232,7 @@ public function testDeleteRecord() try { $model->delete(); } catch (\yii\db\StaleObjectException $e) { - $this->assertContains('The object being deleted is outdated.', $e->getMessage()); + $this->assertStringContainsString('The object being deleted is outdated.', $e->getMessage()); $thrown = true; } @@ -249,7 +248,7 @@ public function testDeleteRecord() try { $model->delete(); } catch (\yii\db\StaleObjectException $e) { - $this->assertContains('The object being deleted is outdated.', $e->getMessage()); + $this->assertStringContainsString('The object being deleted is outdated.', $e->getMessage()); $thrown = true; } diff --git a/tests/framework/behaviors/SluggableBehaviorTest.php b/tests/framework/behaviors/SluggableBehaviorTest.php index cf9e9ceddda..74670ba2e51 100644 --- a/tests/framework/behaviors/SluggableBehaviorTest.php +++ b/tests/framework/behaviors/SluggableBehaviorTest.php @@ -26,14 +26,14 @@ class SluggableBehaviorTest extends TestCase */ protected $dbConnection; - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { if (!extension_loaded('pdo') || !extension_loaded('pdo_sqlite')) { static::markTestSkipped('PDO and SQLite extensions are required.'); } } - public function setUp() + public function setUp(): void { $this->mockApplication([ 'components' => [ @@ -60,7 +60,7 @@ public function setUp() Yii::$app->getDb()->createCommand()->createTable('test_slug_related', $columns)->execute(); } - public function tearDown() + public function tearDown(): void { Yii::$app->getDb()->close(); parent::tearDown(); diff --git a/tests/framework/behaviors/TimestampBehaviorTest.php b/tests/framework/behaviors/TimestampBehaviorTest.php index 22365f17993..e5e087a2ded 100644 --- a/tests/framework/behaviors/TimestampBehaviorTest.php +++ b/tests/framework/behaviors/TimestampBehaviorTest.php @@ -28,14 +28,14 @@ class TimestampBehaviorTest extends TestCase */ protected $dbConnection; - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { if (!extension_loaded('pdo') || !extension_loaded('pdo_sqlite')) { static::markTestSkipped('PDO and SQLite extensions are required.'); } } - public function setUp() + public function setUp(): void { $this->mockApplication([ 'components' => [ @@ -61,7 +61,7 @@ public function setUp() Yii::$app->getDb()->createCommand()->createTable('test_auto_timestamp_string', $columns)->execute(); } - public function tearDown() + public function tearDown(): void { Yii::$app->getDb()->close(); parent::tearDown(); diff --git a/tests/framework/caching/CacheTestCase.php b/tests/framework/caching/CacheTestCase.php index 7eb00321a35..fc98fb57e04 100644 --- a/tests/framework/caching/CacheTestCase.php +++ b/tests/framework/caching/CacheTestCase.php @@ -54,13 +54,13 @@ abstract class CacheTestCase extends TestCase */ abstract protected function getCacheInstance(); - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); } - protected function tearDown() + protected function tearDown(): void { static::$time = null; static::$microtime = null; diff --git a/tests/framework/caching/DbCacheTest.php b/tests/framework/caching/DbCacheTest.php index b18b30e2bcd..21d2723cb62 100644 --- a/tests/framework/caching/DbCacheTest.php +++ b/tests/framework/caching/DbCacheTest.php @@ -19,7 +19,7 @@ class DbCacheTest extends CacheTestCase private $_cacheInstance; private $_connection; - protected function setUp() + protected function setUp(): void { if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) { $this->markTestSkipped('pdo and pdo_mysql extensions are required.'); diff --git a/tests/framework/caching/DbDependencyTest.php b/tests/framework/caching/DbDependencyTest.php index bd801e3528c..a64d47d8533 100644 --- a/tests/framework/caching/DbDependencyTest.php +++ b/tests/framework/caching/DbDependencyTest.php @@ -25,7 +25,7 @@ class DbDependencyTest extends DatabaseTestCase /** * {@inheritdoc} */ - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/caching/DbQueryDependencyTest.php b/tests/framework/caching/DbQueryDependencyTest.php index f8a50183dcd..679fc9eb63a 100644 --- a/tests/framework/caching/DbQueryDependencyTest.php +++ b/tests/framework/caching/DbQueryDependencyTest.php @@ -23,7 +23,7 @@ class DbQueryDependencyTest extends DatabaseTestCase /** * {@inheritdoc} */ - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/caching/FileCacheTest.php b/tests/framework/caching/FileCacheTest.php index c9f6ee8f51f..39bb81ae4b1 100644 --- a/tests/framework/caching/FileCacheTest.php +++ b/tests/framework/caching/FileCacheTest.php @@ -77,7 +77,7 @@ public function testKeyPrefix() $cacheFile = $refMethodGetCacheFile->invoke($cache, $normalizeKey); $this->assertTrue($refMethodSet->invoke($cache, $key, $value)); - $this->assertContains($keyPrefix, basename($cacheFile)); + $this->assertStringContainsString($keyPrefix, basename($cacheFile)); $this->assertEquals($expectedDirectoryName, basename(dirname($cacheFile)), $cacheFile); $this->assertTrue(is_dir(dirname($cacheFile)), 'File not found ' . $cacheFile); $this->assertEquals($value, $refMethodGet->invoke($cache, $key)); diff --git a/tests/framework/caching/MssqlCacheTest.php b/tests/framework/caching/MssqlCacheTest.php index 324f1fcc036..2efc8bf5d6a 100644 --- a/tests/framework/caching/MssqlCacheTest.php +++ b/tests/framework/caching/MssqlCacheTest.php @@ -21,7 +21,7 @@ class MssqlCacheTest extends CacheTestCase private $_cacheInstance; private $_connection; - protected function setUp() + protected function setUp(): void { if (!extension_loaded('pdo') || !extension_loaded('pdo_sqlsrv')) { $this->markTestSkipped('pdo and pdo_mssql extensions are required.'); diff --git a/tests/framework/caching/PgSQLCacheTest.php b/tests/framework/caching/PgSQLCacheTest.php index 76a4c6cc6b5..45478537c43 100644 --- a/tests/framework/caching/PgSQLCacheTest.php +++ b/tests/framework/caching/PgSQLCacheTest.php @@ -20,7 +20,7 @@ class PgSQLCacheTest extends DbCacheTest protected static $driverName = 'pgsql'; private $_connection; - protected function setUp() + protected function setUp(): void { if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) { $this->markTestSkipped('pdo and pdo_pgsql extensions are required.'); diff --git a/tests/framework/console/ControllerTest.php b/tests/framework/console/ControllerTest.php index a38cb7ea372..bff75019839 100644 --- a/tests/framework/console/ControllerTest.php +++ b/tests/framework/console/ControllerTest.php @@ -26,7 +26,7 @@ class ControllerTest extends TestCase /** @var FakeController */ private $controller; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); @@ -270,7 +270,7 @@ public function testHelpOption() $helpController = new FakeHelpControllerWithoutOutput('help', Yii::$app); $helpController->actionIndex('fake/aksi1'); - $this->assertContains('--test-array, -ta', $helpController->outputString); + $this->assertStringContainsString('--test-array, -ta', $helpController->outputString); } /** diff --git a/tests/framework/console/UnknownCommandExceptionTest.php b/tests/framework/console/UnknownCommandExceptionTest.php index 63dd11ccd97..e042d80a3fc 100644 --- a/tests/framework/console/UnknownCommandExceptionTest.php +++ b/tests/framework/console/UnknownCommandExceptionTest.php @@ -16,7 +16,7 @@ */ class UnknownCommandExceptionTest extends TestCase { - public function setUp() + public function setUp(): void { $this->mockApplication([ 'enableCoreCommands' => false, diff --git a/tests/framework/console/controllers/AssetControllerTest.php b/tests/framework/console/controllers/AssetControllerTest.php index f9fe4be33c2..a09a6e1fbab 100644 --- a/tests/framework/console/controllers/AssetControllerTest.php +++ b/tests/framework/console/controllers/AssetControllerTest.php @@ -32,7 +32,7 @@ class AssetControllerTest extends TestCase */ protected $testAssetsBasePath = ''; - public function setUp() + public function setUp(): void { $this->mockApplication(); $this->testFilePath = Yii::getAlias('@yiiunit/runtime') . DIRECTORY_SEPARATOR . str_replace('\\', '_', get_class($this)) . uniqid(); @@ -41,7 +41,7 @@ public function setUp() $this->createDir($this->testAssetsBasePath); } - public function tearDown() + public function tearDown(): void { $this->removeDir($this->testFilePath); } @@ -258,7 +258,7 @@ public function testActionTemplate() $this->runAssetControllerAction('template', [$configFileName]); $this->assertFileExists($configFileName, 'Unable to create config file template!'); $config = require $configFileName; - $this->assertInternalType('array', $config, 'Invalid config created!'); + $this->assertIsArray($config, 'Invalid config created!'); } public function testActionCompress() @@ -304,7 +304,7 @@ public function testActionCompress() // Then : $this->assertFileExists($bundleFile, 'Unable to create output bundle file!'); $compressedBundleConfig = require $bundleFile; - $this->assertInternalType('array', $compressedBundleConfig, 'Output bundle file has incorrect format!'); + $this->assertIsArray($compressedBundleConfig, 'Output bundle file has incorrect format!'); $this->assertCount(2, $compressedBundleConfig, 'Output bundle config contains wrong bundle count!'); $this->assertArrayHasKey($assetBundleClassName, $compressedBundleConfig, 'Source bundle is lost!'); @@ -320,11 +320,19 @@ public function testActionCompress() $compressedCssFileContent = file_get_contents($compressedCssFileName); foreach ($cssFiles as $name => $content) { - $this->assertContains($content, $compressedCssFileContent, "Source of '{$name}' is missing in combined file!"); + $this->assertStringContainsString( + $content, + $compressedCssFileContent, + "Source of '{$name}' is missing in combined file!", + ); } $compressedJsFileContent = file_get_contents($compressedJsFileName); foreach ($jsFiles as $name => $content) { - $this->assertContains($content, $compressedJsFileContent, "Source of '{$name}' is missing in combined file!"); + $this->assertStringContainsString( + $content, + $compressedJsFileContent, + "Source of '{$name}' is missing in combined file!", + ); } } @@ -384,7 +392,7 @@ public function testCompressExternalAsset() // Then : $this->assertFileExists($bundleFile, 'Unable to create output bundle file!'); $compressedBundleConfig = require $bundleFile; - $this->assertInternalType('array', $compressedBundleConfig, 'Output bundle file has incorrect format!'); + $this->assertIsArray($compressedBundleConfig, 'Output bundle file has incorrect format!'); $this->assertArrayHasKey($externalAssetBundleClassName, $compressedBundleConfig, 'External bundle is lost!'); $compressedExternalAssetConfig = $compressedBundleConfig[$externalAssetBundleClassName]; diff --git a/tests/framework/console/controllers/BaseMessageControllerTest.php b/tests/framework/console/controllers/BaseMessageControllerTest.php index 90d77736209..31fd8405506 100644 --- a/tests/framework/console/controllers/BaseMessageControllerTest.php +++ b/tests/framework/console/controllers/BaseMessageControllerTest.php @@ -23,7 +23,7 @@ abstract class BaseMessageControllerTest extends TestCase protected $configFileName = ''; protected $language = 'en'; - public function setUp() + public function setUp(): void { $this->mockApplication(); $this->sourcePath = Yii::getAlias('@yiiunit/runtime/test_source'); @@ -47,7 +47,7 @@ protected function generateConfigFileName() return $this->configFileName; } - public function tearDown() + public function tearDown(): void { FileHelper::removeDirectory($this->sourcePath); if (file_exists($this->configFileName)) { diff --git a/tests/framework/console/controllers/CacheControllerTest.php b/tests/framework/console/controllers/CacheControllerTest.php index 907c6da4d3f..d38c5251c92 100644 --- a/tests/framework/console/controllers/CacheControllerTest.php +++ b/tests/framework/console/controllers/CacheControllerTest.php @@ -29,7 +29,7 @@ class CacheControllerTest extends TestCase private $driverName = 'mysql'; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -137,11 +137,10 @@ public function testNotFoundFlush() $this->assertEquals('firstValue', Yii::$app->firstCache->get('firstKey'), 'first cache data should not be flushed'); } - /** - * @expectedException \yii\console\Exception - */ public function testNothingToFlushException() { + $this->expectException(\yii\console\Exception::class); + $this->_cacheController->actionFlush(); } diff --git a/tests/framework/console/controllers/DbMessageControllerTest.php b/tests/framework/console/controllers/DbMessageControllerTest.php index 1c5707dab94..42b595a9c64 100644 --- a/tests/framework/console/controllers/DbMessageControllerTest.php +++ b/tests/framework/console/controllers/DbMessageControllerTest.php @@ -51,7 +51,7 @@ protected static function runConsoleAction($route, $params = []) } } - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); $databases = static::getParam('databases'); @@ -65,7 +65,7 @@ public static function setUpBeforeClass() static::runConsoleAction('migrate/up', ['migrationPath' => '@yii/i18n/migrations/', 'interactive' => false]); } - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { static::runConsoleAction('migrate/down', ['migrationPath' => '@yii/i18n/migrations/', 'interactive' => false]); if (static::$db) { @@ -75,7 +75,7 @@ public static function tearDownAfterClass() parent::tearDownAfterClass(); } - public function tearDown() + public function tearDown(): void { parent::tearDown(); Yii::$app = null; diff --git a/tests/framework/console/controllers/FixtureControllerTest.php b/tests/framework/console/controllers/FixtureControllerTest.php index 49ad96b31df..a7882d1f1a3 100644 --- a/tests/framework/console/controllers/FixtureControllerTest.php +++ b/tests/framework/console/controllers/FixtureControllerTest.php @@ -30,7 +30,7 @@ class FixtureControllerTest extends DatabaseTestCase protected $driverName = 'mysql'; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -46,7 +46,7 @@ protected function setUp() ], [null, null]); //id and module are null } - protected function tearDown() + protected function tearDown(): void { $this->_fixtureController = null; FixtureStorage::clear(); diff --git a/tests/framework/console/controllers/HelpControllerTest.php b/tests/framework/console/controllers/HelpControllerTest.php index 68c4f61772f..1a67852f216 100644 --- a/tests/framework/console/controllers/HelpControllerTest.php +++ b/tests/framework/console/controllers/HelpControllerTest.php @@ -21,7 +21,7 @@ class HelpControllerTest extends TestCase /** * {@inheritdoc} */ - public function setUp() + public function setUp(): void { $this->mockApplication(); } @@ -154,37 +154,37 @@ public function testActionUsage() public function testActionIndex() { $result = Console::stripAnsiFormat($this->runControllerAction('index')); - $this->assertContains('This is Yii version ', $result); - $this->assertContains('The following commands are available:', $result); - $this->assertContains('To see the help of each command, enter:', $result); - $this->assertContains('bootstrap.php help', $result); + $this->assertStringContainsString('This is Yii version ', $result); + $this->assertStringContainsString('The following commands are available:', $result); + $this->assertStringContainsString('To see the help of each command, enter:', $result); + $this->assertStringContainsString('bootstrap.php help', $result); } public function testActionIndexWithHelpCommand() { $result = Console::stripAnsiFormat($this->runControllerAction('index', ['command' => 'help/index'])); - $this->assertContains('Displays available commands or the detailed information', $result); - $this->assertContains('bootstrap.php help [command] [...options...]', $result); - $this->assertContains('--appconfig: string', $result); - $this->assertContains('- command: string', $result); - $this->assertContains('--color: boolean, 0 or 1', $result); - $this->assertContains('--help, -h: boolean, 0 or 1', $result); - $this->assertContains('--interactive: boolean, 0 or 1 (defaults to 1)', $result); + $this->assertStringContainsString('Displays available commands or the detailed information', $result); + $this->assertStringContainsString('bootstrap.php help [command] [...options...]', $result); + $this->assertStringContainsString('--appconfig: string', $result); + $this->assertStringContainsString('- command: string', $result); + $this->assertStringContainsString('--color: boolean, 0 or 1', $result); + $this->assertStringContainsString('--help, -h: boolean, 0 or 1', $result); + $this->assertStringContainsString('--interactive: boolean, 0 or 1 (defaults to 1)', $result); } public function testActionIndexWithServeCommand() { $result = Console::stripAnsiFormat($this->runControllerAction('index', ['command' => 'serve'])); - $this->assertContains('Runs PHP built-in web server', $result); - $this->assertContains('bootstrap.php serve [address] [...options...]', $result); - $this->assertContains('- address: string (defaults to \'localhost\')', $result); - $this->assertContains('--appconfig: string', $result); - $this->assertContains('--color: boolean, 0 or 1', $result); - $this->assertContains('--docroot, -t: string (defaults to \'@app/web\')', $result); - $this->assertContains('--help, -h: boolean, 0 or 1', $result); - $this->assertContains('--interactive: boolean, 0 or 1 (defaults to 1)', $result); - $this->assertContains('--port, -p: int (defaults to 8080)', $result); - $this->assertContains('--router, -r: string', $result); + $this->assertStringContainsString('Runs PHP built-in web server', $result); + $this->assertStringContainsString('bootstrap.php serve [address] [...options...]', $result); + $this->assertStringContainsString('- address: string (defaults to \'localhost\')', $result); + $this->assertStringContainsString('--appconfig: string', $result); + $this->assertStringContainsString('--color: boolean, 0 or 1', $result); + $this->assertStringContainsString('--docroot, -t: string (defaults to \'@app/web\')', $result); + $this->assertStringContainsString('--help, -h: boolean, 0 or 1', $result); + $this->assertStringContainsString('--interactive: boolean, 0 or 1 (defaults to 1)', $result); + $this->assertStringContainsString('--port, -p: int (defaults to 8080)', $result); + $this->assertStringContainsString('--router, -r: string', $result); } public function testActionListContainsNoEmptyCommands() @@ -194,9 +194,9 @@ public function testActionListContainsNoEmptyCommands() 'controllerNamespace' => 'yiiunit\data\console\controllers', ]); $result = Console::stripAnsiFormat($this->runControllerAction('list')); - $this->assertNotContains("fake-empty\n", $result); - $this->assertNotContains("fake-no-default\n", $result); - $this->assertContains("fake-no-default/index\n", $result); + $this->assertStringNotContainsString("fake-empty\n", $result); + $this->assertStringNotContainsString("fake-no-default\n", $result); + $this->assertStringContainsString("fake-no-default/index\n", $result); } public function testActionIndexContainsNoEmptyCommands() @@ -206,14 +206,13 @@ public function testActionIndexContainsNoEmptyCommands() 'controllerNamespace' => 'yiiunit\data\console\controllers', ]); $result = Console::stripAnsiFormat($this->runControllerAction('index')); - $this->assertNotContains("- fake-empty", $result); - $this->assertContains("- fake-no-default", $result); - $this->assertContains(" fake-no-default/index", $result); - $this->assertNotContains(" fake-no-default/index (default)", $result); + $this->assertStringNotContainsString("- fake-empty", $result); + $this->assertStringContainsString("- fake-no-default", $result); + $this->assertStringContainsString(" fake-no-default/index", $result); + $this->assertStringNotContainsString(" fake-no-default/index (default)", $result); } } - class BufferedHelpController extends HelpController { use StdOutBufferControllerTrait; diff --git a/tests/framework/console/controllers/MigrateControllerTest.php b/tests/framework/console/controllers/MigrateControllerTest.php index 714b233b82b..72afa98c97e 100644 --- a/tests/framework/console/controllers/MigrateControllerTest.php +++ b/tests/framework/console/controllers/MigrateControllerTest.php @@ -26,7 +26,7 @@ class MigrateControllerTest extends TestCase { use MigrateControllerTestTrait; - public function setUp() + public function setUp(): void { $this->migrateControllerClass = EchoMigrateController::className(); $this->migrationBaseClass = Migration::className(); @@ -44,7 +44,7 @@ public function setUp() parent::setUp(); } - public function tearDown() + public function tearDown(): void { $this->tearDownMigrationPath(); parent::tearDown(); diff --git a/tests/framework/console/controllers/MigrateControllerTestTrait.php b/tests/framework/console/controllers/MigrateControllerTestTrait.php index bb71b5df1a9..328adaa20ff 100644 --- a/tests/framework/console/controllers/MigrateControllerTestTrait.php +++ b/tests/framework/console/controllers/MigrateControllerTestTrait.php @@ -59,7 +59,7 @@ public function setUpMigrationPath() } } - public function tearDownMigrationPath() + public function tearDownMigrationPath(): void { FileHelper::removeDirectory($this->migrationPath); FileHelper::removeDirectory(Yii::getAlias('@yiiunit/runtime/app_migrations')); @@ -394,7 +394,7 @@ public function testNamespaceCreate() $files = FileHelper::findFiles($this->migrationPath); $fileContent = file_get_contents($files[0]); $this->assertContains("namespace {$this->migrationNamespace};", $fileContent); - $this->assertRegExp('/class M[0-9]{12}' . ucfirst($migrationName) . '/s', $fileContent); + $this->assertMatchesRegularExpression('/class M[0-9]{12}' . ucfirst($migrationName) . '/s', $fileContent); unlink($files[0]); // namespace specify : @@ -487,8 +487,8 @@ public function testNamespaceHistory() $output = $this->runMigrateControllerAction('history', [], $controllerConfig); $this->assertSame(ExitCode::OK, $this->getExitCode()); - $this->assertRegExp('/' . preg_quote($this->migrationNamespace) . '.*History1/s', $output); - $this->assertRegExp('/' . preg_quote($this->migrationNamespace) . '.*History2/s', $output); + $this->assertMatchesRegularExpression('/' . preg_quote($this->migrationNamespace) . '.*History1/s', $output); + $this->assertMatchesRegularExpression('/' . preg_quote($this->migrationNamespace) . '.*History2/s', $output); } /** diff --git a/tests/framework/console/controllers/PHPMessageControllerTest.php b/tests/framework/console/controllers/PHPMessageControllerTest.php index d3a8074a665..54109856f05 100644 --- a/tests/framework/console/controllers/PHPMessageControllerTest.php +++ b/tests/framework/console/controllers/PHPMessageControllerTest.php @@ -18,14 +18,14 @@ class PHPMessageControllerTest extends BaseMessageControllerTest { protected $messagePath; - public function setUp() + public function setUp(): void { parent::setUp(); $this->messagePath = Yii::getAlias('@yiiunit/runtime/test_messages'); FileHelper::createDirectory($this->messagePath, 0777); } - public function tearDown() + public function tearDown(): void { parent::tearDown(); FileHelper::removeDirectory($this->messagePath); @@ -165,7 +165,7 @@ public function testRemoveUnusedBehavior($category, $isUnused, $removeUnused, $i if ($isExpectedToExist) { $this->assertFileExists($filePath); } else { - $this->assertFileNotExists($filePath); + $this->assertFileDoesNotExist($filePath); } } } diff --git a/tests/framework/console/controllers/POMessageControllerTest.php b/tests/framework/console/controllers/POMessageControllerTest.php index 0aac7f2c8d3..321631818f0 100644 --- a/tests/framework/console/controllers/POMessageControllerTest.php +++ b/tests/framework/console/controllers/POMessageControllerTest.php @@ -19,7 +19,7 @@ class POMessageControllerTest extends BaseMessageControllerTest protected $messagePath; protected $catalog = 'messages'; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -27,7 +27,7 @@ public function setUp() FileHelper::createDirectory($this->messagePath, 0777); } - public function tearDown() + public function tearDown(): void { parent::tearDown(); FileHelper::removeDirectory($this->messagePath); diff --git a/tests/framework/console/widgets/TableTest.php b/tests/framework/console/widgets/TableTest.php index 796c95ad1d6..44e9f4427a9 100644 --- a/tests/framework/console/widgets/TableTest.php +++ b/tests/framework/console/widgets/TableTest.php @@ -16,7 +16,7 @@ */ class TableTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); @@ -502,7 +502,7 @@ public function testColorizedInputStripsANSIMarkersInternally() ->setScreenWidth(200) ->run(); - $columnWidths = \PHPUnit_Framework_Assert::readAttribute($table, "columnWidths"); + $columnWidths = $this->getInaccessibleProperty($table, 'columnWidths'); $this->assertArrayHasKey(1, $columnWidths); $this->assertEquals(4+2, $columnWidths[1]); diff --git a/tests/framework/data/ActiveDataFilterTest.php b/tests/framework/data/ActiveDataFilterTest.php index 9e4fbe7ca62..a4763fd81ad 100644 --- a/tests/framework/data/ActiveDataFilterTest.php +++ b/tests/framework/data/ActiveDataFilterTest.php @@ -13,7 +13,7 @@ class ActiveDataFilterTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/data/ActiveDataProviderTest.php b/tests/framework/data/ActiveDataProviderTest.php index 57f866ee809..af96dfef267 100644 --- a/tests/framework/data/ActiveDataProviderTest.php +++ b/tests/framework/data/ActiveDataProviderTest.php @@ -26,7 +26,7 @@ */ abstract class ActiveDataProviderTest extends DatabaseTestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); ActiveRecord::$db = $this->getConnection(); @@ -132,7 +132,7 @@ public function testQuery() ]); $orders = $provider->getModels(); $this->assertCount(3, $orders); - $this->assertInternalType('array', $orders[0]); + $this->assertIsArray($orders[0]); $this->assertEquals([0, 1, 2], $provider->getKeys()); $query = new Query(); diff --git a/tests/framework/data/ArrayDataProviderTest.php b/tests/framework/data/ArrayDataProviderTest.php index 6c9af6e98bf..84944d511b6 100644 --- a/tests/framework/data/ArrayDataProviderTest.php +++ b/tests/framework/data/ArrayDataProviderTest.php @@ -15,7 +15,7 @@ */ class ArrayDataProviderTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); diff --git a/tests/framework/data/BaseDataProviderTest.php b/tests/framework/data/BaseDataProviderTest.php index ea5ae21cb69..1dfcf6d5809 100644 --- a/tests/framework/data/BaseDataProviderTest.php +++ b/tests/framework/data/BaseDataProviderTest.php @@ -17,10 +17,24 @@ class BaseDataProviderTest extends TestCase { public function testGenerateId() { - $rc = new \ReflectionClass(BaseDataProvider::className()); - $rp = $rc->getProperty('counter'); - $rp->setAccessible(true); - $rp->setValue(null); + $baseDataProvider = new class extends BaseDataProvider { + protected function prepareModels() + { + return []; + } + + protected function prepareKeys($models) + { + return []; + } + + protected function prepareTotalCount() + { + return 0; + } + }; + + $this->setInaccessibleProperty($baseDataProvider, 'counter', null); $this->assertNull((new ConcreteDataProvider())->id); $this->assertNotNull((new ConcreteDataProvider())->id); diff --git a/tests/framework/data/DataFilterTest.php b/tests/framework/data/DataFilterTest.php index 1508a28ccde..aec273c9a5b 100644 --- a/tests/framework/data/DataFilterTest.php +++ b/tests/framework/data/DataFilterTest.php @@ -17,7 +17,7 @@ */ class DataFilterTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/data/PaginationTest.php b/tests/framework/data/PaginationTest.php index a50cba3745c..4dee36e6d3e 100644 --- a/tests/framework/data/PaginationTest.php +++ b/tests/framework/data/PaginationTest.php @@ -16,7 +16,7 @@ */ class PaginationTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockWebApplication([ diff --git a/tests/framework/data/SortTest.php b/tests/framework/data/SortTest.php index c9bb1884212..27a4659cbc7 100644 --- a/tests/framework/data/SortTest.php +++ b/tests/framework/data/SortTest.php @@ -19,7 +19,7 @@ */ class SortTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); diff --git a/tests/framework/db/ActiveQueryModelConnectionTest.php b/tests/framework/db/ActiveQueryModelConnectionTest.php index 86dff975fd4..e14b6824d4b 100644 --- a/tests/framework/db/ActiveQueryModelConnectionTest.php +++ b/tests/framework/db/ActiveQueryModelConnectionTest.php @@ -17,7 +17,7 @@ class ActiveQueryModelConnectionTest extends TestCase private $globalConnection; private $modelConnection; - protected function setUp() + protected function setUp(): void { $this->globalConnection = $this->getMockBuilder('yii\db\Connection')->getMock(); $this->modelConnection = $this->getMockBuilder('yii\db\Connection')->getMock(); diff --git a/tests/framework/db/ActiveQueryTest.php b/tests/framework/db/ActiveQueryTest.php index 3d3f451865c..5927d2d9869 100644 --- a/tests/framework/db/ActiveQueryTest.php +++ b/tests/framework/db/ActiveQueryTest.php @@ -22,7 +22,7 @@ */ abstract class ActiveQueryTest extends DatabaseTestCase { - public function setUp() + public function setUp(): void { parent::setUp(); ActiveRecord::$db = $this->getConnection(); diff --git a/tests/framework/db/ActiveRecordTest.php b/tests/framework/db/ActiveRecordTest.php index b74803b94dd..18ec7caa1f0 100644 --- a/tests/framework/db/ActiveRecordTest.php +++ b/tests/framework/db/ActiveRecordTest.php @@ -44,7 +44,7 @@ abstract class ActiveRecordTest extends DatabaseTestCase { use ActiveRecordTestTrait; - protected function setUp() + protected function setUp(): void { parent::setUp(); ActiveRecord::$db = $this->getConnection(); @@ -199,7 +199,7 @@ public function testFindLazyViaTable() $this->assertCount(0, $order->books); $order = Order::find()->where(['id' => 1])->asArray()->one(); - $this->assertInternalType('array', $order); + $this->assertIsArray($order); } public function testFindEagerViaTable() @@ -225,10 +225,10 @@ public function testFindEagerViaTable() // https://github.com/yiisoft/yii2/issues/1402 $orders = Order::find()->with('books')->orderBy('id')->asArray()->all(); $this->assertCount(3, $orders); - $this->assertInternalType('array', $orders[0]['orderItems'][0]); + $this->assertIsArray($orders[0]['orderItems'][0]); $order = $orders[0]; - $this->assertInternalType('array', $order); + $this->assertIsArray($order); $this->assertEquals(1, $order['id']); $this->assertCount(2, $order['books']); $this->assertEquals(1, $order['books'][0]['id']); @@ -1123,7 +1123,7 @@ public function testFindSimpleRelationWithJoin() $this->assertInstanceOf('yiiunit\data\ar\Customer', $customerWithJoin); $customerWithJoinIndexOrdered = $order->customerJoinedWithProfileIndexOrdered; - $this->assertInternalType('array', $customerWithJoinIndexOrdered); + $this->assertIsArray($customerWithJoinIndexOrdered); $this->assertArrayHasKey('user1', $customerWithJoinIndexOrdered); $this->assertInstanceOf('yiiunit\data\ar\Customer', $customerWithJoinIndexOrdered['user1']); } @@ -1424,38 +1424,6 @@ public function testUnlinkAllViaTable() $this->assertEquals(5, $itemClass::find()->count()); } - /** - * @requires PHP 5.6 - */ - public function testCastValues() - { - $model = new Type(); - $model->int_col = 123; - $model->int_col2 = 456; - $model->smallint_col = 42; - $model->char_col = '1337'; - $model->char_col2 = 'test'; - $model->char_col3 = 'test123'; - $model->float_col = 3.742; - $model->float_col2 = 42.1337; - $model->bool_col = true; - $model->bool_col2 = false; - $model->save(false); - - /* @var $model Type */ - $model = Type::find()->one(); - $this->assertSame(123, $model->int_col); - $this->assertSame(456, $model->int_col2); - $this->assertSame(42, $model->smallint_col); - $this->assertSame('1337', trim($model->char_col)); - $this->assertSame('test', $model->char_col2); - $this->assertSame('test123', $model->char_col3); -// $this->assertSame(1337.42, $model->float_col); -// $this->assertSame(42.1337, $model->float_col2); -// $this->assertSame(true, $model->bool_col); -// $this->assertSame(false, $model->bool_col2); - } - public function testIssues() { // https://github.com/yiisoft/yii2/issues/4938 @@ -1934,6 +1902,8 @@ public function legalValuesForFindByCondition() */ public function testLegalValuesForFindByCondition($modelClassName, $validFilter) { + $this->expectNotToPerformAssertions(); + /** @var Query $query */ $query = $this->invokeMethod(\Yii::createObject($modelClassName), 'findByCondition', [$validFilter]); Customer::getDb()->queryBuilder->build($query); @@ -1970,11 +1940,15 @@ public function illegalValuesForFindByCondition() /** * @dataProvider illegalValuesForFindByCondition + * + * @param string $modelClassName The model class name. + * @param array $filterWithInjection The filter with injection. */ - public function testValueEscapingInFindByCondition($modelClassName, $filterWithInjection) + public function testValueEscapingInFindByCondition(string $modelClassName, array $filterWithInjection): void { - $this->expectException('yii\base\InvalidArgumentException'); - $this->expectExceptionMessageRegExp('/^Key "(.+)?" is not a column name and can not be used as a filter$/'); + $this->expectException(\yii\base\InvalidArgumentException::class); + $this->expectExceptionMessageMatches('/^Key "(.+)?" is not a column name and can not be used as a filter$/'); + /** @var Query $query */ $query = $this->invokeMethod(\Yii::createObject($modelClassName), 'findByCondition', $filterWithInjection); Customer::getDb()->queryBuilder->build($query); @@ -2096,16 +2070,6 @@ public function testIssetException() $this->assertFalse(isset($cat->exception)); } - /** - * @requires PHP 7 - */ - public function testIssetThrowable() - { - $cat = new Cat(); - $this->assertFalse(isset($cat->throwable)); - - } - /** * @see https://github.com/yiisoft/yii2/issues/15482 */ diff --git a/tests/framework/db/BaseActiveRecordTest.php b/tests/framework/db/BaseActiveRecordTest.php index 0427421cd81..1ef9013aa77 100644 --- a/tests/framework/db/BaseActiveRecordTest.php +++ b/tests/framework/db/BaseActiveRecordTest.php @@ -6,7 +6,7 @@ abstract class BaseActiveRecordTest extends DatabaseTestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); ActiveRecord::$db = $this->getConnection(); diff --git a/tests/framework/db/BatchQueryResultTest.php b/tests/framework/db/BatchQueryResultTest.php index 54487083e72..61667e7b35c 100644 --- a/tests/framework/db/BatchQueryResultTest.php +++ b/tests/framework/db/BatchQueryResultTest.php @@ -14,7 +14,7 @@ abstract class BatchQueryResultTest extends DatabaseTestCase { - public function setUp() + public function setUp(): void { parent::setUp(); ActiveRecord::$db = $this->getConnection(); diff --git a/tests/framework/db/CommandTest.php b/tests/framework/db/CommandTest.php index 041b788f3c1..7cfd2dd794f 100644 --- a/tests/framework/db/CommandTest.php +++ b/tests/framework/db/CommandTest.php @@ -193,7 +193,7 @@ public function testBindParamValue() $command->bindParam(':blob_col', $blobCol); $command->bindParam(':bool_col', $boolCol, \PDO::PARAM_BOOL); } else { - $floatCol = 1.23; + $floatCol = 1.230; $numericCol = '1.23'; $blobCol = "\x10\x11\x12"; $boolCol = false; @@ -205,18 +205,18 @@ public function testBindParamValue() $this->assertEquals(1, $command->execute()); $command = $db->createCommand('SELECT [[int_col]], [[char_col]], [[float_col]], [[blob_col]], [[numeric_col]], [[bool_col]] FROM {{type}}'); -// $command->prepare(); -// $command->pdoStatement->bindColumn('blob_col', $bc, \PDO::PARAM_LOB); + // $command->prepare(); + // $command->pdoStatement->bindColumn('blob_col', $bc, \PDO::PARAM_LOB); $row = $command->queryOne(); $this->assertEquals($intCol, $row['int_col']); $this->assertEquals($charCol, $row['char_col']); - $this->assertEquals($floatCol, $row['float_col']); + $this->assertEquals($floatCol, (float) $row['float_col']); if ($this->driverName === 'mysql' || $this->driverName === 'sqlite' || $this->driverName === 'oci') { $this->assertEquals($blobCol, $row['blob_col']); } elseif (\defined('HHVM_VERSION') && $this->driverName === 'pgsql') { // HHVMs pgsql implementation does not seem to support blob columns correctly. } else { - $this->assertInternalType('resource', $row['blob_col']); + $this->assertIsResource($row['blob_col']); $this->assertEquals($blobCol, stream_get_contents($row['blob_col'])); } $this->assertEquals($numericCol, $row['numeric_col']); @@ -281,7 +281,7 @@ public function testFetchMode() $command = $db->createCommand($sql); $command->fetchMode = \PDO::FETCH_OBJ; $result = $command->queryOne(); - $this->assertInternalType('object', $result); + $this->assertIsObject($result); // FETCH_NUM, customized in query method $sql = 'SELECT * FROM {{customer}}'; @@ -623,9 +623,8 @@ public function invalidSelectColumns() * Test INSERT INTO ... SELECT SQL statement with wrong query object. * * @dataProvider invalidSelectColumns - * @expectedException \yii\base\InvalidParamException - * @expectedExceptionMessage Expected select query object with enumerated (named) parameters - * @param mixed $invalidSelectColumns + * + * @param array|string $invalidSelectColumns Invalid select columns. */ public function testInsertSelectFailed($invalidSelectColumns) { @@ -634,10 +633,11 @@ public function testInsertSelectFailed($invalidSelectColumns) $db = $this->getConnection(); $command = $db->createCommand(); - $command->insert( - '{{customer}}', - $query - )->execute(); + + $this->expectException(\yii\base\InvalidArgumentException::class); + $this->expectExceptionMessage('Expected select query object with enumerated (named) parameters'); + + $command->insert('{{customer}}', $query)->execute(); } public function testInsertExpression() @@ -1222,7 +1222,7 @@ public function testAddDropCheck() $this->assertEmpty($schema->getTableChecks($tableName, true)); $db->createCommand()->addCheck($name, $tableName, '[[int1]] > 1')->execute(); - $this->assertRegExp('/^.*int1.*>.*1.*$/', $schema->getTableChecks($tableName, true)[0]->expression); + $this->assertMatchesRegularExpression('/^.*int1.*>.*1.*$/', $schema->getTableChecks($tableName, true)[0]->expression); $db->createCommand()->dropCheck($name, $tableName)->execute(); $this->assertEmpty($schema->getTableChecks($tableName, true)); diff --git a/tests/framework/db/ConnectionTest.php b/tests/framework/db/ConnectionTest.php index a155517ffdf..848ec9ddad1 100644 --- a/tests/framework/db/ConnectionTest.php +++ b/tests/framework/db/ConnectionTest.php @@ -219,17 +219,18 @@ public function testTransactionIsolation() $transaction->commit(); $transaction = $connection->beginTransaction(Transaction::SERIALIZABLE); - $transaction->commit(); - $this->assertTrue(true); // should not be any exception so far + $this->expectNotToPerformAssertions(); + + $transaction->commit(); } - /** - * @expectedException \Exception - */ public function testTransactionShortcutException() { $connection = $this->getConnection(true); + + $this->expectException(\Exception::class); + $connection->transaction(function () use ($connection) { $connection->createCommand()->insert('profile', ['description' => 'test transaction shortcut'])->execute(); throw new \Exception('Exception in transaction shortcut'); @@ -400,7 +401,11 @@ private function runExceptionTest($connection) try { $connection->createCommand('INSERT INTO qlog1(a) VALUES(:a);', [':a' => 1])->execute(); } catch (\yii\db\Exception $e) { - $this->assertContains('INSERT INTO qlog1(a) VALUES(1);', $e->getMessage(), 'Exception message should contain raw SQL query: ' . (string) $e); + $this->assertStringContainsString( + 'INSERT INTO qlog1(a) VALUES(1);', + $e->getMessage(), + 'Exception message should contain raw SQL query: ' . (string) $e + ); $thrown = true; } $this->assertTrue($thrown, 'An exception should have been thrown by the command.'); @@ -409,7 +414,10 @@ private function runExceptionTest($connection) try { $connection->createCommand('SELECT * FROM qlog1 WHERE id=:a ORDER BY nonexistingcolumn;', [':a' => 1])->queryAll(); } catch (\yii\db\Exception $e) { - $this->assertContains('SELECT * FROM qlog1 WHERE id=1 ORDER BY nonexistingcolumn;', $e->getMessage(), 'Exception message should contain raw SQL query: ' . (string) $e); + $this->assertStringContainsString( + 'SELECT * FROM qlog1 WHERE id=1 ORDER BY nonexistingcolumn;', + $e->getMessage(), 'Exception message should contain raw SQL query: ' . (string) $e, + ); $thrown = true; } $this->assertTrue($thrown, 'An exception should have been thrown by the command.'); diff --git a/tests/framework/db/DatabaseTestCase.php b/tests/framework/db/DatabaseTestCase.php index 53ea945623e..c9275ebcfaf 100644 --- a/tests/framework/db/DatabaseTestCase.php +++ b/tests/framework/db/DatabaseTestCase.php @@ -24,7 +24,7 @@ abstract class DatabaseTestCase extends TestCase private $_db; - protected function setUp() + protected function setUp(): void { if ($this->driverName === null) { throw new \Exception('driverName is not set for a DatabaseTestCase.'); @@ -44,7 +44,7 @@ protected function setUp() $this->mockApplication(); } - protected function tearDown() + protected function tearDown(): void { if ($this->_db) { $this->_db->close(); diff --git a/tests/framework/db/QueryTest.php b/tests/framework/db/QueryTest.php index 4de29107045..515f70a485a 100644 --- a/tests/framework/db/QueryTest.php +++ b/tests/framework/db/QueryTest.php @@ -333,8 +333,7 @@ public function testLimitOffsetWithExpression() $this->assertCount(2, $result); $this->assertNotContains(1, $result); - $this->assertContains(2, $result); - $this->assertContains(3, $result); + $this->assertEquals([2, 3], $result); } public function testUnion() diff --git a/tests/framework/db/SchemaTest.php b/tests/framework/db/SchemaTest.php index af02b2170b6..618c39848ed 100644 --- a/tests/framework/db/SchemaTest.php +++ b/tests/framework/db/SchemaTest.php @@ -528,7 +528,7 @@ public function testColumnSchema() $this->assertSame($expected['precision'], $column->precision, "precision of column $name does not match."); $this->assertSame($expected['scale'], $column->scale, "scale of column $name does not match."); if (\is_object($expected['defaultValue'])) { - $this->assertInternalType('object', $column->defaultValue, "defaultValue of column $name is expected to be an object but it is not."); + $this->assertIsObject($column->defaultValue, "defaultValue of column $name is expected to be an object but it is not."); $this->assertEquals((string)$expected['defaultValue'], (string)$column->defaultValue, "defaultValue of column $name does not match."); } else { $this->assertEquals($expected['defaultValue'], $column->defaultValue, "defaultValue of column $name does not match."); @@ -782,12 +782,25 @@ public function testTableSchemaConstraintsWithPdoLowercase($tableName, $type, $e private function assertMetadataEquals($expected, $actual) { - $this->assertInternalType(strtolower(\gettype($expected)), $actual); + switch (\strtolower(\gettype($expected))) { + case 'object': + $this->assertIsObject($actual); + break; + case 'array': + $this->assertIsArray($actual); + break; + case 'null': + $this->assertNull($actual); + break; + } + if (\is_array($expected)) { $this->normalizeArrayKeys($expected, false); $this->normalizeArrayKeys($actual, false); } + $this->normalizeConstraints($expected, $actual); + if (\is_array($expected)) { $this->normalizeArrayKeys($expected, true); $this->normalizeArrayKeys($actual, true); diff --git a/tests/framework/db/mssql/CommandTest.php b/tests/framework/db/mssql/CommandTest.php index 25a58a3a9e4..e574ddc56c3 100644 --- a/tests/framework/db/mssql/CommandTest.php +++ b/tests/framework/db/mssql/CommandTest.php @@ -55,7 +55,7 @@ public function testBindParamValue() $command = $db->createCommand($sql); $intCol = 123; $charCol = 'abc'; - $floatCol = 1.23; + $floatCol = 1.230; $blobCol = "\x10\x11\x12"; $numericCol = '1.23'; $boolCol = false; @@ -71,7 +71,7 @@ public function testBindParamValue() $row = $db->createCommand($sql)->queryOne(); $this->assertEquals($intCol, $row['int_col']); $this->assertEquals($charCol, trim($row['char_col'])); - $this->assertEquals($floatCol, $row['float_col']); + $this->assertEquals($floatCol, (float) $row['float_col']); $this->assertEquals($blobCol, $row['blob_col']); $this->assertEquals($numericCol, $row['numeric_col']); @@ -101,7 +101,7 @@ public function testAddDropDefaultValue() $db = $this->getConnection(false); $tableName = 'test_def'; $name = 'test_def_constraint'; - /** @var \yii\db\pgsql\Schema $schema */ + /** @var \yii\db\mssql\Schema $schema */ $schema = $db->getSchema(); if ($schema->getTableSchema($tableName) !== null) { @@ -113,7 +113,7 @@ public function testAddDropDefaultValue() $this->assertEmpty($schema->getTableDefaultValues($tableName, true)); $db->createCommand()->addDefaultValue($name, $tableName, 'int1', 41)->execute(); - $this->assertRegExp('/^.*41.*$/', $schema->getTableDefaultValues($tableName, true)[0]->value); + $this->assertMatchesRegularExpression('/^.*41.*$/', $schema->getTableDefaultValues($tableName, true)[0]->value); $db->createCommand()->dropDefaultValue($name, $tableName)->execute(); $this->assertEmpty($schema->getTableDefaultValues($tableName, true)); diff --git a/tests/framework/db/mysql/QueryTest.php b/tests/framework/db/mysql/QueryTest.php index 9f647308c6f..8e1cf44144e 100644 --- a/tests/framework/db/mysql/QueryTest.php +++ b/tests/framework/db/mysql/QueryTest.php @@ -43,9 +43,7 @@ public function testLimitOffsetWithExpression() $result = $query->column($this->getConnection()); $this->assertCount(2, $result); - $this->assertNotContains(1, $result); - $this->assertContains(2, $result); - $this->assertContains(3, $result); + $this->assertEquals([2, 3], $result); } } diff --git a/tests/framework/db/oci/ActiveRecordTest.php b/tests/framework/db/oci/ActiveRecordTest.php index 6be10ccc352..b73224ee6de 100644 --- a/tests/framework/db/oci/ActiveRecordTest.php +++ b/tests/framework/db/oci/ActiveRecordTest.php @@ -25,9 +25,8 @@ class ActiveRecordTest extends \yiiunit\framework\db\ActiveRecordTest public function testCastValues() { - // pass, because boolean casting is not available - return; $model = new Type(); + $model->int_col = 123; $model->int_col2 = 456; $model->smallint_col = 42; @@ -42,13 +41,14 @@ public function testCastValues() /* @var $model Type */ $model = Type::find()->one(); + $this->assertSame(123, $model->int_col); $this->assertSame(456, $model->int_col2); $this->assertSame(42, $model->smallint_col); $this->assertSame('1337', trim($model->char_col)); $this->assertSame('test', $model->char_col2); $this->assertSame('test123', $model->char_col3); - $this->assertSame(1337.42, $model->float_col); + $this->assertSame(3.742, $model->float_col); $this->assertSame(42.1337, $model->float_col2); $this->assertEquals('1', $model->bool_col); $this->assertEquals('0', $model->bool_col2); diff --git a/tests/framework/db/oci/ConnectionTest.php b/tests/framework/db/oci/ConnectionTest.php index 0d0bf842ef6..6a6aaba991e 100644 --- a/tests/framework/db/oci/ConnectionTest.php +++ b/tests/framework/db/oci/ConnectionTest.php @@ -84,6 +84,9 @@ public function testTransactionIsolation() $transaction->commit(); $transaction = $connection->beginTransaction(Transaction::SERIALIZABLE); + + $this->expectNotToPerformAssertions(); + $transaction->commit(); } diff --git a/tests/framework/db/pgsql/ArrayParserTest.php b/tests/framework/db/pgsql/ArrayParserTest.php index 1962676180a..fdea8c9b20a 100644 --- a/tests/framework/db/pgsql/ArrayParserTest.php +++ b/tests/framework/db/pgsql/ArrayParserTest.php @@ -12,7 +12,7 @@ class ArrayParserTest extends TestCase */ protected $arrayParser; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/db/pgsql/ConnectionTest.php b/tests/framework/db/pgsql/ConnectionTest.php index 2baa79e3b8d..16defb7e8e3 100644 --- a/tests/framework/db/pgsql/ConnectionTest.php +++ b/tests/framework/db/pgsql/ConnectionTest.php @@ -19,7 +19,7 @@ class ConnectionTest extends \yiiunit\framework\db\ConnectionTest public function testConnection() { - $this->assertInternalType('object', $this->getConnection(true)); + $this->assertIsObject($this->getConnection(true)); } public function testQuoteValue() @@ -99,8 +99,9 @@ public function testTransactionIsolation() $transaction = $connection->beginTransaction(); $transaction->setIsolationLevel(Transaction::SERIALIZABLE . ' READ ONLY DEFERRABLE'); - $transaction->commit(); - $this->assertTrue(true); // No error occurred – assert passed. + $this->expectNotToPerformAssertions(); + + $transaction->commit(); } } diff --git a/tests/framework/db/sqlite/ConnectionTest.php b/tests/framework/db/sqlite/ConnectionTest.php index 5ff572313f6..7b41cd5b44d 100644 --- a/tests/framework/db/sqlite/ConnectionTest.php +++ b/tests/framework/db/sqlite/ConnectionTest.php @@ -44,9 +44,10 @@ public function testTransactionIsolation() $transaction->rollBack(); $transaction = $connection->beginTransaction(Transaction::SERIALIZABLE); - $transaction->rollBack(); - $this->assertTrue(true); // No exceptions means test is passed. + $this->expectNotToPerformAssertions(); + + $transaction->rollBack(); } public function testMasterSlave() diff --git a/tests/framework/di/ContainerTest.php b/tests/framework/di/ContainerTest.php index 4df6140a819..2dbe0e5609d 100644 --- a/tests/framework/di/ContainerTest.php +++ b/tests/framework/di/ContainerTest.php @@ -40,7 +40,7 @@ */ class ContainerTest extends TestCase { - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); Yii::$container = new Container(); @@ -443,11 +443,10 @@ public function testGetByClassIndirectly() $this->assertSame(42, $qux->a); } - /** - * @expectedException \yii\base\InvalidConfigException - */ public function testThrowingNotFoundException() { + $this->expectException(\yii\di\NotInstantiableException::class); + $container = new Container(); $container->get('non_existing'); } @@ -480,31 +479,6 @@ public function testContainerSingletons() $this->assertSame($foo, $sameFoo); } - /** - * @requires PHP 5.6 - */ - public function testVariadicConstructor() - { - if (\defined('HHVM_VERSION')) { - static::markTestSkipped('Can not test on HHVM because it does not support variadics.'); - } - - $container = new Container(); - $container->get('yiiunit\framework\di\stubs\Variadic'); - } - - /** - * @requires PHP 5.6 - */ - public function testVariadicCallable() - { - if (\defined('HHVM_VERSION')) { - static::markTestSkipped('Can not test on HHVM because it does not support variadics.'); - } - - require __DIR__ . '/testContainerWithVariadicCallable.php'; - } - /** * @see https://github.com/yiisoft/yii2/issues/18245 */ @@ -512,7 +486,7 @@ public function testDelayedInitializationOfSubArray() { $definitions = [ 'test' => [ - 'class' => Corge::className(), + 'class' => Corge::class, '__construct()' => [ [Instance::of('setLater')], ], @@ -520,7 +494,7 @@ public function testDelayedInitializationOfSubArray() ]; $application = Yii::createObject([ - '__class' => \yii\web\Application::className(), + '__class' => \yii\web\Application::class, 'basePath' => __DIR__, 'id' => 'test', 'components' => [ @@ -534,7 +508,8 @@ public function testDelayedInitializationOfSubArray() ]); Yii::$container->set('setLater', new Qux()); - Yii::$container->get('test'); + + $this->assertInstanceOf(Corge::class, Yii::$container->get('test')); } /** diff --git a/tests/framework/di/InstanceTest.php b/tests/framework/di/InstanceTest.php index fe61a6bdf95..8fbd87ebf3c 100644 --- a/tests/framework/di/InstanceTest.php +++ b/tests/framework/di/InstanceTest.php @@ -21,7 +21,7 @@ */ class InstanceTest extends TestCase { - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); Yii::$container = new Container(); @@ -58,8 +58,9 @@ public function testEnsure() public function testEnsure_NonExistingComponentException() { $container = new Container(); - $this->expectException('yii\base\InvalidConfigException'); - $this->expectExceptionMessageRegExp('/^Failed to instantiate component or class/i'); + $this->expectException(\yii\base\InvalidConfigException::class); + $this->expectExceptionMessageMatches('/^Failed to instantiate component or class/i'); + Instance::ensure('cache', 'yii\cache\Cache', $container); } @@ -69,8 +70,9 @@ public function testEnsure_NonExistingComponentException() public function testEnsure_NonExistingClassException() { $container = new Container(); - $this->expectException('yii\base\InvalidConfigException'); - $this->expectExceptionMessageRegExp('/^Failed to instantiate component or class/i'); + $this->expectException(\yii\base\InvalidConfigException::class); + $this->expectExceptionMessageMatches('/^Failed to instantiate component or class/i'); + Instance::ensure('yii\cache\DoesNotExist', 'yii\cache\Cache', $container); } @@ -171,7 +173,7 @@ public function testRestoreAfterVarExport() $instance = Instance::of('something'); $export = var_export($instance, true); - $this->assertRegExp('~yii\\\\di\\\\Instance::__set_state\(array\(\s+\'id\' => \'something\',\s+\'optional\' => false,\s+\)\)~', $export); + $this->assertMatchesRegularExpression('~yii\\\\di\\\\Instance::__set_state\(array\(\s+\'id\' => \'something\',\s+\'optional\' => false,\s+\)\)~', $export); $this->assertEquals($instance, Instance::__set_state([ 'id' => 'something', diff --git a/tests/framework/filters/AccessRuleTest.php b/tests/framework/filters/AccessRuleTest.php index 620766788d8..56bcd341574 100644 --- a/tests/framework/filters/AccessRuleTest.php +++ b/tests/framework/filters/AccessRuleTest.php @@ -23,7 +23,7 @@ */ class AccessRuleTest extends \yiiunit\TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/filters/ContentNegotiatorTest.php b/tests/framework/filters/ContentNegotiatorTest.php index d52bb367c93..221716b80ec 100644 --- a/tests/framework/filters/ContentNegotiatorTest.php +++ b/tests/framework/filters/ContentNegotiatorTest.php @@ -20,7 +20,7 @@ */ class ContentNegotiatorTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -55,10 +55,6 @@ public function testWhenLanguageGETParamIsArray() $this->assertEquals($targetLanguage, Yii::$app->language); } - /** - * @expectedException yii\web\BadRequestHttpException - * @expectedExceptionMessageRegExp |Invalid data received for GET parameter '.+'| - */ public function testWhenFormatGETParamIsArray() { list($action, $filter) = $this->mockActionAndFilter(); @@ -74,6 +70,9 @@ public function testWhenFormatGETParamIsArray() 'application/xml' => Response::FORMAT_XML, ]; + $this->expectException(\yii\web\BadRequestHttpException::class); + $this->expectExceptionMessage('Invalid data received for GET parameter'); + $filter->beforeAction($action); } diff --git a/tests/framework/filters/HostControlTest.php b/tests/framework/filters/HostControlTest.php index 39478fe00ed..4f5a32eb8bc 100644 --- a/tests/framework/filters/HostControlTest.php +++ b/tests/framework/filters/HostControlTest.php @@ -19,7 +19,7 @@ */ class HostControlTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/filters/HttpCacheTest.php b/tests/framework/filters/HttpCacheTest.php index 8f0f0da6054..a5be733520a 100644 --- a/tests/framework/filters/HttpCacheTest.php +++ b/tests/framework/filters/HttpCacheTest.php @@ -15,7 +15,7 @@ */ class HttpCacheTest extends \yiiunit\TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/filters/PageCacheTest.php b/tests/framework/filters/PageCacheTest.php index 6dc5ef5f9a6..b89259168cf 100644 --- a/tests/framework/filters/PageCacheTest.php +++ b/tests/framework/filters/PageCacheTest.php @@ -25,14 +25,14 @@ */ class PageCacheTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $_SERVER['SCRIPT_FILENAME'] = '/index.php'; $_SERVER['SCRIPT_NAME'] = '/index.php'; } - protected function tearDown() + protected function tearDown(): void { CacheTestCase::$time = null; CacheTestCase::$microtime = null; diff --git a/tests/framework/filters/RateLimiterTest.php b/tests/framework/filters/RateLimiterTest.php index 1bbaad6e299..70df2a48f95 100644 --- a/tests/framework/filters/RateLimiterTest.php +++ b/tests/framework/filters/RateLimiterTest.php @@ -22,7 +22,7 @@ */ class RateLimiterTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -30,7 +30,7 @@ protected function setUp() $this->mockWebApplication(); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); Yii::setLogger(null); diff --git a/tests/framework/filters/auth/AuthMethodTest.php b/tests/framework/filters/auth/AuthMethodTest.php index beea7740c19..f045b26b6ad 100644 --- a/tests/framework/filters/auth/AuthMethodTest.php +++ b/tests/framework/filters/auth/AuthMethodTest.php @@ -16,7 +16,7 @@ class AuthMethodTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/filters/auth/AuthTest.php b/tests/framework/filters/auth/AuthTest.php index 102d215064e..1c4a7086655 100644 --- a/tests/framework/filters/auth/AuthTest.php +++ b/tests/framework/filters/auth/AuthTest.php @@ -25,7 +25,7 @@ */ class AuthTest extends \yiiunit\TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/filters/auth/CompositeAuthTest.php b/tests/framework/filters/auth/CompositeAuthTest.php index 6a9245c5e2b..c378550883a 100644 --- a/tests/framework/filters/auth/CompositeAuthTest.php +++ b/tests/framework/filters/auth/CompositeAuthTest.php @@ -103,7 +103,7 @@ public function behaviors() */ class CompositeAuthTest extends \yiiunit\TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/grid/ActionColumnTest.php b/tests/framework/grid/ActionColumnTest.php index 7b15414d43c..c5d9bcfa9f0 100644 --- a/tests/framework/grid/ActionColumnTest.php +++ b/tests/framework/grid/ActionColumnTest.php @@ -70,34 +70,34 @@ public function testRenderDataCell() //test default visible button $columnContents = $column->renderDataCell(['id' => 1], 1, 0); - $this->assertContains('update_button', $columnContents); + $this->assertStringContainsString('update_button', $columnContents); //test visible button $column->visibleButtons = [ 'update' => true, ]; $columnContents = $column->renderDataCell(['id' => 1], 1, 0); - $this->assertContains('update_button', $columnContents); + $this->assertStringContainsString('update_button', $columnContents); //test visible button (condition is callback) $column->visibleButtons = [ 'update' => function ($model, $key, $index) {return $model['id'] == 1;}, ]; $columnContents = $column->renderDataCell(['id' => 1], 1, 0); - $this->assertContains('update_button', $columnContents); + $this->assertStringContainsString('update_button', $columnContents); //test invisible button $column->visibleButtons = [ 'update' => false, ]; $columnContents = $column->renderDataCell(['id' => 1], 1, 0); - $this->assertNotContains('update_button', $columnContents); + $this->assertStringNotContainsString('update_button', $columnContents); //test invisible button (condition is callback) $column->visibleButtons = [ 'update' => function ($model, $key, $index) {return $model['id'] != 1;}, ]; $columnContents = $column->renderDataCell(['id' => 1], 1, 0); - $this->assertNotContains('update_button', $columnContents); + $this->assertStringNotContainsString('update_button', $columnContents); } } diff --git a/tests/framework/grid/CheckboxColumnTest.php b/tests/framework/grid/CheckboxColumnTest.php index 6a2442019c7..83cdba21681 100644 --- a/tests/framework/grid/CheckboxColumnTest.php +++ b/tests/framework/grid/CheckboxColumnTest.php @@ -21,7 +21,7 @@ */ class CheckboxColumnTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); IntlTestHelper::resetIntlStatus(); @@ -35,34 +35,34 @@ protected function setUp() public function testInputName() { $column = new CheckboxColumn(['name' => 'selection', 'grid' => $this->getGrid()]); - $this->assertContains('name="selection_all"', $column->renderHeaderCell()); + $this->assertStringContainsString('name="selection_all"', $column->renderHeaderCell()); $column = new CheckboxColumn(['name' => 'selections[]', 'grid' => $this->getGrid()]); - $this->assertContains('name="selections_all"', $column->renderHeaderCell()); + $this->assertStringContainsString('name="selections_all"', $column->renderHeaderCell()); $column = new CheckboxColumn(['name' => 'MyForm[grid1]', 'grid' => $this->getGrid()]); - $this->assertContains('name="MyForm[grid1_all]"', $column->renderHeaderCell()); + $this->assertStringContainsString('name="MyForm[grid1_all]"', $column->renderHeaderCell()); $column = new CheckboxColumn(['name' => 'MyForm[grid1][]', 'grid' => $this->getGrid()]); - $this->assertContains('name="MyForm[grid1_all]"', $column->renderHeaderCell()); + $this->assertStringContainsString('name="MyForm[grid1_all]"', $column->renderHeaderCell()); $column = new CheckboxColumn(['name' => 'MyForm[grid1][key]', 'grid' => $this->getGrid()]); - $this->assertContains('name="MyForm[grid1][key_all]"', $column->renderHeaderCell()); + $this->assertStringContainsString('name="MyForm[grid1][key_all]"', $column->renderHeaderCell()); $column = new CheckboxColumn(['name' => 'MyForm[grid1][key][]', 'grid' => $this->getGrid()]); - $this->assertContains('name="MyForm[grid1][key_all]"', $column->renderHeaderCell()); + $this->assertStringContainsString('name="MyForm[grid1][key_all]"', $column->renderHeaderCell()); } public function testInputValue() { $column = new CheckboxColumn(['grid' => $this->getGrid()]); - $this->assertContains('value="1"', $column->renderDataCell([], 1, 0)); - $this->assertContains('value="42"', $column->renderDataCell([], 42, 0)); - $this->assertContains('value="[1,42]"', $column->renderDataCell([], [1, 42], 0)); + $this->assertStringContainsString('value="1"', $column->renderDataCell([], 1, 0)); + $this->assertStringContainsString('value="42"', $column->renderDataCell([], 42, 0)); + $this->assertStringContainsString('value="[1,42]"', $column->renderDataCell([], [1, 42], 0)); $column = new CheckboxColumn(['checkboxOptions' => ['value' => 42], 'grid' => $this->getGrid()]); - $this->assertNotContains('value="1"', $column->renderDataCell([], 1, 0)); - $this->assertContains('value="42"', $column->renderDataCell([], 1, 0)); + $this->assertStringNotContainsString('value="1"', $column->renderDataCell([], 1, 0)); + $this->assertStringContainsString('value="42"', $column->renderDataCell([], 1, 0)); $column = new CheckboxColumn([ 'checkboxOptions' => function ($model, $key, $index, $column) { @@ -70,9 +70,9 @@ public function testInputValue() }, 'grid' => $this->getGrid(), ]); - $this->assertContains('value="1"', $column->renderDataCell([], 1, 0)); - $this->assertContains('value="42"', $column->renderDataCell([], 42, 0)); - $this->assertContains('value="[1,42]"', $column->renderDataCell([], [1, 42], 0)); + $this->assertStringContainsString('value="1"', $column->renderDataCell([], 1, 0)); + $this->assertStringContainsString('value="42"', $column->renderDataCell([], 42, 0)); + $this->assertStringContainsString('value="[1,42]"', $column->renderDataCell([], [1, 42], 0)); $column = new CheckboxColumn([ 'checkboxOptions' => function ($model, $key, $index, $column) { @@ -80,8 +80,8 @@ public function testInputValue() }, 'grid' => $this->getGrid(), ]); - $this->assertNotContains('value="1"', $column->renderDataCell([], 1, 0)); - $this->assertContains('value="42"', $column->renderDataCell([], 1, 0)); + $this->assertStringNotContainsString('value="1"', $column->renderDataCell([], 1, 0)); + $this->assertStringContainsString('value="42"', $column->renderDataCell([], 1, 0)); } public function testContent() @@ -92,7 +92,7 @@ public function testContent() }, 'grid' => $this->getGrid(), ]); - $this->assertContains('', $column->renderDataCell([], 1, 0)); + $this->assertStringContainsString('', $column->renderDataCell([], 1, 0)); $column = new CheckboxColumn([ 'content' => function ($model, $key, $index, $column) { @@ -100,7 +100,7 @@ public function testContent() }, 'grid' => $this->getGrid(), ]); - $this->assertContains(Html::checkBox('checkBoxInput', false), $column->renderDataCell([], 1, 0)); + $this->assertStringContainsString(Html::checkBox('checkBoxInput', false), $column->renderDataCell([], 1, 0)); } /** diff --git a/tests/framework/grid/GridViewTest.php b/tests/framework/grid/GridViewTest.php index b698011493b..5f234e7424b 100644 --- a/tests/framework/grid/GridViewTest.php +++ b/tests/framework/grid/GridViewTest.php @@ -20,7 +20,7 @@ */ class GridViewTest extends \yiiunit\TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication([ @@ -197,6 +197,9 @@ public function testHeaderLabels() 'urlManager' => $urlManager, 'attributes' => ['attr1', 'attr2'], ]); + + $this->expectNotToPerformAssertions(); + $grid->renderTableHeader(); // If NoAutoLabels::generateAttributeLabel() has not been called no exception will be thrown meaning this test passed successfully. diff --git a/tests/framework/grid/RadiobuttonColumnTest.php b/tests/framework/grid/RadiobuttonColumnTest.php index 51292d3d2ce..51e5bfced8d 100644 --- a/tests/framework/grid/RadiobuttonColumnTest.php +++ b/tests/framework/grid/RadiobuttonColumnTest.php @@ -22,15 +22,12 @@ */ class RadiobuttonColumnTest extends TestCase { - /** - * @expectedException \yii\base\InvalidConfigException - * @expectedExceptionMessage The "name" property must be set. - */ public function testException() { - new RadioButtonColumn([ - 'name' => null, - ]); + $this->expectException(\yii\base\InvalidConfigException::class); + $this->expectExceptionMessage('The "name" property must be set.'); + + new RadioButtonColumn(['name' => null]); } public function testOptionsByArray() @@ -67,14 +64,14 @@ public function testContent() return null; } ]); - $this->assertContains('', $column->renderDataCell([], 1, 0)); + $this->assertStringContainsString('', $column->renderDataCell([], 1, 0)); $column = new RadioButtonColumn([ 'content' => function ($model, $key, $index, $column) { return Html::radio('radioButtonInput', false); } ]); - $this->assertContains(Html::radio('radioButtonInput', false), $column->renderDataCell([], 1, 0)); + $this->assertStringContainsString(Html::radio('radioButtonInput', false), $column->renderDataCell([], 1, 0)); } public function testMultipleInGrid() diff --git a/tests/framework/helpers/ArrayHelperTest.php b/tests/framework/helpers/ArrayHelperTest.php index 0d706bc552f..84b18173648 100644 --- a/tests/framework/helpers/ArrayHelperTest.php +++ b/tests/framework/helpers/ArrayHelperTest.php @@ -20,7 +20,7 @@ */ class ArrayHelperTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -876,13 +876,12 @@ public function testGetValueObjects() public function testGetValueNonexistingProperties1() { - if (PHP_VERSION_ID < 80000) { - $this->expectException('PHPUnit_Framework_Error_Notice'); - } else { - $this->expectException('PHPUnit_Framework_Error_Warning'); + try { + $object = new Post1(); + ArrayHelper::getValue($object, 'nonExisting'); + } catch (\Throwable $th) { + $this->assertEquals('Undefined property: yiiunit\framework\helpers\Post1::$nonExisting', $th->getMessage()); } - $object = new Post1(); - ArrayHelper::getValue($object, 'nonExisting'); } public function testGetValueNonexistingPropertiesForArrayObject() diff --git a/tests/framework/helpers/BaseConsoleTest.php b/tests/framework/helpers/BaseConsoleTest.php index d9a4391dc10..aa7bc11061e 100644 --- a/tests/framework/helpers/BaseConsoleTest.php +++ b/tests/framework/helpers/BaseConsoleTest.php @@ -12,7 +12,7 @@ */ class BaseConsoleTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); diff --git a/tests/framework/helpers/ConsoleTest.php b/tests/framework/helpers/ConsoleTest.php index cbd1b322ee5..eb16d3056c7 100644 --- a/tests/framework/helpers/ConsoleTest.php +++ b/tests/framework/helpers/ConsoleTest.php @@ -18,7 +18,7 @@ */ class ConsoleTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/helpers/FileHelperTest.php b/tests/framework/helpers/FileHelperTest.php index 448e6148fd4..e5d60c2cfa4 100644 --- a/tests/framework/helpers/FileHelperTest.php +++ b/tests/framework/helpers/FileHelperTest.php @@ -21,7 +21,7 @@ class FileHelperTest extends TestCase */ private $testFilePath = ''; - public function setUp() + public function setUp(): void { $this->testFilePath = Yii::getAlias('@yiiunit/runtime') . DIRECTORY_SEPARATOR . get_class($this); $this->createDir($this->testFilePath); @@ -56,7 +56,7 @@ private function isChmodReliable() return $mode === '0700'; } - public function tearDown() + public function tearDown(): void { $this->removeDir($this->testFilePath); } @@ -140,7 +140,7 @@ protected function createFileStructure(array $items, $basePath = '') */ protected function assertFileMode($expectedMode, $fileName, $message = '') { - $expectedMode = sprintf('%o', $expectedMode); + $expectedMode = sprintf('%04o', $expectedMode); $this->assertEquals($expectedMode, $this->getMode($fileName), $message); } @@ -258,7 +258,7 @@ public function testCopyDirectoryNotRecursive() $fileName = $dstDirName . DIRECTORY_SEPARATOR . $name; if (is_array($content)) { - $this->assertFileNotExists($fileName); + $this->assertFileDoesNotExist($fileName); } else { $this->assertFileExists($fileName); $this->assertStringEqualsFile($fileName, $content, 'Incorrect file content!'); @@ -364,6 +364,8 @@ public function testCopyDirWithSameName() 'data-backup' => [], ]); + $this->expectNotToPerformAssertions(); + FileHelper::copyDirectory( $this->testFilePath . DIRECTORY_SEPARATOR . 'data', $this->testFilePath . DIRECTORY_SEPARATOR . 'data-backup' @@ -389,7 +391,7 @@ public function testRemoveDirectory() FileHelper::removeDirectory($dirName); - $this->assertFileNotExists($dirName, 'Unable to remove directory!'); + $this->assertFileDoesNotExist($dirName, 'Unable to remove directory!'); // should be silent about non-existing directories FileHelper::removeDirectory($basePath . DIRECTORY_SEPARATOR . 'nonExisting'); @@ -432,10 +434,10 @@ public function testRemoveDirectorySymlinks1() $this->assertTrue(is_dir($basePath . 'directory')); $this->assertFileExists($basePath . 'directory' . DIRECTORY_SEPARATOR . 'standard-file-1'); // symlinked directory still have it's file $this->assertFalse(is_dir($basePath . 'symlinks')); - $this->assertFileNotExists($basePath . 'symlinks' . DIRECTORY_SEPARATOR . 'standard-file-2'); - $this->assertFileNotExists($basePath . 'symlinks' . DIRECTORY_SEPARATOR . 'symlinked-file'); + $this->assertFileDoesNotExist($basePath . 'symlinks' . DIRECTORY_SEPARATOR . 'standard-file-2'); + $this->assertFileDoesNotExist($basePath . 'symlinks' . DIRECTORY_SEPARATOR . 'symlinked-file'); $this->assertFalse(is_dir($basePath . 'symlinks' . DIRECTORY_SEPARATOR . 'symlinked-directory')); - $this->assertFileNotExists($basePath . 'symlinks' . DIRECTORY_SEPARATOR . 'symlinked-directory' . DIRECTORY_SEPARATOR . 'standard-file-1'); + $this->assertFileDoesNotExist($basePath . 'symlinks' . DIRECTORY_SEPARATOR . 'symlinked-directory' . DIRECTORY_SEPARATOR . 'standard-file-1'); } public function testRemoveDirectorySymlinks2() @@ -473,12 +475,12 @@ public function testRemoveDirectorySymlinks2() $this->assertFileExists($basePath . 'file'); $this->assertTrue(is_dir($basePath . 'directory')); - $this->assertFileNotExists($basePath . 'directory' . DIRECTORY_SEPARATOR . 'standard-file-1'); // symlinked directory doesn't have it's file now + $this->assertFileDoesNotExist($basePath . 'directory' . DIRECTORY_SEPARATOR . 'standard-file-1'); // symlinked directory doesn't have it's file now $this->assertFalse(is_dir($basePath . 'symlinks')); - $this->assertFileNotExists($basePath . 'symlinks' . DIRECTORY_SEPARATOR . 'standard-file-2'); - $this->assertFileNotExists($basePath . 'symlinks' . DIRECTORY_SEPARATOR . 'symlinked-file'); + $this->assertFileDoesNotExist($basePath . 'symlinks' . DIRECTORY_SEPARATOR . 'standard-file-2'); + $this->assertFileDoesNotExist($basePath . 'symlinks' . DIRECTORY_SEPARATOR . 'symlinked-file'); $this->assertFalse(is_dir($basePath . 'symlinks' . DIRECTORY_SEPARATOR . 'symlinked-directory')); - $this->assertFileNotExists($basePath . 'symlinks' . DIRECTORY_SEPARATOR . 'symlinked-directory' . DIRECTORY_SEPARATOR . 'standard-file-1'); + $this->assertFileDoesNotExist($basePath . 'symlinks' . DIRECTORY_SEPARATOR . 'symlinked-directory' . DIRECTORY_SEPARATOR . 'standard-file-1'); } public function testFindFiles() @@ -910,8 +912,8 @@ public function testCopyDirectoryNoEmptyDirectories() $this->assertFileExists($dstDirName . DIRECTORY_SEPARATOR . 'dir1'); $this->assertFileExists($dstDirName . DIRECTORY_SEPARATOR . 'dir1' . DIRECTORY_SEPARATOR . 'file1.txt'); $this->assertFileExists($dstDirName . DIRECTORY_SEPARATOR . 'dir1' . DIRECTORY_SEPARATOR . 'file2.txt'); - $this->assertFileNotExists($dstDirName . DIRECTORY_SEPARATOR . 'dir2'); - $this->assertFileNotExists($dstDirName . DIRECTORY_SEPARATOR . 'dir3'); + $this->assertFileDoesNotExist($dstDirName . DIRECTORY_SEPARATOR . 'dir2'); + $this->assertFileDoesNotExist($dstDirName . DIRECTORY_SEPARATOR . 'dir3'); } public function testFindDirectories() diff --git a/tests/framework/helpers/FormatConverterTest.php b/tests/framework/helpers/FormatConverterTest.php index dd8d470a1cd..42ed3acb1e9 100644 --- a/tests/framework/helpers/FormatConverterTest.php +++ b/tests/framework/helpers/FormatConverterTest.php @@ -19,7 +19,7 @@ */ class FormatConverterTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -31,7 +31,7 @@ protected function setUp() ]); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); IntlTestHelper::resetIntlStatus(); @@ -358,7 +358,7 @@ public function testIntlUtf8Ru() $formatter = new Formatter(['locale' => 'ru-RU']); // There is a dot after month name in updated ICU data and no dot in old data. Both are acceptable. // See https://github.com/yiisoft/yii2/issues/9906 - $this->assertRegExp('/24 авг\.? 2014 г\./', $formatter->asDate('2014-8-24', "dd MMM y 'г'.")); + $this->assertMatchesRegularExpression('/24 авг\.? 2014 г\./', $formatter->asDate('2014-8-24', "dd MMM y 'г'.")); } public function testPhpToICUMixedPatterns() diff --git a/tests/framework/helpers/HtmlTest.php b/tests/framework/helpers/HtmlTest.php index 12e8869d2d8..18b24b89cde 100644 --- a/tests/framework/helpers/HtmlTest.php +++ b/tests/framework/helpers/HtmlTest.php @@ -19,7 +19,7 @@ */ class HtmlTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication([ @@ -1989,13 +1989,13 @@ public function testActiveFileInput() $this->assertEqualsWithoutLE($expected, $actual); } - /** - * @expectedException \yii\base\InvalidArgumentException - * @expectedExceptionMessage Attribute name must contain word characters only. - */ public function testGetAttributeValueInvalidArgumentException() { $model = new HtmlTestModel(); + + $this->expectException(\yii\base\InvalidArgumentException::class); + $this->expectExceptionMessage('Attribute name must contain word characters only.'); + Html::getAttributeValue($model, '-'); } @@ -2024,24 +2024,24 @@ public function testGetAttributeValue() $this->assertSame($expected, $actual); } - /** - * @expectedException \yii\base\InvalidArgumentException - * @expectedExceptionMessage Attribute name must contain word characters only. - */ public function testGetInputNameInvalidArgumentExceptionAttribute() { $model = new HtmlTestModel(); + + $this->expectException(\yii\base\InvalidArgumentException::class); + $this->expectExceptionMessage('Attribute name must contain word characters only.'); + Html::getInputName($model, '-'); } - /** - * @expectedException \yii\base\InvalidArgumentException - * @expectedExceptionMessageRegExp /(.*)formName\(\) cannot be empty for tabular inputs.$/ - */ public function testGetInputNameInvalidArgumentExceptionFormName() { $model = $this->getMockBuilder('yii\\base\\Model')->getMock(); $model->method('formName')->willReturn(''); + + $this->expectException(\yii\base\InvalidArgumentException::class); + $this->expectExceptionMessage('cannot be empty for tabular inputs.'); + Html::getInputName($model, '[foo]bar'); } @@ -2147,7 +2147,7 @@ public function testActiveTextInput_placeholderFillFromModel() $html = Html::activeTextInput($model, 'name', ['placeholder' => true]); - $this->assertContains('placeholder="Name"', $html); + $this->assertStringContainsString('placeholder="Name"', $html); } public function testActiveTextInput_customPlaceholder() @@ -2156,7 +2156,7 @@ public function testActiveTextInput_customPlaceholder() $html = Html::activeTextInput($model, 'name', ['placeholder' => 'Custom placeholder']); - $this->assertContains('placeholder="Custom placeholder"', $html); + $this->assertStringContainsString('placeholder="Custom placeholder"', $html); } public function testActiveTextInput_placeholderFillFromModelTabular() @@ -2165,7 +2165,7 @@ public function testActiveTextInput_placeholderFillFromModelTabular() $html = Html::activeTextInput($model, '[0]name', ['placeholder' => true]); - $this->assertContains('placeholder="Name"', $html); + $this->assertStringContainsString('placeholder="Name"', $html); } public function testOverrideSetActivePlaceholder() @@ -2174,11 +2174,13 @@ public function testOverrideSetActivePlaceholder() $html = MyHtml::activeTextInput($model, 'name', ['placeholder' => true]); - $this->assertContains('placeholder="My placeholder: Name"', $html); + $this->assertStringContainsString('placeholder="My placeholder: Name"', $html); } public function testGetInputIdDataProvider() { + $this->expectNotToPerformAssertions(); + return [ [ 'foo', @@ -2218,6 +2220,8 @@ public function testGetInputIdDataProvider() public function testGetInputIdByNameDataProvider() { + $this->expectNotToPerformAssertions(); + return [ [ 'foo', diff --git a/tests/framework/helpers/InflectorTest.php b/tests/framework/helpers/InflectorTest.php index 7b1632b9929..644660e7211 100644 --- a/tests/framework/helpers/InflectorTest.php +++ b/tests/framework/helpers/InflectorTest.php @@ -15,7 +15,7 @@ */ class InflectorTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/helpers/IpHelperTest.php b/tests/framework/helpers/IpHelperTest.php index ac77758ec5f..cd850404026 100644 --- a/tests/framework/helpers/IpHelperTest.php +++ b/tests/framework/helpers/IpHelperTest.php @@ -54,6 +54,8 @@ public function expandIpv6Provider() public function testIpv6ExpandingWithInvalidValue() { try { + $this->expectNotToPerformAssertions(); + IpHelper::expandIPv6('fa01::1/64'); } catch (\Exception $exception) { $this->assertStringEndsWith('Unrecognized address fa01::1/64', $exception->getMessage()); diff --git a/tests/framework/helpers/JsonTest.php b/tests/framework/helpers/JsonTest.php index f8150c764d8..7c96c185be9 100644 --- a/tests/framework/helpers/JsonTest.php +++ b/tests/framework/helpers/JsonTest.php @@ -19,7 +19,7 @@ */ class JsonTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -205,12 +205,13 @@ public function testDecode() } /** - * @expectedException \yii\base\InvalidArgumentException - * @expectedExceptionMessage Invalid JSON data. * @covers ::decode */ - public function testDecodeInvalidParamException() + public function testDecodeInvalidArgumentException() { + $this->expectException(\yii\base\InvalidArgumentException::class); + $this->expectExceptionMessage('Invalid JSON data.'); + Json::decode([]); } diff --git a/tests/framework/helpers/MarkdownTest.php b/tests/framework/helpers/MarkdownTest.php index 7514e142362..6cf18bda3ed 100644 --- a/tests/framework/helpers/MarkdownTest.php +++ b/tests/framework/helpers/MarkdownTest.php @@ -18,7 +18,7 @@ */ class MarkdownTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -43,12 +43,11 @@ public function testOriginalFlavor() $this->assertEquals(Markdown::process($text), Markdown::process($text, 'gfm-comment')); } - /** - * @expectedException \yii\base\InvalidParamException - * @expectedExceptionMessage Markdown flavor 'undefined' is not defined. - */ - public function testProcessInvalidParamException() + public function testProcessInvalidArgumentException() { + $this->expectException(\yii\base\InvalidArgumentException::class); + $this->expectExceptionMessage("Markdown flavor 'undefined' is not defined."); + Markdown::process('foo', 'undefined'); } diff --git a/tests/framework/helpers/StringHelperTest.php b/tests/framework/helpers/StringHelperTest.php index 56acdb0c268..ffb5c6e2e19 100644 --- a/tests/framework/helpers/StringHelperTest.php +++ b/tests/framework/helpers/StringHelperTest.php @@ -17,7 +17,7 @@ class StringHelperTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/helpers/UrlTest.php b/tests/framework/helpers/UrlTest.php index 0f2b6584eb9..1aca8a92850 100644 --- a/tests/framework/helpers/UrlTest.php +++ b/tests/framework/helpers/UrlTest.php @@ -22,7 +22,7 @@ */ class UrlTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication([ @@ -47,7 +47,7 @@ protected function setUp() ], '\yii\web\Application'); } - protected function tearDown() + protected function tearDown(): void { Yii::$app->getSession()->removeAll(); parent::tearDown(); @@ -268,7 +268,7 @@ public function testToWithSuffix() ['label' => 'Test', 'url' => ['/site/page', 'view' => 'about']], ], ]); - $this->assertRegExp('~~', $output); + $this->assertMatchesRegularExpression('~~', $output); } public function testBase() diff --git a/tests/framework/helpers/VarDumperTest.php b/tests/framework/helpers/VarDumperTest.php index 434876398a2..b8dd2e63cc6 100644 --- a/tests/framework/helpers/VarDumperTest.php +++ b/tests/framework/helpers/VarDumperTest.php @@ -16,7 +16,7 @@ */ class VarDumperTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -29,8 +29,8 @@ public function testDumpIncompleteObject() $serializedObj = 'O:16:"nonExistingClass":0:{}'; $incompleteObj = unserialize($serializedObj); $dumpResult = VarDumper::dumpAsString($incompleteObj); - $this->assertContains("__PHP_Incomplete_Class#1\n(", $dumpResult); - $this->assertContains('nonExistingClass', $dumpResult); + $this->assertStringContainsString("__PHP_Incomplete_Class#1\n(", $dumpResult); + $this->assertStringContainsString('nonExistingClass', $dumpResult); } public function testExportIncompleteObject() @@ -38,7 +38,7 @@ public function testExportIncompleteObject() $serializedObj = 'O:16:"nonExistingClass":0:{}'; $incompleteObj = unserialize($serializedObj); $exportResult = VarDumper::export($incompleteObj); - $this->assertContains('nonExistingClass', $exportResult); + $this->assertStringContainsString('nonExistingClass', $exportResult); } public function testDumpObject() @@ -50,9 +50,9 @@ public function testDumpObject() $obj->name = 'test-name'; $obj->price = 19; $dumpResult = VarDumper::dumpAsString($obj); - $this->assertContains("stdClass#1\n(", $dumpResult); - $this->assertContains("[name] => 'test-name'", $dumpResult); - $this->assertContains('[price] => 19', $dumpResult); + $this->assertStringContainsString("stdClass#1\n(", $dumpResult); + $this->assertStringContainsString("[name] => 'test-name'", $dumpResult); + $this->assertStringContainsString('[price] => 19', $dumpResult); } /** @@ -197,7 +197,7 @@ public function testDumpClassWithCustomDebugInfo() $object->unitPrice = 15; $dumpResult = VarDumper::dumpAsString($object); - $this->assertContains('totalPrice', $dumpResult); - $this->assertNotContains('unitPrice', $dumpResult); + $this->assertStringContainsString('totalPrice', $dumpResult); + $this->assertStringNotContainsString('unitPrice', $dumpResult); } } diff --git a/tests/framework/i18n/DbMessageSourceTest.php b/tests/framework/i18n/DbMessageSourceTest.php index e295365ed86..8e4dd725e87 100644 --- a/tests/framework/i18n/DbMessageSourceTest.php +++ b/tests/framework/i18n/DbMessageSourceTest.php @@ -73,7 +73,7 @@ protected static function runConsoleAction($route, $params = []) } } - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); $databases = static::getParam('databases'); @@ -104,7 +104,7 @@ public static function setUpBeforeClass() static::$db->createCommand()->insert('message', ['id' => 5, 'language' => 'ru', 'translation' => 'На диване {n, plural, =0{нет кошек} =1{лежит одна кошка} one{лежит # кошка} few{лежит # кошки} many{лежит # кошек} other{лежит # кошки}}!'])->execute(); } - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { static::runConsoleAction('migrate/down', ['migrationPath' => '@yii/i18n/migrations/', 'interactive' => false]); if (static::$db) { diff --git a/tests/framework/i18n/FormatterDateTest.php b/tests/framework/i18n/FormatterDateTest.php index ef488433572..c62ff491b11 100644 --- a/tests/framework/i18n/FormatterDateTest.php +++ b/tests/framework/i18n/FormatterDateTest.php @@ -22,7 +22,7 @@ class FormatterDateTest extends TestCase */ protected $formatter; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -35,7 +35,7 @@ protected function setUp() $this->formatter = new Formatter(['locale' => 'en-US']); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); IntlTestHelper::resetIntlStatus(); @@ -170,22 +170,22 @@ public function testIntlAsDatetime() // empty input $this->formatter->locale = 'de-DE'; - $this->assertRegExp('~01\.01\.1970,? 00:00:00~', $this->formatter->asDatetime('')); - $this->assertRegExp('~01\.01\.1970,? 00:00:00~', $this->formatter->asDatetime(0)); - $this->assertRegExp('~01\.01\.1970,? 00:00:00~', $this->formatter->asDatetime(false)); + $this->assertMatchesRegularExpression('~01\.01\.1970,? 00:00:00~', $this->formatter->asDatetime('')); + $this->assertMatchesRegularExpression('~01\.01\.1970,? 00:00:00~', $this->formatter->asDatetime(0)); + $this->assertMatchesRegularExpression('~01\.01\.1970,? 00:00:00~', $this->formatter->asDatetime(false)); } public function testAsDatetime() { $value = time(); - $this->assertRegExp( + $this->assertMatchesRegularExpression( $this->sanitizeWhitespaces(date('~M j, Y,? g:i:s A~', $value)), $this->sanitizeWhitespaces($this->formatter->asDatetime($value)) ); $this->assertSame(date('Y/m/d h:i:s A', $value), $this->formatter->asDatetime($value, 'php:Y/m/d h:i:s A')); $value = new DateTime(); - $this->assertRegExp( + $this->assertMatchesRegularExpression( $this->sanitizeWhitespaces(date('~M j, Y,? g:i:s A~', $value->getTimestamp())), $this->sanitizeWhitespaces($this->formatter->asDatetime($value)) ); @@ -195,7 +195,7 @@ public function testAsDatetime() $value = new DateTime(); $date = $value->format('Y-m-d'); $value = new DateTime($date); - $this->assertRegExp( + $this->assertMatchesRegularExpression( $this->sanitizeWhitespaces(date('~M j, Y,? g:i:s A~', $value->getTimestamp())), $this->sanitizeWhitespaces($this->formatter->asDatetime($date)) ); @@ -203,7 +203,7 @@ public function testAsDatetime() if (PHP_VERSION_ID >= 50500) { $value = new \DateTimeImmutable(); - $this->assertRegExp( + $this->assertMatchesRegularExpression( $this->sanitizeWhitespaces(date('~M j, Y,? g:i:s A~', $value->getTimestamp())), $this->sanitizeWhitespaces($this->formatter->asDatetime($value)) ); @@ -217,15 +217,15 @@ public function testAsDatetime() } // empty input - $this->assertRegExp( + $this->assertMatchesRegularExpression( $this->sanitizeWhitespaces('~Jan 1, 1970,? 12:00:00 AM~'), $this->sanitizeWhitespaces($this->formatter->asDatetime('')) ); - $this->assertRegExp( + $this->assertMatchesRegularExpression( $this->sanitizeWhitespaces('~Jan 1, 1970,? 12:00:00 AM~'), $this->sanitizeWhitespaces($this->formatter->asDatetime(0)) ); - $this->assertRegExp( + $this->assertMatchesRegularExpression( $this->sanitizeWhitespaces('~Jan 1, 1970,? 12:00:00 AM~'), $this->sanitizeWhitespaces($this->formatter->asDatetime(false)) ); diff --git a/tests/framework/i18n/FormatterNumberTest.php b/tests/framework/i18n/FormatterNumberTest.php index 234c9a5ea24..e572adb9021 100755 --- a/tests/framework/i18n/FormatterNumberTest.php +++ b/tests/framework/i18n/FormatterNumberTest.php @@ -22,7 +22,7 @@ class FormatterNumberTest extends TestCase */ protected $formatter; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -35,7 +35,7 @@ protected function setUp() $this->formatter = new Formatter(['locale' => 'en-US']); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); IntlTestHelper::resetIntlStatus(); diff --git a/tests/framework/i18n/FormatterTest.php b/tests/framework/i18n/FormatterTest.php index a44b74aec60..83d4f884212 100644 --- a/tests/framework/i18n/FormatterTest.php +++ b/tests/framework/i18n/FormatterTest.php @@ -24,7 +24,7 @@ class FormatterTest extends TestCase */ protected $formatter; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -39,7 +39,7 @@ protected function setUp() } } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); IntlTestHelper::resetIntlStatus(); diff --git a/tests/framework/i18n/GettextPoFileTest.php b/tests/framework/i18n/GettextPoFileTest.php index 2c202fad235..81a93e889ca 100644 --- a/tests/framework/i18n/GettextPoFileTest.php +++ b/tests/framework/i18n/GettextPoFileTest.php @@ -15,7 +15,7 @@ */ class GettextPoFileTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); diff --git a/tests/framework/i18n/I18NTest.php b/tests/framework/i18n/I18NTest.php index 77a514acaf0..c95ed2248ab 100644 --- a/tests/framework/i18n/I18NTest.php +++ b/tests/framework/i18n/I18NTest.php @@ -25,7 +25,7 @@ class I18NTest extends TestCase */ public $i18n; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); diff --git a/tests/framework/i18n/LocaleTest.php b/tests/framework/i18n/LocaleTest.php index 60d1951eca9..2e5ef84ebaa 100644 --- a/tests/framework/i18n/LocaleTest.php +++ b/tests/framework/i18n/LocaleTest.php @@ -20,7 +20,7 @@ class LocaleTest extends TestCase */ protected $locale; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -31,7 +31,7 @@ protected function setUp() $this->locale = new Locale(['locale' => 'en-US']); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); $this->locale = null; diff --git a/tests/framework/log/DbTargetTest.php b/tests/framework/log/DbTargetTest.php index 9d118d21bc1..caf553f40aa 100644 --- a/tests/framework/log/DbTargetTest.php +++ b/tests/framework/log/DbTargetTest.php @@ -64,7 +64,7 @@ protected static function runConsoleAction($route, $params = []) } } - public function setUp() + public function setUp(): void { parent::setUp(); $databases = static::getParam('databases'); @@ -78,7 +78,7 @@ public function setUp() static::runConsoleAction('migrate/up', ['migrationPath' => '@yii/log/migrations/', 'interactive' => false]); } - public function tearDown() + public function tearDown(): void { self::getConnection()->createCommand()->truncateTable(self::$logTable)->execute(); static::runConsoleAction('migrate/down', ['migrationPath' => '@yii/log/migrations/', 'interactive' => false]); diff --git a/tests/framework/log/DispatcherTest.php b/tests/framework/log/DispatcherTest.php index 5cb35b52e3c..24af341a79d 100644 --- a/tests/framework/log/DispatcherTest.php +++ b/tests/framework/log/DispatcherTest.php @@ -52,7 +52,7 @@ class DispatcherTest extends TestCase */ public static $functions = []; - protected function setUp() + protected function setUp(): void { static::$microtimeIsMocked = false; $this->dispatcher = new Dispatcher(); diff --git a/tests/framework/log/EmailTargetTest.php b/tests/framework/log/EmailTargetTest.php index 7c3b4e008f2..9f974ee1b4b 100644 --- a/tests/framework/log/EmailTargetTest.php +++ b/tests/framework/log/EmailTargetTest.php @@ -24,7 +24,7 @@ class EmailTargetTest extends TestCase /** * Set up mailer. */ - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mailer = $this->getMockBuilder('yii\\mail\\BaseMailer') @@ -38,16 +38,17 @@ protected function setUp() public function testInitWithOptionTo() { $target = new EmailTarget(['mailer' => $this->mailer, 'message' => ['to' => 'developer1@example.com']]); - $this->assertInternalType('object', $target); // should be no exception during `init()` + $this->assertIsObject($target); // should be no exception during `init()` } /** * @covers \yii\log\EmailTarget::init() - * @expectedException \yii\base\InvalidConfigException - * @expectedExceptionMessage The "to" option must be set for EmailTarget::message. */ public function testInitWithoutOptionTo() { + $this->expectException(\yii\base\InvalidConfigException::class); + $this->expectExceptionMessage('The "to" option must be set for EmailTarget::message.'); + new EmailTarget(['mailer' => $this->mailer]); } diff --git a/tests/framework/log/FileTargetTest.php b/tests/framework/log/FileTargetTest.php index 4f6eaf4ae75..6c23837f23c 100644 --- a/tests/framework/log/FileTargetTest.php +++ b/tests/framework/log/FileTargetTest.php @@ -20,7 +20,7 @@ */ class FileTargetTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); @@ -37,7 +37,7 @@ public function testInit() new FileTarget([ 'logFile' => Yii::getAlias('@yiiunit/runtime/log/filetargettest.log'), ]); - $this->assertFileNotExists( + $this->assertFileDoesNotExist( dirname($logFile), 'Log directory should not be created during init process' ); @@ -72,10 +72,10 @@ public function testRotate() clearstatcache(); $this->assertFileExists($logFile); - $this->assertFileNotExists($logFile . '.1'); - $this->assertFileNotExists($logFile . '.2'); - $this->assertFileNotExists($logFile . '.3'); - $this->assertFileNotExists($logFile . '.4'); + $this->assertFileDoesNotExist($logFile . '.1'); + $this->assertFileDoesNotExist($logFile . '.2'); + $this->assertFileDoesNotExist($logFile . '.3'); + $this->assertFileDoesNotExist($logFile . '.4'); // exceed max size for ($i = 0; $i < 1024; $i++) { @@ -92,9 +92,9 @@ public function testRotate() $this->assertFileExists($logFile); $this->assertFileExists($logFile . '.1'); - $this->assertFileNotExists($logFile . '.2'); - $this->assertFileNotExists($logFile . '.3'); - $this->assertFileNotExists($logFile . '.4'); + $this->assertFileDoesNotExist($logFile . '.2'); + $this->assertFileDoesNotExist($logFile . '.3'); + $this->assertFileDoesNotExist($logFile . '.4'); // second rotate @@ -107,9 +107,9 @@ public function testRotate() $this->assertFileExists($logFile); $this->assertFileExists($logFile . '.1'); - $this->assertFileNotExists($logFile . '.2'); - $this->assertFileNotExists($logFile . '.3'); - $this->assertFileNotExists($logFile . '.4'); + $this->assertFileDoesNotExist($logFile . '.2'); + $this->assertFileDoesNotExist($logFile . '.3'); + $this->assertFileDoesNotExist($logFile . '.4'); } public function testLogEmptyStrings() @@ -142,17 +142,17 @@ public function testLogEmptyStrings() $logger->messages = array_fill(0, 1, 'yyy'); $logger->export(); - $this->assertFileNotExists($logFile); + $this->assertFileDoesNotExist($logFile); $logger->messages = array_fill(0, 10, ''); $logger->export(); - $this->assertFileNotExists($logFile); + $this->assertFileDoesNotExist($logFile); $logger->messages = array_fill(0, 10, null); $logger->export(); - $this->assertFileNotExists($logFile); + $this->assertFileDoesNotExist($logFile); } private function clearLogFile($logFile) diff --git a/tests/framework/log/LoggerTest.php b/tests/framework/log/LoggerTest.php index d5ffa83aca4..3238ea0afd7 100644 --- a/tests/framework/log/LoggerTest.php +++ b/tests/framework/log/LoggerTest.php @@ -26,7 +26,7 @@ class LoggerTest extends TestCase */ protected $dispatcher; - protected function setUp() + protected function setUp(): void { $this->logger = new Logger(); $this->dispatcher = $this->getMockBuilder('yii\log\Dispatcher') diff --git a/tests/framework/log/SyslogTargetTest.php b/tests/framework/log/SyslogTargetTest.php index 3c9efd10aec..384b51ec5d7 100644 --- a/tests/framework/log/SyslogTargetTest.php +++ b/tests/framework/log/SyslogTargetTest.php @@ -52,7 +52,7 @@ class SyslogTargetTest extends TestCase /** * Set up syslogTarget as the mock object. */ - protected function setUp() + protected function setUp(): void { $this->syslogTarget = $this->getMockBuilder('yii\\log\\SyslogTarget') ->setMethods(['getMessagePrefix']) diff --git a/tests/framework/log/TargetTest.php b/tests/framework/log/TargetTest.php index eace93aa3bf..4450239f43e 100644 --- a/tests/framework/log/TargetTest.php +++ b/tests/framework/log/TargetTest.php @@ -118,23 +118,23 @@ public function testGetContextMessage() 'C_c' => 1, ]; $context = $target->getContextMessage(); - $this->assertContains('A_a', $context); - $this->assertNotContains('A_b', $context); - $this->assertContains('A_c', $context); - $this->assertContains('B_a', $context); - $this->assertNotContains('B_b', $context); - $this->assertNotContains('B_c', $context); - $this->assertContains('C_a', $context); - $this->assertContains('C_b', $context); - $this->assertContains('C_c', $context); - $this->assertNotContains('D_a', $context); - $this->assertNotContains('D_b', $context); - $this->assertNotContains('D_c', $context); - $this->assertNotContains('E_a', $context); - $this->assertNotContains('E_b', $context); - $this->assertNotContains('E_c', $context); - $this->assertNotContains('mySecret', $context); - $this->assertContains('***', $context); + $this->assertStringContainsString('A_a', $context); + $this->assertStringNotContainsString('A_b', $context); + $this->assertStringContainsString('A_c', $context); + $this->assertStringContainsString('B_a', $context); + $this->assertStringNotContainsString('B_b', $context); + $this->assertStringNotContainsString('B_c', $context); + $this->assertStringContainsString('C_a', $context); + $this->assertStringContainsString('C_b', $context); + $this->assertStringContainsString('C_c', $context); + $this->assertStringNotContainsString('D_a', $context); + $this->assertStringNotContainsString('D_b', $context); + $this->assertStringNotContainsString('D_c', $context); + $this->assertStringNotContainsString('E_a', $context); + $this->assertStringNotContainsString('E_b', $context); + $this->assertStringNotContainsString('E_c', $context); + $this->assertStringNotContainsString('mySecret', $context); + $this->assertStringContainsString('***', $context); } /** diff --git a/tests/framework/mail/BaseMailerTest.php b/tests/framework/mail/BaseMailerTest.php index dc7e43deb0e..4e2f5f1a8f1 100644 --- a/tests/framework/mail/BaseMailerTest.php +++ b/tests/framework/mail/BaseMailerTest.php @@ -19,7 +19,7 @@ */ class BaseMailerTest extends TestCase { - public function setUp() + public function setUp(): void { $this->mockApplication([ 'components' => [ @@ -32,7 +32,7 @@ public function setUp() } } - public function tearDown() + public function tearDown(): void { $filePath = $this->getTestFilePath(); if (file_exists($filePath)) { @@ -85,7 +85,7 @@ public function testSetupView() ]; $mailer->setView($viewConfig); $view = $mailer->getView(); - $this->assertInternalType('object', $view, 'Unable to setup view via config!'); + $this->assertIsObject($view, 'Unable to setup view via config!'); $this->assertEquals($viewConfig['params'], $view->params, 'Unable to configure view via config array!'); } @@ -96,14 +96,14 @@ public function testGetDefaultView() { $mailer = new Mailer(); $view = $mailer->getView(); - $this->assertInternalType('object', $view, 'Unable to get default view!'); + $this->assertIsObject($view, 'Unable to get default view!'); } public function testCreateMessage() { $mailer = new Mailer(); $message = $mailer->compose(); - $this->assertInternalType('object', $message, 'Unable to create message instance!'); + $this->assertIsObject($message, 'Unable to create message instance!'); $this->assertEquals($mailer->messageClass, get_class($message), 'Invalid message class!'); } @@ -456,7 +456,7 @@ public function embedContent($content, array $options = []) { } - public function toString() + public function toString(): string { $mailer = $this->mailer; $this->mailer = null; diff --git a/tests/framework/mail/BaseMessageTest.php b/tests/framework/mail/BaseMessageTest.php index 9741f5d66d7..2df6dddf272 100644 --- a/tests/framework/mail/BaseMessageTest.php +++ b/tests/framework/mail/BaseMessageTest.php @@ -17,7 +17,7 @@ */ class BaseMessageTest extends TestCase { - public function setUp() + public function setUp(): void { $this->mockApplication([ 'components' => [ @@ -173,7 +173,7 @@ public function embedContent($content, array $options = []) { } - public function toString() + public function toString(): string { return get_class($this); } diff --git a/tests/framework/mutex/FileMutexTest.php b/tests/framework/mutex/FileMutexTest.php index 48e3778c6ec..60947e750aa 100644 --- a/tests/framework/mutex/FileMutexTest.php +++ b/tests/framework/mutex/FileMutexTest.php @@ -47,6 +47,6 @@ public function testDeleteLockFile($mutexName) $this->assertFileExists($fileName); $mutex->release($mutexName); - $this->assertFileNotExists($fileName); + $this->assertFileDoesNotExist($fileName); } } diff --git a/tests/framework/rbac/DbManagerTestCase.php b/tests/framework/rbac/DbManagerTestCase.php index bb5debaddc8..3446266130b 100644 --- a/tests/framework/rbac/DbManagerTestCase.php +++ b/tests/framework/rbac/DbManagerTestCase.php @@ -36,6 +36,20 @@ abstract class DbManagerTestCase extends ManagerTestCase */ protected $db; + public function testGetAssignmentsByRole() + { + $this->prepareData(); + $reader = $this->auth->getRole('reader'); + $this->auth->assign($reader, 123); + + $this->auth = $this->createManager(); + + $this->assertEquals([], $this->auth->getUserIdsByRole('nonexisting')); + $this->assertEquals(['123', 'reader A'], $this->auth->getUserIdsByRole('reader'), '', 0.0, 10, true); + $this->assertEquals(['author B'], $this->auth->getUserIdsByRole('author')); + $this->assertEquals(['admin C'], $this->auth->getUserIdsByRole('admin')); + } + protected static function runConsoleAction($route, $params = []) { if (Yii::$app === null) { @@ -67,7 +81,7 @@ protected static function runConsoleAction($route, $params = []) } } - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); $databases = static::getParam('databases'); @@ -81,13 +95,13 @@ public static function setUpBeforeClass() static::runConsoleAction('migrate/up', ['migrationPath' => '@yii/rbac/migrations/', 'interactive' => false]); } - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { static::runConsoleAction('migrate/down', ['all', 'migrationPath' => '@yii/rbac/migrations/', 'interactive' => false]); parent::tearDownAfterClass(); } - protected function setUp() + protected function setUp(): void { if (defined('HHVM_VERSION') && static::$driverName === 'pgsql') { static::markTestSkipped('HHVM PDO for pgsql does not work with binary columns, which are essential for rbac schema. See https://github.com/yiisoft/yii2/issues/14244'); @@ -96,7 +110,7 @@ protected function setUp() $this->auth = $this->createManager(); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); $this->auth->removeAll(); @@ -393,7 +407,10 @@ private function assertSingleQueryToAssignmentsTable($logTarget) return strpos($message[0], 'auth_assignment') !== false; }); $this->assertCount(1, $messages, 'Only one query should have been performed, but there are the following logs: ' . print_r($logTarget->messages, true)); - $this->assertContains('auth_assignment', $messages[0][0], 'Log message should be a query to auth_assignment table'); + $this->assertStringContainsString( + 'auth_assignment', + $messages[0][0], 'Log message should be a query to auth_assignment table', + ); $logTarget->messages = []; } } diff --git a/tests/framework/rbac/PhpManagerTest.php b/tests/framework/rbac/PhpManagerTest.php index 38107d26a84..51c77bff027 100644 --- a/tests/framework/rbac/PhpManagerTest.php +++ b/tests/framework/rbac/PhpManagerTest.php @@ -74,7 +74,7 @@ protected function createManager() ]); } - protected function setUp() + protected function setUp(): void { static::$filemtime = null; static::$time = null; @@ -89,7 +89,7 @@ protected function setUp() $this->auth = $this->createManager(); } - protected function tearDown() + protected function tearDown(): void { $this->removeDataFiles(); static::$filemtime = null; @@ -136,15 +136,15 @@ public function testUpdateDescription() $this->assertTrue($this->auth->update($name, $permission), 'You should be able to save w/o changing name.'); } - /** - * @expectedException \yii\base\InvalidParamException - */ public function testOverwriteName() { $this->prepareData(); $name = 'readPost'; $permission = $this->auth->getPermission($name); $permission->name = 'createPost'; + + $this->expectException(\yii\base\InvalidArgumentException::class); + $this->auth->update($name, $permission); } @@ -154,11 +154,11 @@ public function testSaveAssignments() $role = $this->auth->createRole('Admin'); $this->auth->add($role); $this->auth->assign($role, 13); - $this->assertContains('Admin', file_get_contents($this->getAssignmentFile())); + $this->assertStringContainsString('Admin', file_get_contents($this->getAssignmentFile())); $role->name = 'NewAdmin'; $this->auth->update('Admin', $role); - $this->assertContains('NewAdmin', file_get_contents($this->getAssignmentFile())); + $this->assertStringContainsString('NewAdmin', file_get_contents($this->getAssignmentFile())); $this->auth->remove($role); - $this->assertNotContains('NewAdmin', file_get_contents($this->getAssignmentFile())); + $this->assertStringNotContainsString('NewAdmin', file_get_contents($this->getAssignmentFile())); } } diff --git a/tests/framework/rest/IndexActionTest.php b/tests/framework/rest/IndexActionTest.php index d6481aa10e2..2b703d5494e 100644 --- a/tests/framework/rest/IndexActionTest.php +++ b/tests/framework/rest/IndexActionTest.php @@ -18,7 +18,7 @@ */ class IndexActionTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockWebApplication([ diff --git a/tests/framework/rest/SerializerTest.php b/tests/framework/rest/SerializerTest.php index 361aba38a91..d7516e0dae0 100644 --- a/tests/framework/rest/SerializerTest.php +++ b/tests/framework/rest/SerializerTest.php @@ -17,7 +17,7 @@ */ class SerializerTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication([ diff --git a/tests/framework/rest/UrlRuleTest.php b/tests/framework/rest/UrlRuleTest.php index 0228742ce18..ce09bd81032 100644 --- a/tests/framework/rest/UrlRuleTest.php +++ b/tests/framework/rest/UrlRuleTest.php @@ -20,7 +20,7 @@ */ class UrlRuleTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); @@ -415,6 +415,8 @@ public function testGetCreateUrlStatus($ruleConfig, $tests) */ public function testGetCreateUrlStatusProvider() { + $this->expectNotToPerformAssertions(); + return [ 'single controller' => [ // rule properties diff --git a/tests/framework/test/ActiveFixtureTest.php b/tests/framework/test/ActiveFixtureTest.php index ba52d0e286d..8b14060e6fe 100644 --- a/tests/framework/test/ActiveFixtureTest.php +++ b/tests/framework/test/ActiveFixtureTest.php @@ -23,7 +23,7 @@ class ActiveFixtureTest extends DatabaseTestCase { protected $driverName = 'mysql'; - public function setUp() + public function setUp(): void { parent::setUp(); $db = $this->getConnection(); @@ -31,7 +31,7 @@ public function setUp() ActiveRecord::$db = $db; } - public function tearDown() + public function tearDown(): void { parent::tearDown(); } @@ -205,12 +205,12 @@ class BaseDbTestCase { use FixtureTrait; - public function setUp() + public function setUp(): void { $this->initFixtures(); } - public function tearDown() + public function tearDown(): void { } } diff --git a/tests/framework/test/ArrayFixtureTest.php b/tests/framework/test/ArrayFixtureTest.php index 50ec62c3282..8eadfe8b8fc 100644 --- a/tests/framework/test/ArrayFixtureTest.php +++ b/tests/framework/test/ArrayFixtureTest.php @@ -20,7 +20,7 @@ class ArrayFixtureTest extends TestCase */ private $_fixture; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->_fixture = new ArrayFixture(); @@ -47,12 +47,12 @@ public function testNothingToLoad() $this->assertEmpty($this->_fixture->data, 'fixture data should not be loaded'); } - /** - * @expectedException \yii\base\InvalidConfigException - */ public function testWrongDataFileException() { $this->_fixture->dataFile = 'wrong/fixtures/data/path/alias'; + + $this->expectException(\yii\base\InvalidConfigException::class); + $this->_fixture->load(); } } diff --git a/tests/framework/test/FixtureTest.php b/tests/framework/test/FixtureTest.php index 25c57bc5537..6ec23bae974 100644 --- a/tests/framework/test/FixtureTest.php +++ b/tests/framework/test/FixtureTest.php @@ -90,12 +90,12 @@ class MyTestCase public static $load; public static $unload; - public function setUp() + public function setUp(): void { $this->loadFixtures(); } - public function tearDown() + public function tearDown(): void { $this->unloadFixtures(); } diff --git a/tests/framework/validators/BooleanValidatorTest.php b/tests/framework/validators/BooleanValidatorTest.php index 63331f6136f..0405a518967 100644 --- a/tests/framework/validators/BooleanValidatorTest.php +++ b/tests/framework/validators/BooleanValidatorTest.php @@ -17,7 +17,7 @@ */ class BooleanValidatorTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/validators/CompareValidatorTest.php b/tests/framework/validators/CompareValidatorTest.php index 2b600889d8c..69bc01b4c51 100644 --- a/tests/framework/validators/CompareValidatorTest.php +++ b/tests/framework/validators/CompareValidatorTest.php @@ -17,7 +17,7 @@ */ class CompareValidatorTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/validators/DateValidatorTest.php b/tests/framework/validators/DateValidatorTest.php index fc3cd1ef3d6..c00017cb46c 100644 --- a/tests/framework/validators/DateValidatorTest.php +++ b/tests/framework/validators/DateValidatorTest.php @@ -18,7 +18,7 @@ */ class DateValidatorTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -30,7 +30,7 @@ protected function setUp() ]); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); IntlTestHelper::resetIntlStatus(); diff --git a/tests/framework/validators/DefaultValueValidatorTest.php b/tests/framework/validators/DefaultValueValidatorTest.php index 9b25a1166ee..a76207b7f58 100644 --- a/tests/framework/validators/DefaultValueValidatorTest.php +++ b/tests/framework/validators/DefaultValueValidatorTest.php @@ -15,7 +15,7 @@ */ class DefaultValueValidatorTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/validators/EachValidatorTest.php b/tests/framework/validators/EachValidatorTest.php index 8e32327b2f3..ac58d3ce5b6 100644 --- a/tests/framework/validators/EachValidatorTest.php +++ b/tests/framework/validators/EachValidatorTest.php @@ -20,7 +20,7 @@ */ class EachValidatorTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -76,12 +76,12 @@ public function testAllowMessageFromRule() $validator->allowMessageFromRule = true; $validator->validateAttribute($model, 'attr_one'); - $this->assertContains('integer', $model->getFirstError('attr_one')); + $this->assertStringContainsString('integer', $model->getFirstError('attr_one')); $model->clearErrors(); $validator->allowMessageFromRule = false; $validator->validateAttribute($model, 'attr_one'); - $this->assertNotContains('integer', $model->getFirstError('attr_one')); + $this->assertStringNotContainsString('integer', $model->getFirstError('attr_one')); } /** diff --git a/tests/framework/validators/EmailValidatorTest.php b/tests/framework/validators/EmailValidatorTest.php index 7687b2bdc8f..fcf3b020871 100644 --- a/tests/framework/validators/EmailValidatorTest.php +++ b/tests/framework/validators/EmailValidatorTest.php @@ -16,7 +16,7 @@ */ class EmailValidatorTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/validators/ExistValidatorTest.php b/tests/framework/validators/ExistValidatorTest.php index 259efe86e0d..1fc2e27b5ec 100644 --- a/tests/framework/validators/ExistValidatorTest.php +++ b/tests/framework/validators/ExistValidatorTest.php @@ -19,7 +19,7 @@ abstract class ExistValidatorTest extends DatabaseTestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/validators/FileValidatorTest.php b/tests/framework/validators/FileValidatorTest.php index 157269e5d41..05989ec5858 100644 --- a/tests/framework/validators/FileValidatorTest.php +++ b/tests/framework/validators/FileValidatorTest.php @@ -19,7 +19,7 @@ */ class FileValidatorTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); @@ -29,7 +29,7 @@ public function testAssureMessagesSetOnInit() { $val = new FileValidator(); foreach (['message', 'uploadRequired', 'tooMany', 'wrongExtension', 'tooBig', 'tooSmall', 'wrongMimeType'] as $attr) { - $this->assertInternalType('string', $val->$attr); + $this->assertIsString($val->$attr); } } @@ -653,8 +653,11 @@ public function testValidateAttributeErrNoTmpDir() * @param bool $expected * @dataProvider mimeTypeCaseInsensitive */ - public function testValidateMimeTypeCaseInsensitive($mask, $fileMimeType, $expected) { - $validator = $this->getMock('\yii\validators\FileValidator', ['getMimeTypeByFile']); + public function testValidateMimeTypeCaseInsensitive($mask, $fileMimeType, $expected) + { + $validator = $this->getMockBuilder(\yii\validators\FileValidator::class) + ->onlyMethods(['getMimeTypeByFile']) + ->getMock(); $validator->method('getMimeTypeByFile')->willReturn($fileMimeType); $validator->mimeTypes = [$mask]; diff --git a/tests/framework/validators/FilterValidatorTest.php b/tests/framework/validators/FilterValidatorTest.php index 06153d934a3..f574f259b5a 100644 --- a/tests/framework/validators/FilterValidatorTest.php +++ b/tests/framework/validators/FilterValidatorTest.php @@ -16,7 +16,7 @@ */ class FilterValidatorTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); // destroy application, Validator must work without Yii::$app diff --git a/tests/framework/validators/IpValidatorTest.php b/tests/framework/validators/IpValidatorTest.php index a6a365ffb46..b99f6ad6c36 100644 --- a/tests/framework/validators/IpValidatorTest.php +++ b/tests/framework/validators/IpValidatorTest.php @@ -16,7 +16,7 @@ */ class IpValidatorTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); // destroy application, Validator must work without Yii::$app diff --git a/tests/framework/validators/NumberValidatorTest.php b/tests/framework/validators/NumberValidatorTest.php index 826eb9cf915..7114e167351 100644 --- a/tests/framework/validators/NumberValidatorTest.php +++ b/tests/framework/validators/NumberValidatorTest.php @@ -48,7 +48,7 @@ private function restoreLocale() setlocale(LC_NUMERIC, $this->oldLocale); } - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -519,8 +519,8 @@ public function testClientValidateComparison() ]); $model = new FakedValidationModel(); $js = $val->clientValidateAttribute($model, 'attr_number', new View(['assetBundles' => ['yii\validators\ValidationAsset' => true]])); - $this->assertContains('"min":5', $js); - $this->assertContains('"max":10', $js); + $this->assertStringContainsString('"min":5', $js); + $this->assertStringContainsString('"max":10', $js); $val = new NumberValidator([ 'min' => '5', @@ -528,8 +528,8 @@ public function testClientValidateComparison() ]); $model = new FakedValidationModel(); $js = $val->clientValidateAttribute($model, 'attr_number', new View(['assetBundles' => ['yii\validators\ValidationAsset' => true]])); - $this->assertContains('"min":5', $js); - $this->assertContains('"max":10', $js); + $this->assertStringContainsString('"min":5', $js); + $this->assertStringContainsString('"max":10', $js); $val = new NumberValidator([ 'min' => 5.65, @@ -537,8 +537,8 @@ public function testClientValidateComparison() ]); $model = new FakedValidationModel(); $js = $val->clientValidateAttribute($model, 'attr_number', new View(['assetBundles' => ['yii\validators\ValidationAsset' => true]])); - $this->assertContains('"min":5.65', $js); - $this->assertContains('"max":13.37', $js); + $this->assertStringContainsString('"min":5.65', $js); + $this->assertStringContainsString('"max":13.37', $js); $val = new NumberValidator([ 'min' => '5.65', @@ -546,8 +546,8 @@ public function testClientValidateComparison() ]); $model = new FakedValidationModel(); $js = $val->clientValidateAttribute($model, 'attr_number', new View(['assetBundles' => ['yii\validators\ValidationAsset' => true]])); - $this->assertContains('"min":5.65', $js); - $this->assertContains('"max":13.37', $js); + $this->assertStringContainsString('"min":5.65', $js); + $this->assertStringContainsString('"max":13.37', $js); } public function testValidateObject() diff --git a/tests/framework/validators/RangeValidatorTest.php b/tests/framework/validators/RangeValidatorTest.php index d86e0224e2b..67d843dc005 100644 --- a/tests/framework/validators/RangeValidatorTest.php +++ b/tests/framework/validators/RangeValidatorTest.php @@ -16,7 +16,7 @@ */ class RangeValidatorTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -34,7 +34,7 @@ public function testInitException() public function testAssureMessageSetOnInit() { $val = new RangeValidator(['range' => []]); - $this->assertInternalType('string', $val->message); + $this->assertIsString($val->message); } public function testValidateValue() diff --git a/tests/framework/validators/RegularExpressionValidatorTest.php b/tests/framework/validators/RegularExpressionValidatorTest.php index 76166d45a01..847f83724fc 100644 --- a/tests/framework/validators/RegularExpressionValidatorTest.php +++ b/tests/framework/validators/RegularExpressionValidatorTest.php @@ -16,7 +16,7 @@ */ class RegularExpressionValidatorTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -50,7 +50,7 @@ public function testValidateAttribute() public function testMessageSetOnInit() { $val = new RegularExpressionValidator(['pattern' => '/^[a-zA-Z0-9](\.)?([^\/]*)$/m']); - $this->assertInternalType('string', $val->message); + $this->assertIsString($val->message); } public function testInitException() diff --git a/tests/framework/validators/RequiredValidatorTest.php b/tests/framework/validators/RequiredValidatorTest.php index a45f3b10ef9..93a23837e45 100644 --- a/tests/framework/validators/RequiredValidatorTest.php +++ b/tests/framework/validators/RequiredValidatorTest.php @@ -17,7 +17,7 @@ */ class RequiredValidatorTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/validators/StringValidatorTest.php b/tests/framework/validators/StringValidatorTest.php index bef0db0deb3..e02aff29249 100644 --- a/tests/framework/validators/StringValidatorTest.php +++ b/tests/framework/validators/StringValidatorTest.php @@ -16,7 +16,7 @@ */ class StringValidatorTest extends TestCase { - public function setUp() + public function setUp(): void { parent::setUp(); @@ -112,9 +112,9 @@ public function testValidateAttribute() public function testEnsureMessagesOnInit() { $val = new StringValidator(['min' => 1, 'max' => 2]); - $this->assertInternalType('string', $val->message); - $this->assertInternalType('string', $val->tooLong); - $this->assertInternalType('string', $val->tooShort); + $this->assertIsString($val->message); + $this->assertIsString($val->tooLong); + $this->assertIsString($val->tooShort); } public function testCustomErrorMessageInValidateAttribute() diff --git a/tests/framework/validators/UniqueValidatorTest.php b/tests/framework/validators/UniqueValidatorTest.php index 0c5149e5887..d580eefbc6d 100644 --- a/tests/framework/validators/UniqueValidatorTest.php +++ b/tests/framework/validators/UniqueValidatorTest.php @@ -22,7 +22,7 @@ abstract class UniqueValidatorTest extends DatabaseTestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); ActiveRecord::$db = $this->getConnection(); @@ -34,7 +34,7 @@ protected function setUp() public function testAssureMessageSetOnInit() { $val = new UniqueValidator(); - $this->assertInternalType('string', $val->message); + $this->assertIsString($val->message); } public function testCustomMessage() diff --git a/tests/framework/validators/UrlValidatorTest.php b/tests/framework/validators/UrlValidatorTest.php index 7872d9d21e9..99866a9655e 100644 --- a/tests/framework/validators/UrlValidatorTest.php +++ b/tests/framework/validators/UrlValidatorTest.php @@ -16,7 +16,7 @@ */ class UrlValidatorTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/validators/ValidatorTest.php b/tests/framework/validators/ValidatorTest.php index 3f3eb8c0dd0..cd25e3895db 100644 --- a/tests/framework/validators/ValidatorTest.php +++ b/tests/framework/validators/ValidatorTest.php @@ -24,7 +24,7 @@ */ class ValidatorTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/web/AssetBundleTest.php b/tests/framework/web/AssetBundleTest.php index a0399d0aa85..70471af07eb 100644 --- a/tests/framework/web/AssetBundleTest.php +++ b/tests/framework/web/AssetBundleTest.php @@ -18,7 +18,7 @@ */ class AssetBundleTest extends \yiiunit\TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); @@ -124,7 +124,7 @@ public function testSourcesPublish_AssetManagerBeforeCopy() $this->assertFalse(is_dir($bundle->basePath)); foreach ($bundle->js as $filename) { $publishedFile = $bundle->basePath . DIRECTORY_SEPARATOR . $filename; - $this->assertFileNotExists($publishedFile); + $this->assertFileDoesNotExist($publishedFile); } } @@ -144,7 +144,7 @@ public function testSourcesPublish_AssetBeforeCopy() $this->assertFalse(is_dir($bundle->basePath)); foreach ($bundle->js as $filename) { $publishedFile = $bundle->basePath . DIRECTORY_SEPARATOR . $filename; - $this->assertFileNotExists($publishedFile); + $this->assertFileDoesNotExist($publishedFile); } } @@ -163,7 +163,7 @@ public function testSourcesPublish_publishOptions_Only() $bundle->publish($am); $notNeededFilesDir = dirname($bundle->basePath . DIRECTORY_SEPARATOR . $bundle->css[0]); - $this->assertFileNotExists($notNeededFilesDir); + $this->assertFileDoesNotExist($notNeededFilesDir); foreach ($bundle->js as $filename) { $publishedFile = $bundle->basePath . DIRECTORY_SEPARATOR . $filename; @@ -189,7 +189,9 @@ public function testBasePathIsWritableOnPublish() $view = $this->getView(['basePath' => '@testReadOnlyAssetPath']); $bundle = new TestSourceAsset(); - $this->setExpectedException('yii\base\InvalidConfigException', 'The directory is not writable by the Web process'); + $this->expectException(\yii\base\InvalidConfigException::class); + $this->expectExceptionMessage('The directory is not writable by the Web process'); + $bundle->publish($view->getAssetManager()); FileHelper::removeDirectory($path); @@ -543,7 +545,7 @@ public function testCustomFilePublishWithTimestamp() $am = $view->assetManager; // publishing without timestamp $result = $am->publish($path . '/data.txt'); - $this->assertRegExp('/.*data.txt$/i', $result[1]); + $this->assertMatchesRegularExpression('/.*data.txt$/i', $result[1]); unset($view, $am, $result); $view = $this->getView(); @@ -551,7 +553,7 @@ public function testCustomFilePublishWithTimestamp() // turn on timestamp appending $am->appendTimestamp = true; $result = $am->publish($path . '/data.txt'); - $this->assertRegExp('/.*data.txt\?v=\d+$/i', $result[1]); + $this->assertMatchesRegularExpression('/.*data.txt\?v=\d+$/i', $result[1]); } /** @@ -563,7 +565,7 @@ public function testNonRelativeAssetWebPathWithTimestamp() $view = $this->getView(['appendTimestamp' => true]); TestNonRelativeAsset::register($view); - $this->assertRegExp( + $this->assertMatchesRegularExpression( '~123', $html); + $this->assertStringContainsString('', $html); $view = new View(); $view->registerJsVar('objectTest', @@ -44,7 +44,10 @@ public function testRegisterJsVar() 'question' => 'Unknown', ]); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', $html); + $this->assertStringContainsString( + '', + $html, + ); } public function testRegisterJsFileWithAlias() @@ -61,7 +64,7 @@ public function testRegisterJsFileWithAlias() $view = new View(); $view->registerJsFile('@web/js/somefile.js', ['position' => View::POS_HEAD]); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', $html); + $this->assertStringContainsString('', $html); $view = new View(); $view->registerJsFile('@web/js/somefile.js', ['position' => View::POS_BEGIN]); @@ -71,13 +74,13 @@ public function testRegisterJsFileWithAlias() $view = new View(); $view->registerJsFile('@web/js/somefile.js', ['position' => View::POS_END]); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', $html); + $this->assertStringContainsString('', $html); // alias with depends $view = new View(); $view->registerJsFile('@web/js/somefile.js', ['position' => View::POS_END, 'depends' => 'yii\web\AssetBundle']); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', $html); + $this->assertStringContainsString('', $html); } public function testRegisterCssFileWithAlias() @@ -94,14 +97,14 @@ public function testRegisterCssFileWithAlias() $view = new View(); $view->registerCssFile('@web/css/somefile.css'); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', $html); + $this->assertStringContainsString('', $html); // with depends $view = new View(); $view->registerCssFile('@web/css/somefile.css', ['position' => View::POS_END, 'depends' => 'yii\web\AssetBundle']); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', $html); + $this->assertStringContainsString('', $html); } public function testRegisterregisterCsrfMetaTags() @@ -113,7 +116,7 @@ public function testRegisterregisterCsrfMetaTags() 'scriptUrl' => '/baseUrl/index.php', ], 'cache' => [ - 'class' => FileCache::className(), + 'class' => FileCache::class, ], ], ]); @@ -122,16 +125,16 @@ public function testRegisterregisterCsrfMetaTags() $view->registerCsrfMetaTags(); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', $html); - $this->assertContains('', $html); + $this->assertStringContainsString('', $html); - $this->assertContains('', $html); + $this->assertStringContainsString(' $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertRegExp($pattern, $html); + $this->assertMatchesRegularExpression($pattern, $html); // test append timestamp when @web is prefixed in url \Yii::setAlias('@web', '/test-app'); @@ -191,7 +194,7 @@ public function testAppendTimestampForRegisterJsFile() $view->registerJsFile(\Yii::getAlias('@web/assetSources/js/jquery.js'), ['depends' => 'yii\web\AssetBundle']); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertRegExp($pattern, $html); + $this->assertMatchesRegularExpression($pattern, $html); // test append timestamp when @web has the same name as the asset-source folder \Yii::setAlias('@web', '/assetSources/'); @@ -199,7 +202,7 @@ public function testAppendTimestampForRegisterJsFile() $view->registerJsFile(\Yii::getAlias('@web/assetSources/js/jquery.js'), ['depends' => 'yii\web\AssetBundle']); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertRegExp($pattern, $html); + $this->assertMatchesRegularExpression($pattern, $html); // reset aliases $this->setUpAliases(); @@ -207,26 +210,26 @@ public function testAppendTimestampForRegisterJsFile() $view = new View(); $view->registerJsFile('/assetSources/js/jquery.js'); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertRegExp($pattern, $html); + $this->assertMatchesRegularExpression($pattern, $html); $view = new View(); $view->registerJsFile('/assetSources/js/jquery.js', ['appendTimestamp' => true]); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertRegExp($pattern, $html); + $this->assertMatchesRegularExpression($pattern, $html); // redefine AssetManager timestamp setting $view = new View(); $view->registerJsFile('/assetSources/js/jquery.js', ['appendTimestamp' => false]); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertNotRegExp($pattern, $html); + $this->assertDoesNotMatchRegularExpression($pattern, $html); // with alias $view = new View(); $view->registerJsFile('@web/assetSources/js/jquery.js'); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertRegExp($pattern, $html); + $this->assertMatchesRegularExpression($pattern, $html); // with alias but wo timestamp // redefine AssetManager timestamp setting @@ -237,35 +240,41 @@ public function testAppendTimestampForRegisterJsFile() 'depends' => 'yii\web\AssetBundle', ]); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertNotRegExp($pattern, $html); + $this->assertDoesNotMatchRegularExpression($pattern, $html); // wo depends == wo AssetManager $view = new View(); $view->registerJsFile('@web/assetSources/js/jquery.js', ['appendTimestamp' => false]); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertNotRegExp($pattern, $html); + $this->assertDoesNotMatchRegularExpression($pattern, $html); // absolute link $view = new View(); $view->registerJsFile('http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', - $html); + $this->assertStringContainsString( + '', + $html, + ); $view = new View(); $view->registerJsFile('//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js', ['depends' => 'yii\web\AssetBundle']); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', - $html); + $this->assertStringContainsString( + '', + $html, + ); $view = new View(); $view->registerJsFile('http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js', ['depends' => 'yii\web\AssetBundle']); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', - $html); + $this->assertStringContainsString( + '', + $html, + ); \Yii::$app->assetManager->appendTimestamp = false; @@ -273,18 +282,18 @@ public function testAppendTimestampForRegisterJsFile() $view->registerJsFile('/assetSources/js/jquery.js', ['depends' => 'yii\web\AssetBundle']); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertNotRegExp($pattern, $html); + $this->assertDoesNotMatchRegularExpression($pattern, $html); $view = new View(); $view->registerJsFile('/assetSources/js/jquery.js'); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertNotRegExp($pattern, $html); + $this->assertDoesNotMatchRegularExpression($pattern, $html); $view = new View(); $view->registerJsFile('/assetSources/js/jquery.js', ['appendTimestamp' => true]); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertRegExp($pattern, $html); + $this->assertMatchesRegularExpression($pattern, $html); // redefine AssetManager timestamp setting $view = new View(); @@ -294,35 +303,40 @@ public function testAppendTimestampForRegisterJsFile() 'depends' => 'yii\web\AssetBundle', ]); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertRegExp($pattern, $html); + $this->assertMatchesRegularExpression($pattern, $html); $view = new View(); $view->registerJsFile('/assetSources/js/jquery.js', ['appendTimestamp' => false]); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertNotRegExp($pattern, $html); + $this->assertDoesNotMatchRegularExpression($pattern, $html); // absolute link $view = new View(); $view->registerJsFile('http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', - $html); + $this->assertStringContainsString( + '', + $html, + ); $view = new View(); $view->registerJsFile('//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js', ['depends' => 'yii\web\AssetBundle']); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', - $html); + $this->assertStringContainsString( + '', + $html, + ); $view = new View(); $view->registerJsFile('http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js', ['depends' => 'yii\web\AssetBundle']); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', - $html); - + $this->assertStringContainsString( + '', + $html, + ); } public function testAppendTimestampForRegisterCssFile() @@ -347,7 +361,7 @@ public function testAppendTimestampForRegisterCssFile() $view->registerCssFile('/assetSources/css/stub.css', ['depends' => 'yii\web\AssetBundle']); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertRegExp($pattern, $html); + $this->assertMatchesRegularExpression($pattern, $html); // test append timestamp when @web is prefixed in url \Yii::setAlias('@web', '/test-app'); @@ -355,7 +369,7 @@ public function testAppendTimestampForRegisterCssFile() $view->registerCssFile(\Yii::getAlias('@web/assetSources/css/stub.css'), ['depends' => 'yii\web\AssetBundle']); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertRegExp($pattern, $html); + $this->assertMatchesRegularExpression($pattern, $html); // test append timestamp when @web has the same name as the asset-source folder \Yii::setAlias('@web', '/assetSources/'); @@ -363,7 +377,7 @@ public function testAppendTimestampForRegisterCssFile() $view->registerCssFile(\Yii::getAlias('@web/assetSources/css/stub.css'), ['depends' => 'yii\web\AssetBundle']); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertRegExp($pattern, $html); + $this->assertMatchesRegularExpression($pattern, $html); // reset aliases $this->setUpAliases(); @@ -371,26 +385,26 @@ public function testAppendTimestampForRegisterCssFile() $view = new View(); $view->registerCssFile('/assetSources/css/stub.css'); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertRegExp($pattern, $html); + $this->assertMatchesRegularExpression($pattern, $html); $view = new View(); $view->registerCssFile('/assetSources/css/stub.css', ['appendTimestamp' => true]); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertRegExp($pattern, $html); + $this->assertMatchesRegularExpression($pattern, $html); // redefine AssetManager timestamp setting $view = new View(); $view->registerCssFile('/assetSources/css/stub.css', ['appendTimestamp' => false]); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertNotRegExp($pattern, $html); + $this->assertDoesNotMatchRegularExpression($pattern, $html); // with alias $view = new View(); $view->registerCssFile('@web/assetSources/css/stub.css'); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertRegExp($pattern, $html); + $this->assertMatchesRegularExpression($pattern, $html); // with alias but wo timestamp // redefine AssetManager timestamp setting @@ -401,35 +415,41 @@ public function testAppendTimestampForRegisterCssFile() 'depends' => 'yii\web\AssetBundle', ]); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertNotRegExp($pattern, $html); + $this->assertDoesNotMatchRegularExpression($pattern, $html); // wo depends == wo AssetManager $view = new View(); $view->registerCssFile('@web/assetSources/css/stub.css', ['appendTimestamp' => false]); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertNotRegExp($pattern, $html); + $this->assertDoesNotMatchRegularExpression($pattern, $html); // absolute link $view = new View(); $view->registerCssFile('https://cdnjs.cloudflare.com/ajax/libs/balloon-css/1.0.3/balloon.css'); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', - $html); + $this->assertStringContainsString( + '', + $html, + ); $view = new View(); $view->registerCssFile('//cdnjs.cloudflare.com/ajax/libs/balloon-css/1.0.3/balloon.css', ['depends' => 'yii\web\AssetBundle']); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', - $html); + $this->assertStringContainsString( + '', + $html, + ); $view = new View(); $view->registerCssFile('https://cdnjs.cloudflare.com/ajax/libs/balloon-css/1.0.3/balloon.css', ['depends' => 'yii\web\AssetBundle']); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', - $html); + $this->assertStringContainsString( + '', + $html, + ); \Yii::$app->assetManager->appendTimestamp = false; @@ -437,18 +457,18 @@ public function testAppendTimestampForRegisterCssFile() $view->registerCssFile('/assetSources/css/stub.css', ['depends' => 'yii\web\AssetBundle']); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertNotRegExp($pattern, $html); + $this->assertDoesNotMatchRegularExpression($pattern, $html); $view = new View(); $view->registerCssFile('/assetSources/css/stub.css'); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertNotRegExp($pattern, $html); + $this->assertDoesNotMatchRegularExpression($pattern, $html); $view = new View(); $view->registerCssFile('/assetSources/css/stub.css', ['appendTimestamp' => true]); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertRegExp($pattern, $html); + $this->assertMatchesRegularExpression($pattern, $html); // redefine AssetManager timestamp setting $view = new View(); @@ -458,33 +478,39 @@ public function testAppendTimestampForRegisterCssFile() 'depends' => 'yii\web\AssetBundle', ]); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertRegExp($pattern, $html); + $this->assertMatchesRegularExpression($pattern, $html); $view = new View(); $view->registerCssFile('/assetSources/css/stub.css', ['appendTimestamp' => false]); // $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertNotRegExp($pattern, $html); + $this->assertDoesNotMatchRegularExpression($pattern, $html); // absolute link $view = new View(); $view->registerCssFile('https://cdnjs.cloudflare.com/ajax/libs/balloon-css/1.0.3/balloon.css'); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', - $html); + $this->assertStringContainsString( + '', + $html, + ); $view = new View(); $view->registerCssFile('//cdnjs.cloudflare.com/ajax/libs/balloon-css/1.0.3/balloon.css', ['depends' => 'yii\web\AssetBundle']); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', - $html); + $this->assertStringContainsString( + '', + $html, + ); $view = new View(); $view->registerCssFile('https://cdnjs.cloudflare.com/ajax/libs/balloon-css/1.0.3/balloon.css', ['depends' => 'yii\web\AssetBundle']); $html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']); - $this->assertContains('', - $html); + $this->assertStringContainsString( + '', + $html, + ); } } diff --git a/tests/framework/web/session/AbstractDbSessionTest.php b/tests/framework/web/session/AbstractDbSessionTest.php index 5fdfe50f98b..f8dbb32f550 100644 --- a/tests/framework/web/session/AbstractDbSessionTest.php +++ b/tests/framework/web/session/AbstractDbSessionTest.php @@ -27,7 +27,7 @@ abstract class AbstractDbSessionTest extends TestCase */ abstract protected function getDriverNames(); - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -37,7 +37,7 @@ protected function setUp() $this->createTableSession(); } - protected function tearDown() + protected function tearDown(): void { $this->dropTableSession(); parent::tearDown(); diff --git a/tests/framework/web/session/CacheSessionTest.php b/tests/framework/web/session/CacheSessionTest.php index d34f7b7f82f..cc62e1b3681 100644 --- a/tests/framework/web/session/CacheSessionTest.php +++ b/tests/framework/web/session/CacheSessionTest.php @@ -18,7 +18,7 @@ class CacheSessionTest extends \yiiunit\TestCase { use SessionTestTrait; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); diff --git a/tests/framework/web/session/pgsql/DbSessionTest.php b/tests/framework/web/session/pgsql/DbSessionTest.php index 8ef66fd0130..9af861b09f7 100644 --- a/tests/framework/web/session/pgsql/DbSessionTest.php +++ b/tests/framework/web/session/pgsql/DbSessionTest.php @@ -17,7 +17,7 @@ */ class DbSessionTest extends \yiiunit\framework\web\session\AbstractDbSessionTest { - protected function setUp() + protected function setUp(): void { if (defined('HHVM_VERSION')) { $this->markTestSkipped('HHVMs PgSQL implementation does not seem to support blob columns in the way they are used here.'); diff --git a/tests/framework/web/session/sqlite/DbSessionTest.php b/tests/framework/web/session/sqlite/DbSessionTest.php index e13539cebd0..a7e0154f538 100644 --- a/tests/framework/web/session/sqlite/DbSessionTest.php +++ b/tests/framework/web/session/sqlite/DbSessionTest.php @@ -19,7 +19,7 @@ */ class DbSessionTest extends \yiiunit\framework\web\session\AbstractDbSessionTest { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/widgets/ActiveFieldTest.php b/tests/framework/widgets/ActiveFieldTest.php index 0ac63c77b3f..172439a150a 100644 --- a/tests/framework/widgets/ActiveFieldTest.php +++ b/tests/framework/widgets/ActiveFieldTest.php @@ -7,6 +7,7 @@ namespace yiiunit\framework\widgets; +use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts; use Yii; use yii\base\DynamicModel; use yii\web\AssetManager; @@ -23,6 +24,8 @@ */ class ActiveFieldTest extends \yiiunit\TestCase { + use ArraySubsetAsserts; + /** * @var ActiveFieldExtend */ @@ -37,7 +40,7 @@ class ActiveFieldTest extends \yiiunit\TestCase private $helperForm; private $attributeName = 'attributeName'; - protected function setUp() + protected function setUp(): void { parent::setUp(); // dirty way to have Request object not throwing exception when running testHomeLinkNull() @@ -668,26 +671,26 @@ public function testOptionsClass() public function testInputOptionsTransferToWidget() { - $widget = $this->activeField->widget(TestMaskedInput::className(), [ + $widget = $this->activeField->widget(TestMaskedInput::class, [ 'mask' => '999-999-9999', 'options' => ['placeholder' => 'pholder_direct'], ]); - $this->assertContains('placeholder="pholder_direct"', (string) $widget); + $this->assertStringContainsString('placeholder="pholder_direct"', (string) $widget); // transfer options from ActiveField to widget $this->activeField->inputOptions = ['placeholder' => 'pholder_input']; - $widget = $this->activeField->widget(TestMaskedInput::className(), [ + $widget = $this->activeField->widget(TestMaskedInput::class, [ 'mask' => '999-999-9999', ]); - $this->assertContains('placeholder="pholder_input"', (string) $widget); + $this->assertStringContainsString('placeholder="pholder_input"', (string) $widget); // set both AF and widget options (second one takes precedence) $this->activeField->inputOptions = ['placeholder' => 'pholder_both_input']; - $widget = $this->activeField->widget(TestMaskedInput::className(), [ + $widget = $this->activeField->widget(TestMaskedInput::class, [ 'mask' => '999-999-9999', 'options' => ['placeholder' => 'pholder_both_direct'] ]); - $this->assertContains('placeholder="pholder_both_direct"', (string) $widget); + $this->assertStringContainsString('placeholder="pholder_both_direct"', (string) $widget); } /** diff --git a/tests/framework/widgets/ActiveFormTest.php b/tests/framework/widgets/ActiveFormTest.php index 64f921b0c24..11f8a09b0b0 100644 --- a/tests/framework/widgets/ActiveFormTest.php +++ b/tests/framework/widgets/ActiveFormTest.php @@ -17,7 +17,7 @@ */ class ActiveFormTest extends \yiiunit\TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); @@ -132,6 +132,9 @@ public function testRegisterClientScript() $form = ActiveForm::begin(['view' => $view, 'enableClientScript' => false]); $form->field($model, 'name'); $form::end(); + + $this->expectNotToPerformAssertions(); + ob_get_clean(); } diff --git a/tests/framework/widgets/BlockTest.php b/tests/framework/widgets/BlockTest.php index c7b8ad2f6ec..a6b6d7fc9c9 100644 --- a/tests/framework/widgets/BlockTest.php +++ b/tests/framework/widgets/BlockTest.php @@ -14,7 +14,7 @@ */ class BlockTest extends \yiiunit\TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/widgets/BreadcrumbsTest.php b/tests/framework/widgets/BreadcrumbsTest.php index 5a4fddcbb3b..fd2106c7bfc 100644 --- a/tests/framework/widgets/BreadcrumbsTest.php +++ b/tests/framework/widgets/BreadcrumbsTest.php @@ -19,7 +19,7 @@ class BreadcrumbsTest extends \yiiunit\TestCase { private $breadcrumbs; - protected function setUp() + protected function setUp(): void { parent::setUp(); // dirty way to have Request object not throwing exception when running testHomeLinkNull() diff --git a/tests/framework/widgets/ContentDecoratorTest.php b/tests/framework/widgets/ContentDecoratorTest.php index 02fc9a49766..c33c507ea73 100644 --- a/tests/framework/widgets/ContentDecoratorTest.php +++ b/tests/framework/widgets/ContentDecoratorTest.php @@ -14,7 +14,7 @@ */ class ContentDecoratorTest extends \yiiunit\TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/widgets/DetailViewTest.php b/tests/framework/widgets/DetailViewTest.php index a2fd34ef124..6b2f7fe3d96 100644 --- a/tests/framework/widgets/DetailViewTest.php +++ b/tests/framework/widgets/DetailViewTest.php @@ -20,7 +20,7 @@ class DetailViewTest extends \yiiunit\TestCase /** @var DetailView */ public $detailView; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/framework/widgets/FragmentCacheTest.php b/tests/framework/widgets/FragmentCacheTest.php index a3b040e8f9d..a08a0795efb 100644 --- a/tests/framework/widgets/FragmentCacheTest.php +++ b/tests/framework/widgets/FragmentCacheTest.php @@ -17,7 +17,7 @@ */ class FragmentCacheTest extends \yiiunit\TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockWebApplication(); diff --git a/tests/framework/widgets/LinkPagerTest.php b/tests/framework/widgets/LinkPagerTest.php index 265b891362b..492bf891b4a 100644 --- a/tests/framework/widgets/LinkPagerTest.php +++ b/tests/framework/widgets/LinkPagerTest.php @@ -16,7 +16,7 @@ */ class LinkPagerTest extends \yiiunit\TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication([ @@ -52,8 +52,14 @@ public function testFirstLastPageLabels() 'lastPageLabel' => true, ]); - static::assertContains('
  • 1
  • ', $output); - static::assertContains('
  • 25
  • ', $output); + $this->assertStringContainsString( + '
  • 1
  • ', + $output, + ); + $this->assertStringContainsString( + '
  • 25
  • ', + $output, + ); $output = LinkPager::widget([ 'pagination' => $pagination, @@ -61,8 +67,14 @@ public function testFirstLastPageLabels() 'lastPageLabel' => 'Last', ]); - static::assertContains('
  • First
  • ', $output); - static::assertContains('
  • Last
  • ', $output); + $this->assertStringContainsString( + '
  • First
  • ', + $output, + ); + $this->assertStringContainsString( + '
  • Last
  • ', + $output, + ); $output = LinkPager::widget([ 'pagination' => $pagination, @@ -70,8 +82,8 @@ public function testFirstLastPageLabels() 'lastPageLabel' => false, ]); - static::assertNotContains('
  • ', $output); - static::assertNotContains('
  • ', $output); + $this->assertStringNotContainsString('
  • ', $output); + $this->assertStringNotContainsString('
  • ', $output); } public function testDisabledPageElementOptions() @@ -81,7 +93,7 @@ public function testDisabledPageElementOptions() 'disabledListItemSubTagOptions' => ['class' => 'foo-bar'], ]); - static::assertContains('«', $output); + $this->assertStringContainsString('«', $output); } public function testDisabledPageElementOptionsWithTagOption() @@ -91,7 +103,7 @@ public function testDisabledPageElementOptionsWithTagOption() 'disabledListItemSubTagOptions' => ['class' => 'foo-bar', 'tag' => 'div'], ]); - static::assertContains('
    «
    ', $output); + $this->assertStringContainsString('
    «
    ', $output); } public function testDisableCurrentPageButton() @@ -102,14 +114,17 @@ public function testDisableCurrentPageButton() 'disableCurrentPageButton' => false, ]); - static::assertContains('
  • 6
  • ', $output); + $this->assertStringContainsString( + '
  • 6
  • ', + $output, + ); $output = LinkPager::widget([ 'pagination' => $pagination, 'disableCurrentPageButton' => true, ]); - static::assertContains('
  • 6
  • ', $output); + $this->assertStringContainsString('
  • 6
  • ', $output); } public function testOptionsWithTagOption() @@ -135,13 +150,13 @@ public function testLinkWrapOptions() ], ]); - $this->assertContains( + $this->assertStringContainsString( '
    3
    ', - $output + $output, ); - $this->assertContains( + $this->assertStringContainsString( '
    2
    ', - $output + $output, ); } diff --git a/tests/framework/widgets/LinkSorterTest.php b/tests/framework/widgets/LinkSorterTest.php index 49da1fce71e..652b8c18c2d 100644 --- a/tests/framework/widgets/LinkSorterTest.php +++ b/tests/framework/widgets/LinkSorterTest.php @@ -22,7 +22,7 @@ class LinkSorterTest extends DatabaseTestCase { protected $driverName = 'sqlite'; - protected function setUp() + protected function setUp(): void { parent::setUp(); ActiveRecord::$db = $this->getConnection(); diff --git a/tests/framework/widgets/ListViewTest.php b/tests/framework/widgets/ListViewTest.php index 6d3ff286f1f..8f01b9e78bd 100644 --- a/tests/framework/widgets/ListViewTest.php +++ b/tests/framework/widgets/ListViewTest.php @@ -18,7 +18,7 @@ */ class ListViewTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); diff --git a/tests/framework/widgets/MenuTest.php b/tests/framework/widgets/MenuTest.php index 192bb44131f..c8f8a3515bc 100644 --- a/tests/framework/widgets/MenuTest.php +++ b/tests/framework/widgets/MenuTest.php @@ -15,7 +15,7 @@ */ class MenuTest extends \yiiunit\TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockApplication(); diff --git a/tests/framework/widgets/PjaxTest.php b/tests/framework/widgets/PjaxTest.php index e08d5776f17..209fa16e0cc 100644 --- a/tests/framework/widgets/PjaxTest.php +++ b/tests/framework/widgets/PjaxTest.php @@ -33,7 +33,7 @@ public function testGeneratedIdByPjaxWidget() $this->assertEquals('p1', $pjax2->options['id']); } - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->mockWebApplication();