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 b2cc61a4f5b..9893def13f6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,62 +13,32 @@ concurrency: jobs: phpunit: - name: PHP ${{ matrix.php }} on ${{ matrix.os }} + name: PHP ${{ matrix.php }} - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: 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 extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached - os: ubuntu-latest + coverage: none - php: 7.4 - coverage: xdebug extensions: apc, curl, dom, imagick, intl, mbstring, mcrypt, memcached - os: ubuntu-latest + coverage: pcov - php: 8.0 - coverage: none extensions: apcu, curl, dom, imagick, intl, mbstring, mcrypt, memcached - os: ubuntu-latest - - php: 8.1 coverage: none + - php: 8.1 extensions: apcu, curl, dom, imagick, intl, mbstring, mcrypt, memcached - os: ubuntu-latest + coverage: none - php: 8.2 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. @@ -92,18 +62,14 @@ jobs: - name: Install dependencies. run: composer update $DEFAULT_COMPOSER_FLAGS - - name: Run tests with PHPUnit. - if: matrix.php < '7.4' || matrix.php >= '8.1' - run: vendor/bin/phpunit --verbose --exclude-group $PHPUNIT_EXCLUDE_GROUP --colors=always - - - name: Run tests with PHPUnit. - if: matrix.php == '8.0' - run: vendor/bin/phpunit --verbose --exclude-group $PHPUNIT_EXCLUDE_GROUP --colors=always - - name: Run tests with PHPUnit and generate coverage. if: matrix.php == '7.4' run: vendor/bin/phpunit --verbose --exclude-group $PHPUNIT_EXCLUDE_GROUP --coverage-clover=coverage.xml --colors=always + - name: Run tests with PHPUnit. + if: matrix.php >= '8.0' + run: vendor/bin/phpunit --verbose --exclude-group $PHPUNIT_EXCLUDE_GROUP --colors=always + - name: Upload coverage to Codecov. if: matrix.php == '7.4' uses: codecov/codecov-action@v3 diff --git a/.github/workflows/ci-mssql.yml b/.github/workflows/ci-mssql.yml index e80550119d0..9efead3d6dd 100644 --- a/.github/workflows/ci-mssql.yml +++ b/.github/workflows/ci-mssql.yml @@ -66,15 +66,9 @@ jobs: run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - name: Run MSSQL tests with PHPUnit and generate coverage. - if: matrix.php == '7.4' run: vendor/bin/phpunit --group mssql --coverage-clover=coverage.xml --colors=always - - name: Run MSSQL tests with PHPUnit. - if: matrix.php > '7.4' - run: vendor/bin/phpunit --group mssql --colors=always - - name: Upload coverage to Codecov. - if: matrix.php == '7.4' uses: codecov/codecov-action@v3 with: file: ./coverage.xml diff --git a/.github/workflows/ci-mysql.yml b/.github/workflows/ci-mysql.yml index 4e0f651aae9..11e3efbdbca 100644 --- a/.github/workflows/ci-mysql.yml +++ b/.github/workflows/ci-mysql.yml @@ -15,13 +15,10 @@ jobs: extensions: curl, intl, pdo, pdo_mysql XDEBUG_MODE: coverage, develop - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: matrix: - os: - - ubuntu-latest - php: - 7.4 - 8.0 @@ -60,15 +57,9 @@ jobs: run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - name: Run MySQL tests with PHPUnit and generate coverage. - if: matrix.php == '7.4' run: vendor/bin/phpunit --group mysql --coverage-clover=coverage.xml --colors=always - - name: Run MySQL tests with PHPUnit. - if: matrix.php > '7.4' - run: vendor/bin/phpunit --group mysql --colors=always - - name: Upload coverage to Codecov. - if: matrix.php == '7.4' uses: codecov/codecov-action@v3 with: file: ./coverage.xml diff --git a/.github/workflows/ci-pgsql.yml b/.github/workflows/ci-pgsql.yml index ba0217e2212..a64620a2d02 100644 --- a/.github/workflows/ci-pgsql.yml +++ b/.github/workflows/ci-pgsql.yml @@ -15,13 +15,10 @@ jobs: extensions: curl, intl, pdo, pdo_pgsql XDEBUG_MODE: coverage, develop - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: matrix: - os: - - ubuntu-latest - php: - 7.4 - 8.0 @@ -68,15 +65,9 @@ jobs: run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - name: Run Pgsql tests with PHPUnit and generate coverage. - if: matrix.php == '7.4' run: vendor/bin/phpunit --group pgsql --coverage-clover=coverage.xml --colors=always - - name: Run Pgsql tests with PHPUnit. - if: matrix.php > '7.4' - run: vendor/bin/phpunit --group pgsql --colors=always - - name: Upload coverage to Codecov. - if: matrix.php == '7.4' uses: codecov/codecov-action@v3 with: file: ./coverage.xml diff --git a/.github/workflows/ci-sqlite.yml b/.github/workflows/ci-sqlite.yml index 707ecb1b9aa..949fb0d6aae 100644 --- a/.github/workflows/ci-sqlite.yml +++ b/.github/workflows/ci-sqlite.yml @@ -20,9 +20,6 @@ jobs: strategy: matrix: - os: - - ubuntu-latest - php: - 7.4 - 8.0 @@ -50,15 +47,9 @@ jobs: run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - name: Run SQLite tests with PHPUnit and generate coverage. - if: matrix.php == '7.4' run: vendor/bin/phpunit --group sqlite --coverage-clover=coverage.xml --colors=always - - name: Run SQLite tests with PHPUnit. - if: matrix.php > '7.4' - run: vendor/bin/phpunit --group sqlite --colors=always - - name: Upload coverage to Codecov. - if: matrix.php == '7.4' uses: codecov/codecov-action@v3 with: file: ./coverage.xml diff --git a/composer.json b/composer.json index 937900a8004..c80f2ac7f15 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", "cebe/indent": "~1.0.2", - "johnkary/phpunit-speedtrap": "^1.0", "dealerdirect/phpcodesniffer-composer-installer": "*", + "dms/phpunit-arraysubset-asserts": "^0.5", + "phpunit/phpunit": "9.6", "yiisoft/yii2-coding-standards": "^3.0" }, "repositories": [ @@ -122,20 +121,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 0b04891c850..e6caf6b55be 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": "7f989051117a0e72e6e59f7e1e568220", + "content-hash": "fe4cba7b97bdf43a740c7f6f9d224ae8", "packages": [ { "name": "bower-asset/inputmask", @@ -371,54 +371,6 @@ }, "time": "2014-05-23T14:40:08+00:00" }, - { - "name": "cweagans/composer-patches", - "version": "1.7.3", - "source": { - "type": "git", - "url": "https://github.com/cweagans/composer-patches.git", - "reference": "e190d4466fe2b103a55467dfa83fc2fecfcaf2db" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/cweagans/composer-patches/zipball/e190d4466fe2b103a55467dfa83fc2fecfcaf2db", - "reference": "e190d4466fe2b103a55467dfa83fc2fecfcaf2db", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0 || ^2.0", - "php": ">=5.3.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": "dealerdirect/phpcodesniffer-composer-installer", "version": "v1.0.0", @@ -497,32 +449,76 @@ }, "time": "2023-01-05T11:28:13+00:00" }, + { + "name": "dms/phpunit-arraysubset-asserts", + "version": "v0.5.0", + "source": { + "type": "git", + "url": "https://github.com/rdohms/phpunit-arraysubset-asserts.git", + "reference": "aa6b9e858414e91cca361cac3b2035ee57d212e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rdohms/phpunit-arraysubset-asserts/zipball/aa6b9e858414e91cca361cac3b2035ee57d212e0", + "reference": "aa6b9e858414e91cca361cac3b2035ee57d212e0", + "shasum": "" + }, + "require": { + "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": { + "dms/coding-standard": "^9" + }, + "type": "library", + "autoload": { + "files": [ + "assertarraysubset-autoload.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Rafael Dohms", + "email": "rdohms@gmail.com" + } + ], + "description": "This package provides ArraySubset and related asserts once deprecated in PHPUnit 8", + "support": { + "issues": "https://github.com/rdohms/phpunit-arraysubset-asserts/issues", + "source": "https://github.com/rdohms/phpunit-arraysubset-asserts/tree/v0.5.0" + }, + "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": { @@ -549,7 +545,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": [ { @@ -565,212 +561,283 @@ "type": "tidelift" } ], - "time": "2022-12-30T00:15:36+00:00" + "time": "2022-12-30T00:23:10+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": "phpdocumentor/reflection-docblock", - "version": "2.0.5", + "name": "nikic/php-parser", + "version": "v5.0.2", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b" + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e6a969a640b00d8daa3c66518b0405fb41ae0c4b", - "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", + "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", "shasum": "" }, "require": { - "php": ">=5.3.3" + "ext-ctype": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "php": ">=7.4" }, "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, + "bin": [ + "bin/php-parse" + ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "5.0-dev" } }, "autoload": { - "psr-0": { - "phpDocumentor": [ - "src/" - ] + "psr-4": { + "PhpParser\\": "lib/PhpParser" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" + "name": "Nikita Popov" } ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/release/2.x" + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" }, - "time": "2016-01-25T08:17:30+00:00" + "time": "2024-03-05T20:51:40+00:00" }, { - "name": "phpspec/prophecy", - "version": "v1.5.0", + "name": "phar-io/manifest", + "version": "2.0.4", "source": { "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7" + "url": "https://github.com/phar-io/manifest.git", + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7", - "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "phpdocumentor/reflection-docblock": "~2.0", - "sebastian/comparator": "~1.1" - }, - "require-dev": { - "phpspec/phpspec": "~2.0" + "ext-dom": "*", + "ext-libxml": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "2.0.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": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" }, { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" } ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" + "time": "2024-03-03T12:33:53+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } ], + "description": "Library for handling version information and constraints", "support": { - "issues": "https://github.com/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.31", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" }, "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/48c34b5d8d983006bd2adc2d0de92963b9155965", + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", "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.18 || ^5.0", + "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": { @@ -785,7 +852,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -797,33 +864,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.31" }, - "time": "2015-10-06T15:47:00+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:37:42+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": { @@ -838,7 +914,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -849,30 +925,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/" @@ -889,38 +982,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/" @@ -933,47 +1037,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": { @@ -988,58 +1096,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.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "7eb45205d27edd94bd2b3614085ea158bd1e2bca" + "reference": "70fc8be1d0b9fad56a199a4df5f9cfabfc246f84" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7eb45205d27edd94bd2b3614085ea158bd1e2bca", - "reference": "7eb45205d27edd94bd2b3614085ea158bd1e2bca", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/70fc8be1d0b9fad56a199a4df5f9cfabfc246f84", + "reference": "70fc8be1d0b9fad56a199a4df5f9cfabfc246f84", "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.13", + "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": "*", + "ext-xdebug": "*" }, "bin": [ "phpunit" @@ -1047,10 +1170,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/" ] @@ -1075,40 +1201,48 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/4.8.34" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.0" }, - "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-02-03T07:32:24+00:00" }, { - "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", + "name": "sebastian/cli-parser", + "version": "1.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "suggest": { - "ext-soap": "*" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "1.0-dev" } }, "autoload": { @@ -1123,50 +1257,161 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", "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/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" }, - "abandoned": true, - "time": "2015-10-02T06:51:40+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:27:43+00:00" }, { - "name": "sebastian/comparator", - "version": "1.2.4", + "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": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1179,6 +1424,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1190,14 +1439,10 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", @@ -1205,34 +1450,98 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/1.2" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" }, - "time": "2017-01-29T09:50:25+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T12:41:17+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18 || ^5.0", + "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", + "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.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-22T06:19:30+00:00" }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1245,50 +1554,62 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff" + "diff", + "udiff", + "unidiff", + "unified diff" ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/master" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" }, - "time": "2015-12-08T07:14:41+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:30:58+00:00" }, { "name": "sebastian/environment", - "version": "1.3.7", + "version": "5.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716" + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716", - "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -1315,36 +1636,42 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/1.3.7" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" }, - "time": "2016-05-17T03:18:57+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:03:51+00:00" }, { "name": "sebastian/exporter", - "version": "1.2.2", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" }, "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": { @@ -1357,6 +1684,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1365,50 +1696,55 @@ "name": "Volker Dusch", "email": "github@wallbash.com" }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, { "name": "Adam Harvey", "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/master" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" }, - "time": "2016-06-17T09:04:28+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:33:00+00:00" }, { "name": "sebastian/global-state", - "version": "1.1.1", + "version": "5.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "ext-dom": "*", + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-uopz": "*" @@ -1416,7 +1752,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1441,34 +1777,209 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/1.1.1" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-02T06:35:11+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18 || ^5.0", + "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 counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-12-22T06:20:34+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] }, - "time": "2015-10-12T03:26:01+00:00" + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "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": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" }, { "name": "sebastian/recursion-context", - "version": "1.0.5", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", "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.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1481,42 +1992,166 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, { "name": "Adam Harvey", "email": "aharvey@php.net" } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/master" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, - "time": "2016-10-03T07:41:43+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:07:39+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "3.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-03-14T16:00:52+00:00" + }, + { + "name": "sebastian/type", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + }, + "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/" @@ -1537,9 +2172,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": "squizlabs/php_codesniffer", @@ -1622,154 +2263,54 @@ "time": "2024-02-16T15:06:51+00:00" }, { - "name": "symfony/polyfill-ctype", - "version": "v1.29.0", + "name": "theseer/tokenizer", + "version": "1.2.3", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" + "url": "https://github.com/theseer/tokenizer.git", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-01-29T20:11:03+00:00" - }, - { - "name": "symfony/yaml", - "version": "v3.4.47", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "88289caa3c166321883f67fe5130188ebbb47094" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/88289caa3c166321883f67fe5130188ebbb47094", - "reference": "88289caa3c166321883f67fe5130188ebbb47094", - "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.3" }, "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": "2024-03-03T12:36:25+00:00" }, { "name": "yiisoft/yii2-coding-standards", @@ -1866,7 +2407,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 1ac1fefa6ae..00000000000 --- a/framework/base/Object.php +++ /dev/null @@ -1,31 +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/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..8e25a0d7349 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::dumpAsString($value); + } + $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/data/validators/models/ValidatorTestTypedPropModel.php b/tests/data/validators/models/ValidatorTestTypedPropModel.php index fa838e183d8..5c676911924 100644 --- a/tests/data/validators/models/ValidatorTestTypedPropModel.php +++ b/tests/data/validators/models/ValidatorTestTypedPropModel.php @@ -11,5 +11,8 @@ class ValidatorTestTypedPropModel extends Model { - public array $arrayTypedProperty = [true, false]; + /** + * @var array + */ + public $arrayTypedProperty = [true, false]; } 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..0dd72530b58 100644 --- a/tests/framework/ChangeLogTest.php +++ b/tests/framework/ChangeLogTest.php @@ -54,6 +54,9 @@ 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..79e7c07a31a 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; @@ -159,19 +159,6 @@ public function testReadingWriteOnlyProperty() $this->expectExceptionMessage('Getting write-only property: yiiunit\framework\base\NewObject::writeOnly'); $this->object->writeOnly; } - - public function testBackwardCompatibilityWithObject() - { - if (PHP_MAJOR_VERSION > 7 || (PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION >= 2)) { - $this->markTestSkipped('This test is meant to run on PHP <7.2.0 to check BC with yii\base\Object'); - } - $this->assertInstanceOf('yii\base\Object', new BCObject()); - $this->assertInstanceOf('yii\base\BaseObject', new BCObject()); - - BCObject::$initCalled = false; - new BCObject(); - $this->assertTrue(BCObject::$initCalled); - } } 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..f01d21476f3 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; @@ -451,11 +451,6 @@ public function testDetachNotAttachedHandler() */ public function testEventClosureDetachesItself() { - if (PHP_VERSION_ID < 70000) { - $this->markTestSkipped('Can not be tested on PHP < 7.0'); - return; - } - $obj = require __DIR__ . '/stub/AnonymousComponentClass.php'; $obj->trigger('barEventOnce'); 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..991ed08c0b0 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(); @@ -502,11 +502,6 @@ public function testValidateAttributeNames() public function testFormNameWithAnonymousClass() { - if (PHP_VERSION_ID < 70000) { - $this->markTestSkipped('Can not be tested on PHP < 7.0'); - return; - } - $model = require __DIR__ . '/stub/AnonymousModelClass.php'; $this->expectException('yii\base\InvalidConfigException'); 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..621c15fb156 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() + protected function setUp(): void { parent::setUp(); @@ -33,7 +33,7 @@ public function setUp() FileHelper::createDirectory($this->testViewPath); } - public function tearDown() + protected 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..0c4fa2edb9f 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() + protected 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() + protected 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..31dc224d997 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() + protected 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() + protected 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..389be398a88 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() + protected 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() + protected 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..b6254d6fd61 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() + protected function setUp(): void { $this->mockApplication([ 'components' => [ @@ -52,7 +52,7 @@ public function setUp() $this->getUser()->login(10); } - public function tearDown() + protected 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..098b810ddde 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() + protected 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() + protected function tearDown(): void { Yii::$app->getDb()->close(); parent::tearDown(); @@ -152,7 +152,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 +168,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 +184,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; } @@ -233,7 +233,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 +249,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..ad1444c4470 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() + protected 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() + protected 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..8a64fcb90f4 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() + protected 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() + protected 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 bb723be3a49..a87a87e8542 100644 --- a/tests/framework/caching/DbDependencyTest.php +++ b/tests/framework/caching/DbDependencyTest.php @@ -24,7 +24,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..aa12bf9cc13 100644 --- a/tests/framework/caching/FileCacheTest.php +++ b/tests/framework/caching/FileCacheTest.php @@ -77,44 +77,9 @@ 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)); } - - public function testCacheRenewalOnDifferentOwnership() - { - $TRAVIS_SECOND_USER = getenv('TRAVIS_SECOND_USER'); - if (empty($TRAVIS_SECOND_USER)) { - $this->markTestSkipped('Travis second user not found'); - } - - $cache = $this->getCacheInstance(); - - $cacheValue = uniqid('value_'); - $cachePublicKey = uniqid('key_'); - $cacheInternalKey = $cache->buildKey($cachePublicKey); - - static::$time = \time(); - $this->assertTrue($cache->set($cachePublicKey, $cacheValue, 2)); - $this->assertSame($cacheValue, $cache->get($cachePublicKey)); - - $refClass = new \ReflectionClass($cache); - $refMethodGetCacheFile = $refClass->getMethod('getCacheFile'); - $refMethodGetCacheFile->setAccessible(true); - $cacheFile = $refMethodGetCacheFile->invoke($cache, $cacheInternalKey); - $refMethodGetCacheFile->setAccessible(false); - - $output = array(); - $returnVar = null; - exec(sprintf('sudo chown %s %s', - escapeshellarg($TRAVIS_SECOND_USER), - escapeshellarg($cacheFile) - ), $output, $returnVar); - - $this->assertSame(0, $returnVar, 'Cannot change ownership of cache file to test cache renewal'); - - $this->assertTrue($cache->set($cachePublicKey, uniqid('value_2_'), 2), 'Cannot rebuild cache on different file ownership'); - } } 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..2103715b51c 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(); @@ -101,11 +101,6 @@ public function testBindActionParams() public function testNullableInjectedActionParams() { - if (PHP_VERSION_ID < 70100) { - $this->markTestSkipped('Can not be tested on PHP < 7.1'); - return; - } - // Use the PHP71 controller for this test $this->controller = new FakePhp71Controller('fake', new Application([ 'id' => 'app', @@ -122,10 +117,6 @@ public function testNullableInjectedActionParams() public function testInjectionContainerException() { - if (PHP_VERSION_ID < 70100) { - $this->markTestSkipped('Can not be tested on PHP < 7.1'); - return; - } // Use the PHP71 controller for this test $this->controller = new FakePhp71Controller('fake', new Application([ 'id' => 'app', @@ -144,10 +135,6 @@ public function testInjectionContainerException() public function testUnknownInjection() { - if (PHP_VERSION_ID < 70100) { - $this->markTestSkipped('Can not be tested on PHP < 7.1'); - return; - } // Use the PHP71 controller for this test $this->controller = new FakePhp71Controller('fake', new Application([ 'id' => 'app', @@ -165,10 +152,6 @@ public function testUnknownInjection() public function testInjectedActionParams() { - if (PHP_VERSION_ID < 70100) { - $this->markTestSkipped('Can not be tested on PHP < 7.1'); - return; - } // Use the PHP71 controller for this test $this->controller = new FakePhp71Controller('fake', new Application([ 'id' => 'app', @@ -193,10 +176,6 @@ public function testInjectedActionParams() public function testInjectedActionParamsFromModule() { - if (PHP_VERSION_ID < 70100) { - $this->markTestSkipped('Can not be tested on PHP < 7.1'); - return; - } $module = new \yii\base\Module('fake', new Application([ 'id' => 'app', 'basePath' => __DIR__, @@ -270,7 +249,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..e72526fdf03 100644 --- a/tests/framework/console/UnknownCommandExceptionTest.php +++ b/tests/framework/console/UnknownCommandExceptionTest.php @@ -16,7 +16,7 @@ */ class UnknownCommandExceptionTest extends TestCase { - public function setUp() + protected 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..768829ef83f 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() + protected 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() + protected 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]; @@ -392,7 +400,11 @@ public function testCompressExternalAsset() $this->assertEquals($externalAssetConfig['css'], $compressedExternalAssetConfig['css'], 'External bundle css is lost!'); $compressedRegularAssetConfig = $compressedBundleConfig[$regularAssetBundleClassName]; - $this->assertContains($externalAssetBundleClassName, $compressedRegularAssetConfig['depends'], 'Dependency on external bundle is lost!'); + $this->assertContains( + $externalAssetBundleClassName, + $compressedRegularAssetConfig['depends'], + 'Dependency on external bundle is lost!', + ); } /** diff --git a/tests/framework/console/controllers/BaseMessageControllerTest.php b/tests/framework/console/controllers/BaseMessageControllerTest.php index 90d77736209..a7aa869c33a 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() + protected 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() + protected 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..183d173d8e1 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,11 @@ 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'); + $this->expectExceptionMessage('You should specify cache components names'); + $this->_cacheController->actionFlush(); } diff --git a/tests/framework/console/controllers/DbMessageControllerTest.php b/tests/framework/console/controllers/DbMessageControllerTest.php index 1c5707dab94..4ecdbd1124a 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() + protected 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..2613e89ad42 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() + protected 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,10 +206,10 @@ 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); } } diff --git a/tests/framework/console/controllers/MigrateControllerTest.php b/tests/framework/console/controllers/MigrateControllerTest.php index 714b233b82b..8fdbce6e02f 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() + protected function setUp(): void { $this->migrateControllerClass = EchoMigrateController::className(); $this->migrationBaseClass = Migration::className(); @@ -44,7 +44,7 @@ public function setUp() parent::setUp(); } - public function tearDown() + protected function tearDown(): void { $this->tearDownMigrationPath(); parent::tearDown(); @@ -419,8 +419,8 @@ public function testUpdatingLongNamedMigration() $result = $this->runMigrateControllerAction('up'); $this->assertSame(ExitCode::UNSPECIFIED_ERROR, $this->getExitCode()); - $this->assertContains('The migration name', $result); - $this->assertContains('is too long. Its not possible to apply this migration.', $result); + $this->assertStringContainsString('The migration name', $result); + $this->assertStringContainsString('is too long. Its not possible to apply this migration.', $result); } public function testNamedMigrationWithCustomLimit() @@ -435,8 +435,8 @@ public function testNamedMigrationWithCustomLimit() $result = $this->runMigrateControllerAction('up'); $this->assertSame(ExitCode::OK, $this->getExitCode()); - $this->assertContains('1 migration was applied.', $result); - $this->assertContains('Migrated up successfully.', $result); + $this->assertStringContainsString('1 migration was applied.', $result); + $this->assertStringContainsString('Migrated up successfully.', $result); } public function testCreateLongNamedMigration() @@ -478,11 +478,11 @@ public function testRefreshMigration($db) $this->assertSame(ExitCode::OK, $this->getExitCode()); // Drop worked - $this->assertContains('Table hall_of_fame dropped.', $result); - $this->assertContains('View view_hall_of_fame dropped.', $result); + $this->assertStringContainsString('Table hall_of_fame dropped.', $result); + $this->assertStringContainsString('View view_hall_of_fame dropped.', $result); // Migration was restarted - $this->assertContains('No new migrations found. Your system is up-to-date.', $result); + $this->assertStringContainsString('No new migrations found. Your system is up-to-date.', $result); } public function refreshMigrationDataProvider() diff --git a/tests/framework/console/controllers/MigrateControllerTestTrait.php b/tests/framework/console/controllers/MigrateControllerTestTrait.php index bb71b5df1a9..046c512741e 100644 --- a/tests/framework/console/controllers/MigrateControllerTestTrait.php +++ b/tests/framework/console/controllers/MigrateControllerTestTrait.php @@ -228,7 +228,7 @@ public function testCreate() $this->assertSame(ExitCode::OK, $this->getExitCode()); $files = FileHelper::findFiles($this->migrationPath); $this->assertCount(1, $files, 'Unable to create new migration!'); - $this->assertContains($migrationName, basename($files[0]), 'Wrong migration name!'); + $this->assertStringContainsString($migrationName, basename($files[0]), 'Wrong migration name!'); } public function testUp() @@ -294,7 +294,7 @@ public function testDownAll() public function testHistory() { $output = $this->runMigrateControllerAction('history'); - $this->assertContains('No migration', $output); + $this->assertStringContainsString('No migration', $output); $this->createMigration('test_history1'); $this->createMigration('test_history2'); @@ -303,8 +303,8 @@ public function testHistory() $output = $this->runMigrateControllerAction('history'); $this->assertSame(ExitCode::OK, $this->getExitCode()); - $this->assertContains('_test_history1', $output); - $this->assertContains('_test_history2', $output); + $this->assertStringContainsString('_test_history1', $output); + $this->assertStringContainsString('_test_history2', $output); } /** @@ -316,7 +316,7 @@ public function testNew() $output = $this->runMigrateControllerAction('new'); $this->assertSame(ExitCode::OK, $this->getExitCode()); - $this->assertContains('_test_new1', $output); + $this->assertStringContainsString('_test_new1', $output); $this->runMigrateControllerAction('up'); $this->assertSame(ExitCode::OK, $this->getExitCode()); @@ -393,8 +393,8 @@ public function testNamespaceCreate() $this->assertSame(ExitCode::OK, $this->getExitCode()); $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->assertStringContainsString("namespace {$this->migrationNamespace};", $fileContent); + $this->assertMatchesRegularExpression('/class M[0-9]{12}' . ucfirst($migrationName) . '/s', $fileContent); unlink($files[0]); // namespace specify : @@ -406,7 +406,7 @@ public function testNamespaceCreate() $this->assertSame(ExitCode::OK, $this->getExitCode()); $files = FileHelper::findFiles($this->migrationPath); $fileContent = file_get_contents($files[0]); - $this->assertContains("namespace {$this->migrationNamespace};", $fileContent); + $this->assertStringContainsString("namespace {$this->migrationNamespace};", $fileContent); unlink($files[0]); // no namespace: @@ -478,7 +478,7 @@ public function testNamespaceHistory() ]; $output = $this->runMigrateControllerAction('history', [], $controllerConfig); - $this->assertContains('No migration', $output); + $this->assertStringContainsString('No migration', $output); $this->createNamespaceMigration('history1'); $this->createNamespaceMigration('history2'); @@ -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..f2d9c06fdb6 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() + protected function setUp(): void { parent::setUp(); $this->messagePath = Yii::getAlias('@yiiunit/runtime/test_messages'); FileHelper::createDirectory($this->messagePath, 0777); } - public function tearDown() + protected 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..25d165406b8 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() + protected function setUp(): void { parent::setUp(); @@ -27,7 +27,7 @@ public function setUp() FileHelper::createDirectory($this->messagePath, 0777); } - public function tearDown() + protected function tearDown(): void { parent::tearDown(); FileHelper::removeDirectory($this->messagePath); diff --git a/tests/framework/console/controllers/ServeControllerTest.php b/tests/framework/console/controllers/ServeControllerTest.php index 35a5db6d075..def6c808a25 100644 --- a/tests/framework/console/controllers/ServeControllerTest.php +++ b/tests/framework/console/controllers/ServeControllerTest.php @@ -19,7 +19,7 @@ */ class ServeControllerTest extends TestCase { - public function setUp() + protected function setUp(): void { $this->mockApplication(); } @@ -46,7 +46,7 @@ public function testAddressTaken() $result = $serveController->flushStdOutBuffer(); - $this->assertContains('http://localhost:8080 is taken by another process.', $result); + $this->assertStringContainsString('http://localhost:8080 is taken by another process.', $result); } public function testDefaultValues() @@ -70,9 +70,9 @@ public function testDefaultValues() $result = $serveController->flushStdOutBuffer(); - $this->assertContains('Server started on http://localhost:8080', $result); - $this->assertContains("Document root is \"{$docroot}\"", $result); - $this->assertContains('Quit the server with CTRL-C or COMMAND-C.', $result); + $this->assertStringContainsString('Server started on http://localhost:8080', $result); + $this->assertStringContainsString("Document root is \"{$docroot}\"", $result); + $this->assertStringContainsString('Quit the server with CTRL-C or COMMAND-C.', $result); } public function testDoocRootWithNoExistValue() @@ -95,7 +95,7 @@ public function testDoocRootWithNoExistValue() $result = $serveController->flushStdOutBuffer(); - $this->assertContains("Document root \"{$docroot}\" does not exist.", $result); + $this->assertStringContainsString("Document root \"{$docroot}\" does not exist.", $result); } public function testWithRouterNoExistValue() @@ -121,7 +121,7 @@ public function testWithRouterNoExistValue() $result = $serveController->flushStdOutBuffer(); - $this->assertContains("Routing file \"$router\" does not exist.", $result); + $this->assertStringContainsString("Routing file \"$router\" does not exist.", $result); } public function testWithRouterValue() @@ -147,10 +147,10 @@ public function testWithRouterValue() $result = $serveController->flushStdOutBuffer(); - $this->assertContains('Server started on http://localhost:8081', $result); - $this->assertContains("Document root is \"{$docroot}\"", $result); - $this->assertContains("Routing file is \"{$router}\"", $result); - $this->assertContains('Quit the server with CTRL-C or COMMAND-C.', $result); + $this->assertStringContainsString('Server started on http://localhost:8081', $result); + $this->assertStringContainsString("Document root is \"{$docroot}\"", $result); + $this->assertStringContainsString("Routing file is \"{$router}\"", $result); + $this->assertStringContainsString('Quit the server with CTRL-C or COMMAND-C.', $result); } } 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/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..3867d3ccb98 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() + protected function setUp(): void { parent::setUp(); ActiveRecord::$db = $this->getConnection(); diff --git a/tests/framework/db/ActiveRecordTest.php b/tests/framework/db/ActiveRecordTest.php index e50cca3e024..955dabbd934 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); @@ -1973,8 +1943,8 @@ public function illegalValuesForFindByCondition() */ public function testValueEscapingInFindByCondition($modelClassName, $filterWithInjection) { - $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 +2066,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..3086bc19329 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() + protected 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..1817ff65b4e 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; @@ -210,13 +210,13 @@ public function testBindParamValue() $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}}'; @@ -315,11 +315,7 @@ public function testBatchInsert() public function testBatchInsertWithYield() { - if (PHP_VERSION_ID < 50500) { - $this->markTestSkipped('The yield function is only supported with php 5.5 =< version'); - } else { - include __DIR__ . '/testBatchInsertWithYield.php'; - } + include __DIR__ . '/testBatchInsertWithYield.php'; } /** @@ -634,10 +630,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 +1219,10 @@ 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..663f6115926 100644 --- a/tests/framework/db/ConnectionTest.php +++ b/tests/framework/db/ConnectionTest.php @@ -230,12 +230,17 @@ public function testTransactionIsolation() 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'); }); - $profilesCount = $connection->createCommand("SELECT COUNT(*) FROM profile WHERE description = 'test transaction shortcut';")->queryScalar(); + $profilesCount = $connection + ->createCommand("SELECT COUNT(*) FROM profile WHERE description = 'test transaction shortcut';") + ->queryScalar(); $this->assertEquals(0, $profilesCount, 'profile should not be inserted in transaction shortcut'); } @@ -400,7 +405,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 +418,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 dd05f78d9c2..480aabbfdd0 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."); @@ -815,12 +815,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..76c68cc8127 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; @@ -69,9 +69,10 @@ public function testBindParamValue() $sql = 'SELECT int_col, char_col, float_col, CONVERT([nvarchar], blob_col) AS blob_col, numeric_col FROM type'; $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']); @@ -113,7 +114,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/mssql/type/VarbinaryTest.php b/tests/framework/db/mssql/type/VarbinaryTest.php index b72a2b4c469..0840996f703 100644 --- a/tests/framework/db/mssql/type/VarbinaryTest.php +++ b/tests/framework/db/mssql/type/VarbinaryTest.php @@ -5,7 +5,7 @@ * @license https://www.yiiframework.com/license/ */ -namespace yiiunit\framework\db\mssql\Type; +namespace yiiunit\framework\db\mssql\type; use yii\db\Query; use yiiunit\framework\db\DatabaseTestCase; diff --git a/tests/framework/db/mysql/BaseActiveRecordTest.php b/tests/framework/db/mysql/BaseActiveRecordTest.php index 394922e87f7..8acdc27ac8a 100644 --- a/tests/framework/db/mysql/BaseActiveRecordTest.php +++ b/tests/framework/db/mysql/BaseActiveRecordTest.php @@ -4,6 +4,10 @@ use yiiunit\data\ar\Storage; +/** + * @group db + * @group mysql + */ class BaseActiveRecordTest extends \yiiunit\framework\db\BaseActiveRecordTest { public $driverName = 'mysql'; diff --git a/tests/framework/db/mysql/QueryTest.php b/tests/framework/db/mysql/QueryTest.php index 9f647308c6f..8d4847d6679 100644 --- a/tests/framework/db/mysql/QueryTest.php +++ b/tests/framework/db/mysql/QueryTest.php @@ -45,7 +45,6 @@ public function testLimitOffsetWithExpression() $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..c7a11d722a8 100644 --- a/tests/framework/db/oci/ActiveRecordTest.php +++ b/tests/framework/db/oci/ActiveRecordTest.php @@ -26,7 +26,6 @@ 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; @@ -48,7 +47,7 @@ public function testCastValues() $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..0b1a5f0d03b 100644 --- a/tests/framework/db/oci/ConnectionTest.php +++ b/tests/framework/db/oci/ConnectionTest.php @@ -78,6 +78,8 @@ public function testQuoteFullColumnName() public function testTransactionIsolation() { + $this->expectNotToPerformAssertions(); + $connection = $this->getConnection(true); $transaction = $connection->beginTransaction(Transaction::READ_COMMITTED); diff --git a/tests/framework/db/oci/QueryBuilderTest.php b/tests/framework/db/oci/QueryBuilderTest.php index 5bf3b831636..d7ed58cd3ba 100644 --- a/tests/framework/db/oci/QueryBuilderTest.php +++ b/tests/framework/db/oci/QueryBuilderTest.php @@ -305,7 +305,7 @@ public function testUpsert($table, $insertColumns, $updateColumns, $expectedSQL, if (is_string($expectedSQL)) { $this->assertEqualsWithoutLE($expectedSQL, $actualSQL); } else { - $this->assertContains($actualSQL, $expectedSQL); + $this->assertStringContainsString($actualSQL, $expectedSQL); } if (ArrayHelper::isAssociative($expectedParams)) { $this->assertSame($expectedParams, $actualParams); 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/BaseActiveRecordTest.php b/tests/framework/db/pgsql/BaseActiveRecordTest.php index a4993685249..db6f1264815 100644 --- a/tests/framework/db/pgsql/BaseActiveRecordTest.php +++ b/tests/framework/db/pgsql/BaseActiveRecordTest.php @@ -5,6 +5,10 @@ use yii\db\JsonExpression; use yiiunit\data\ar\ActiveRecord; +/** + * @group db + * @group pgsql + */ class BaseActiveRecordTest extends \yiiunit\framework\db\BaseActiveRecordTest { public $driverName = 'pgsql'; diff --git a/tests/framework/db/pgsql/ConnectionTest.php b/tests/framework/db/pgsql/ConnectionTest.php index 2baa79e3b8d..c3a6d0c68eb 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() diff --git a/tests/framework/di/ContainerTest.php b/tests/framework/di/ContainerTest.php index 4df6140a819..89df53651e0 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,36 +479,13 @@ 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 */ public function testDelayedInitializationOfSubArray() { + $this->expectNotToPerformAssertions(); + $definitions = [ 'test' => [ 'class' => Corge::className(), @@ -610,11 +586,6 @@ public function testNotInstantiableException($class) public function testNullTypeConstructorParameters() { - if (PHP_VERSION_ID < 70100) { - $this->markTestSkipped('Can not be tested on PHP < 7.1'); - return; - } - $zeta = (new Container())->get(Zeta::className()); $this->assertInstanceOf(Beta::className(), $zeta->beta); $this->assertInstanceOf(Beta::className(), $zeta->betaNull); diff --git a/tests/framework/di/InstanceTest.php b/tests/framework/di/InstanceTest.php index fe61a6bdf95..78044062ed3 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(); @@ -59,7 +59,7 @@ public function testEnsure_NonExistingComponentException() { $container = new Container(); $this->expectException('yii\base\InvalidConfigException'); - $this->expectExceptionMessageRegExp('/^Failed to instantiate component or class/i'); + $this->expectExceptionMessageMatches('/^Failed to instantiate component or class/i'); Instance::ensure('cache', 'yii\cache\Cache', $container); } @@ -70,7 +70,7 @@ public function testEnsure_NonExistingClassException() { $container = new Container(); $this->expectException('yii\base\InvalidConfigException'); - $this->expectExceptionMessageRegExp('/^Failed to instantiate component or class/i'); + $this->expectExceptionMessageMatches('/^Failed to instantiate component or class/i'); Instance::ensure('yii\cache\DoesNotExist', 'yii\cache\Cache', $container); } @@ -171,7 +171,10 @@ 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..e98736614d1 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); @@ -84,7 +84,10 @@ public function testBeforeActionUserNotInstanceOfRateLimitInterface() $result = $rateLimiter->beforeAction('test'); - $this->assertContains('Rate limit skipped: "user" does not implement RateLimitInterface.', Yii::getLogger()->messages); + $this->assertContains( + 'Rate limit skipped: "user" does not implement RateLimitInterface.', + Yii::getLogger()->messages + ); $this->assertTrue($result); } @@ -164,6 +167,9 @@ public function testUserWithClosureFunction() // testing the evaluation of user closure, which in this case returns not the expect object and therefore // the log message "does not implement RateLimitInterface" is expected. $this->assertInstanceOf(User::className(), $rateLimiter->user); - $this->assertContains('Rate limit skipped: "user" does not implement RateLimitInterface.', Yii::getLogger()->messages); + $this->assertContains( + 'Rate limit skipped: "user" does not implement RateLimitInterface.', + Yii::getLogger()->messages + ); } } 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..b652ff2dc60 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..e151e257d42 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([ @@ -155,8 +155,9 @@ public function testFooter() { public function testHeaderLabels() { + $this->expectNotToPerformAssertions(); + // Ensure GridView does not call Model::generateAttributeLabel() to generate labels unless the labels are explicitly used. - $this->mockApplication([ 'components' => [ 'db' => [ @@ -198,7 +199,6 @@ public function testHeaderLabels() 'attributes' => ['attr1', 'attr2'], ]); $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..bdd15ccef67 100644 --- a/tests/framework/grid/RadiobuttonColumnTest.php +++ b/tests/framework/grid/RadiobuttonColumnTest.php @@ -22,12 +22,11 @@ */ class RadiobuttonColumnTest extends TestCase { - /** - * @expectedException \yii\base\InvalidConfigException - * @expectedExceptionMessage The "name" property must be set. - */ public function testException() { + $this->expectException(\yii\base\InvalidConfigException::class); + $this->expectExceptionMessage('The "name" property must be set.'); + new RadioButtonColumn([ 'name' => null, ]); @@ -67,14 +66,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..593d4007be5 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(); @@ -136,14 +136,12 @@ public function testRemove() } /** + * @requires PHP < 8.1 + * * @return void */ public function testRemoveWithFloat() { - if (version_compare(PHP_VERSION, '8.1.0', '>=')) { - $this->markTestSkipped('Using floats as array key is deprecated.'); - } - $array = ['name' => 'b', 'age' => 3, 1.1 => null]; $name = ArrayHelper::remove($array, 'name'); @@ -527,14 +525,12 @@ public function testMergeEmpty() } /** + * @requires PHP < 8.1 + * * @see https://github.com/yiisoft/yii2/pull/11549 */ public function testGetValueWithFloatKeys() { - if (version_compare(PHP_VERSION, '8.1.0', '>=')) { - $this->markTestSkipped('Using floats as array key is deprecated.'); - } - $array = []; $array[1.1] = 'some value'; $array[2.1] = null; @@ -754,12 +750,11 @@ public function testKeyExists() $this->assertFalse(ArrayHelper::keyExists('c', $array, false)); } + /** + * @requires PHP < 8.1 + */ public function testKeyExistsWithFloat() { - if (version_compare(PHP_VERSION, '8.1.0', '>=')) { - $this->markTestSkipped('Using floats as array key is deprecated.'); - } - $array = [ 1 => 3, 2.2 => 4, // Note: Floats are cast to ints, which means that the fractional part will be truncated. @@ -876,13 +871,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..d13e57e8218 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() + protected 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() + protected 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!'); @@ -359,6 +359,8 @@ public function testCopyDirToAnotherWithSameName() */ public function testCopyDirWithSameName() { + $this->expectNotToPerformAssertions(); + $this->createFileStructure([ 'data' => [], '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 eef2f84bf7f..6bb38ccc653 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([ @@ -1958,6 +1958,7 @@ public function testAttributeNameValidation($name, $expected) public function testAttributeNameException($name) { $this->expectException('yii\base\InvalidArgumentException'); + Html::getAttributeName($name); } @@ -1994,12 +1995,11 @@ public function testActiveFileInput() $this->assertEqualsWithoutLE($expected, $actual); } - /** - * @expectedException \yii\base\InvalidArgumentException - * @expectedExceptionMessage Attribute name must contain word characters only. - */ public function testGetAttributeValueInvalidArgumentException() { + $this->expectException(\yii\base\InvalidArgumentException::class); + $this->expectExceptionMessage('Attribute name must contain word characters only.'); + $model = new HtmlTestModel(); Html::getAttributeValue($model, '-'); } @@ -2029,24 +2029,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'); } @@ -2152,7 +2152,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() @@ -2161,7 +2161,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() @@ -2170,7 +2170,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() @@ -2179,11 +2179,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', @@ -2223,6 +2225,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..ae90bb6a056 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..0802bf948e6 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..49178481674 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 94efbf67137..5f222ec4e7a 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..853623963da 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() + protected 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() + protected 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..a60046b6cd8 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 30480bb2f73..7548092b788 100644 --- a/tests/framework/log/TargetTest.php +++ b/tests/framework/log/TargetTest.php @@ -123,23 +123,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..e0c388027b3 100644 --- a/tests/framework/mail/BaseMailerTest.php +++ b/tests/framework/mail/BaseMailerTest.php @@ -19,7 +19,7 @@ */ class BaseMailerTest extends TestCase { - public function setUp() + protected function setUp(): void { $this->mockApplication([ 'components' => [ @@ -32,7 +32,7 @@ public function setUp() } } - public function tearDown() + protected 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!'); } diff --git a/tests/framework/mail/BaseMessageTest.php b/tests/framework/mail/BaseMessageTest.php index 9741f5d66d7..32bf2dcd31b 100644 --- a/tests/framework/mail/BaseMessageTest.php +++ b/tests/framework/mail/BaseMessageTest.php @@ -17,7 +17,7 @@ */ class BaseMessageTest extends TestCase { - public function setUp() + protected function setUp(): void { $this->mockApplication([ 'components' => [ 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..f1063ebe0f4 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/ManagerTestCase.php b/tests/framework/rbac/ManagerTestCase.php index e68378c541e..8c5ead7b544 100644 --- a/tests/framework/rbac/ManagerTestCase.php +++ b/tests/framework/rbac/ManagerTestCase.php @@ -373,8 +373,16 @@ public function testAssignMultipleRoles() $roleNames[] = $role->name; } - $this->assertContains('reader', $roleNames, 'Roles should contain reader. Currently it has: ' . implode(', ', $roleNames)); - $this->assertContains('author', $roleNames, 'Roles should contain author. Currently it has: ' . implode(', ', $roleNames)); + $this->assertContains( + 'reader', + $roleNames, + 'Roles should contain reader. Currently it has: ' . implode(', ', $roleNames) + ); + $this->assertContains( + 'author', + $roleNames, + 'Roles should contain author. Currently it has: ' . implode(', ', $roleNames) + ); } public function testAssignmentsToIntegerId() diff --git a/tests/framework/rbac/PhpManagerTest.php b/tests/framework/rbac/PhpManagerTest.php index 38107d26a84..e27b74420f5 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,16 @@ 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\InvalidParamException'); + $this->auth->update($name, $permission); } @@ -154,11 +155,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 217d7fbf7a9..91b627b8f8e 100644 --- a/tests/framework/rest/SerializerTest.php +++ b/tests/framework/rest/SerializerTest.php @@ -18,7 +18,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..f2c5b4b6a89 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..c659e6958cf 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() + protected function setUp(): void { parent::setUp(); $db = $this->getConnection(); @@ -31,7 +31,7 @@ public function setUp() ActiveRecord::$db = $db; } - public function tearDown() + protected 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..669dbc6cbce 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..05475f8475f 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')); } /** @@ -212,11 +212,6 @@ public function testValidateArrayAccess() */ public function testTypedProperties() { - if (PHP_VERSION_ID < 70400) { - $this->markTestSkipped('Can not be tested on PHP < 7.4'); - return; - } - $model = new ValidatorTestTypedPropModel(); $validator = new EachValidator(['rule' => ['boolean']]); 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..c25ed2c8312 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); } } @@ -654,7 +654,9 @@ public function testValidateAttributeErrNoTmpDir() * @dataProvider mimeTypeCaseInsensitive */ public function testValidateMimeTypeCaseInsensitive($mask, $fileMimeType, $expected) { - $validator = $this->getMock('\yii\validators\FileValidator', ['getMimeTypeByFile']); + $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..f24719d40f1 100644 --- a/tests/framework/validators/StringValidatorTest.php +++ b/tests/framework/validators/StringValidatorTest.php @@ -16,7 +16,7 @@ */ class StringValidatorTest extends TestCase { - public function setUp() + protected 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() @@ -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,34 +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 + ); } @@ -347,7 +362,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 +370,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 +378,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 +386,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 +416,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 +458,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 +479,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..25f77b73bfa 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() @@ -672,14 +675,14 @@ public function testInputOptionsTransferToWidget() '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(), [ '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']; @@ -687,7 +690,7 @@ public function testInputOptionsTransferToWidget() '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..4cca48b68f6 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(); @@ -110,6 +110,8 @@ public function testOutputBuffering() public function testRegisterClientScript() { + $this->expectNotToPerformAssertions(); + $this->mockWebApplication(); $_SERVER['REQUEST_URI'] = 'http://example.com/'; 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..88200cfc207 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,11 +150,11 @@ public function testLinkWrapOptions() ], ]); - $this->assertContains( + $this->assertStringContainsString( '
    3
    ', $output ); - $this->assertContains( + $this->assertStringContainsString( '
    2
    ', $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 3de5f5efd83..938bec4b356 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->mockWebApplication([ 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();