mehr-als-nix / assumptions
Assumptions can be used to skip tests when common preconditions, like the PHP Version or installed extensions, are not met.
Installs: 8 892
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 2
Open Issues: 0
Requires
- php: >=7.1
- hamcrest/hamcrest-php: ~2
- phpunit/phpunit: ^7.0
- roave/security-advisories: dev-master
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-29 05:04:28 UTC
README
Introduction
Assumptions can be used to skip tests when common preconditions, like the PHP Version or installed extensions, are not met.
The default PHPUnit runner treats tests with failing assumptions as skipped. Custom runners may behave differently.
We have included several assumptions like assumeTrue
, assumeExtensionLoaded
,... by default. All of those functions are subsumed in assumeThat, with the appropriate Hamcrest
matcher.
A failing assumption in a @before
or @beforeClass
method will have the same effect as a failing assumption in each @test
method of the class.
The concept behind Assumptions for PHPUnit is based on the adequate junit feature, which is documented on their wiki - Assumptions with assume
Note
There is a similar feature in PHPUnit called @requires!
If you are familiar in using @requires
annotation to dedicate that a given requirement would be given and you are happy about, then you just do not need the use of Assumption for PHPUnit.
But if you want to have
- code completion
- better readability
- finer control
- more requirement abilities
then you should give Assumption for PHPUnit a try.
Requirements
- PHP >= 7.1
if you are looking for a version which supports PHP < 7.0.7 just use the v2.0.0