Download the PHP package marcin-orlowski/phpunit-extra-asserts without Composer

On this page you can find all versions of the php package marcin-orlowski/phpunit-extra-asserts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phpunit-extra-asserts

PhpUnit Extras Asserts

Latest Stable Version License

Collection of additional asserts to be used with PHP Unit testing framework. Helpers are split into dedicated namespaces:

Installation

Usage

As ExtraAsserts come as set of static methods so you just need to add related use to your test class and all the methods should be simply available via static reference ExtraAsserts::.... For example:

Available asserts

Assert Description Added
assertArrayElement(string $key, array $array, string $expected_value) Asserts given array has specified key and it's value is according to expectations. v1.0.0
assertArrayEquals(array $array_a, array $array_b) Asserts two arrays are equivalent. v1.0.0
assertArrayHasKeys(array $required_keys, array $array) Asserts array has ALL the required keys. v1.0.0
assertArraysHaveDifferences(int $diff_count, array $array_a, array $array_b) Asserts two arrays differ by exactly given number of elements (default is 0). v1.0.0
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
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
[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

Method Description
printArray(array $array, int $indent) Prints content of given array in compacted form.

Generator methods

Method Description
getRandomString(?string $prefix = null, int $length = 24, string $separator = '_') Returns string of total length equal to specified limit (incl. optional prefix or separator strings)
getRandomStringOrNull(?string $prefix = null, int $length = 24, string $separator = '_', float $trueValueProbability = 0.5) Returns either random string or NULL. Probability (float value in range 0-1) specifies the chance of drawing the string value. The higher the value of this argument, the higher the chance for string being returned.
getRandomFloat(float $min, float $max, int $fractionalDigits = 0) Draws random float from given range. If given max is lower than min, these two will be swapped. If number of fractional digits is non-zero, value will be rounded to given number of fractional digits. Value 0 means not rounding.
getRandomInt(int $min = 0, int $max = 100) Draws random int from given range. If given max is lower than min, these two will be swapped.
getRandomBool(float $trueValueProbability = 0.5) Draws random boolean value. Float value (in 0-1 range) defining the chances of drawing the value of TRUE. The higher the of this argument, the higher the chances to draw TRUE.
getRandomLatitude(float $min, float $max, int $round=0) Draws random latitude from given range (default is max allowed range). If given max is lower than min, these two will be swapped.
getRandomLongitude(float $min, float $max, int $round=0) Draws random longitude from given range (default is max allowed range). If given max is lower than min, these two will be swapped.

License


All versions of phpunit-extra-asserts with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
marcin-orlowski/type-asserts Version ^2.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package marcin-orlowski/phpunit-extra-asserts contains the following files

Loading the files please wait ....