diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 4a70dea..ae4ec93 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -35,7 +35,7 @@ jobs: steps: - name: "Checkout repository..." - uses: actions/checkout@v2 + uses: actions/checkout@v4 # https://github.com/marketplace/actions/composer-php-actions - name: "Installing dependencies..." @@ -45,9 +45,9 @@ jobs: php_version: "${{ matrix.php }}" dev: yes - # https://github.com/marketplace/actions/phpunit-php-actions - name: "Running PHPUnit..." - uses: php-actions/phpunit@v3 - with: - bootstrap: "vendor/autoload.php" - configuration: "tests/phpunit.xml" + shell: bash + run: | + curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + /usr/local/bin/composer install --dev --no-interaction + /usr/local/bin/composer test diff --git a/.pre-commit-config.yaml.dist b/.pre-commit-config.yaml.dist index 1108680..35bd241 100644 --- a/.pre-commit-config.yaml.dist +++ b/.pre-commit-config.yaml.dist @@ -59,12 +59,6 @@ repos: # Non-executable shell script filename ends in .sh - id: script-must-have-extension - - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.1.12 - hooks: - # Forbid files containing CRLF end-lines to be committed - - id: forbid-crlf - - repo: https://github.com/MarcinOrlowski/pre-commit-hooks rev: 1.3.0 hooks: diff --git a/CHANGES.md b/CHANGES.md index f08fede..1dc1dab 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,11 @@ ## CHANGELOG ## +* 5.3.0 (2024-05-23) + * PHPUnit is now runtime dependency, not --dev. + * Deprecated `assertIsArray()`, `assertIsBool()`, `assertIsFloat()`, `assertIsInteger()`, + `assertIsString()` in favor of PHPUnit's built-in equivalents. + * 5.2.0 (2023-03-04) * Most asserts now accepts optional message string as PHPUnit's. * Added `assertArrayHasKeyValue()` diff --git a/README.md b/README.md index 43b6960..37b5edc 100644 --- a/README.md +++ b/README.md @@ -52,14 +52,16 @@ class MyBaseTestClass extends ... { | assertRFC3339(string $stamp) | Asserts provided string is valid RFC3339 timestamp string. | v1.0.0 | | assertRFC3339OrNull(string $stamp) | Asserts $stamp string is valid RFC3339 timestamp string or @null. | v1.0.0 | | massAssertEquals(array $array_a, array $array_b, array $ignored_keys) | Assert if keys from response have the same values as in original array. Keys listed in $skip_keys are ignored. | v1.0.0 | -| assertIsArray(mixed $value, ?string $var_name = null) | Asserts given $value (which the value of variable named $var_name) is an array. | v3.0.0 | -| assertIsBool(mixed $value, ?string $var_name = null) | Asserts given $value (which the value of variable named $var_name) is a boolean. | v3.0.0 | -| assertIsFloat(mixed $value, ?string $var_name = null) | Asserts given $value (which the value of variable named $var_name) is an float. | v3.0.0 | -| assertIsInteger(mixed $value, ?string $var_name = null) | Asserts given $value (which the value of variable named $var_name) is an integer. | v3.0.0 | -| assertIsInteger(mixed $value, ?string $var_name = null) | Asserts given $value (which the value of variable named $var_name) is an integer. | v3.0.0 | -| assertIsObject(mixed $value, ?string $var_name = null) | Asserts given $value (which the value of variable named $var_name) is an object (of any class). | v3.0.0 | | assertIsObjectOrExistingClass(string OR object $cls_or_obj, ?string $var_nam = null) | Asserts given $value (which the value of variable named $var_name) is an object or name name of existing class. | v3.0.0 | -| assertIsString(mixed $value, ?string $var_name = null) | Asserts given $value (which the value of variable named $var_name) is an string. | v3.0.0 | +| [DEPRECATED] assertIsArray(mixed $value, ?string $var_name = null) | Asserts given $value (which the value of variable named $var_name) is an array. | v3.0.0 | +| [DEPRECATED] assertIsBool(mixed $value, ?string $var_name = null) | Asserts given $value (which the value of variable named $var_name) is a boolean. | v3.0.0 | +| [DEPRECATED] assertIsFloat(mixed $value, ?string $var_name = null) | Asserts given $value (which the value of variable named $var_name) is an float. | v3.0.0 | +| [DEPRECATED] assertIsInteger(mixed $value, ?string $var_name = null) | Asserts given $value (which the value of variable named $var_name) is an integer. | v3.0.0 | +| [DEPRECATED] assertIsInteger(mixed $value, ?string $var_name = null) | Asserts given $value (which the value of variable named $var_name) is an integer. | v3.0.0 | +| [DEPRECATED] assertIsObject(mixed $value, ?string $var_name = null) | Asserts given $value (which the value of variable named $var_name) is an object (of any class). | v3.0.0 | +| [DEPRECATED] assertIsString(mixed $value, ?string $var_name = null) | Asserts given $value (which the value of variable named $var_name) is an string. | v3.0.0 | + +**NOTE:** Deprecated methods will be removed in v5.4.0 ## Helper methods ## diff --git a/composer.json b/composer.json index 35b0507..c11b981 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "marcin-orlowski/phpunit-extra-asserts", "description": "Extra asserts and helpers to make your unit testing easier.", "homepage": "https://github.com/MarcinOrlowski/phpunit-extra-asserts", - "version": "5.2.0", + "version": "5.3.0", "keywords": [ "helper", "tests", @@ -28,12 +28,26 @@ } }, "require": { - "php": "^8.0||^8.1", + "php": "^8.0", "marcin-orlowski/type-asserts": "^2.0.0" }, "require-dev": { "phpunit/phpunit": "^9.5.26", "phpunit/php-code-coverage": "^9.0", "phpstan/phpstan": "^1.9.1" + }, + "scripts": { + "test": [ + "Composer\\Config::disableProcessTimeout", + "vendor/bin/phpunit -c tests/phpunit.xml" + ], + "lint": [ + "Composer\\Config::disableProcessTimeout", + "vendor/bin/phpstan analyse --no-progress --no-interaction -c phpstan.neon.dist" + ], + "mdlint": [ + "Composer\\Config::disableProcessTimeout", + "markdownlint -c .markdownlint.yaml.dist --ignore vendor --ignore LICENSE.md docs **/*.md README.md" + ] } } diff --git a/src/ExtraAsserts.php b/src/ExtraAsserts.php index c52bc2a..a686bab 100644 --- a/src/ExtraAsserts.php +++ b/src/ExtraAsserts.php @@ -254,6 +254,8 @@ public static function assertIsType(mixed $value, string|array $type, ?string $v * build error message only). * * @throws Ex\InvalidTypeExceptionContract + * + * @deprecated use PHPUnit's Assert::assertIsArray() */ public static function assertIsArray(mixed $value, ?string $varName = null): void { @@ -267,6 +269,7 @@ public static function assertIsArray(mixed $value, ?string $varName = null): voi * @param string|null $varName Optional name of the variable the content is being asserted for (used to * build error message only). * + * @deprecated use PHPUnit's Assert::assertIsBool() */ public static function assertIsBool(mixed $value, ?string $varName = null): void { @@ -281,6 +284,8 @@ public static function assertIsBool(mixed $value, ?string $varName = null): void * build error message only). * * @throws Ex\InvalidTypeExceptionContract + * + * @deprecated use PHPUnit's Assert::assertIsFloat() */ public static function assertIsFloat(mixed $value, ?string $varName = null): void { @@ -296,6 +301,8 @@ public static function assertIsFloat(mixed $value, ?string $varName = null): voi * * @throws Ex\InvalidTypeExceptionContract * @throws Ex\NotIntegerException + * + * @deprecated use PHPUnit's Assert::assertIsInt() */ public static function assertIsInteger(mixed $value, ?string $varName = null): void { @@ -310,6 +317,8 @@ public static function assertIsInteger(mixed $value, ?string $varName = null): v * build error message only). * * @throws Ex\InvalidTypeExceptionContract + * + * @deprecated use PHPUnit's Assert::assertIsObject() */ public static function assertIsObject(mixed $value, ?string $varName = null): void { @@ -342,6 +351,8 @@ public static function assertIsObjectOrExistingClass(string|object $classOrObjec * build error message only). * * @throws Ex\InvalidTypeExceptionContract + * + * @deprecated use PHPUnit's Assert::assertIsString() */ public static function assertIsString(mixed $value, ?string $varName = null): void {