Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 5.3.0 #14

Merged
merged 14 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand All @@ -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
6 changes: 0 additions & 6 deletions .pre-commit-config.yaml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`
Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##

Expand Down
18 changes: 16 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
]
}
}
11 changes: 11 additions & 0 deletions src/ExtraAsserts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down
Loading