-
Couldn't load subscription status.
- Fork 8
Assertions
Each test method is passed an instance of HackPack\HackUnit\Assert which provides many ways to make assertions in a type safe way. Think of this object as an assertion builder.
After building an assertion object, you make an actual assertion by calling a terminating method, such as is($expected). These methods are marked as such in the individual assertion classes below.
As part of the process of checking an assertion, the Test Runner will emit an event to inform any listeners that the assertion passed or failed.
The Assert object has the following methods to begin your assertions:
bool(bool $actual) : HackPack\HackUnit\Assertion\BoolAssertionint($actual) : HackPack\HackUnit\Assertion\NumericAssertion<int>float($actual) : HackPack\HackUnit\Assertion\NumericAssertion<float>string($actual) : HackPack\HackUnit\Assertion\StringAssertionmixed($actual) : HackPack\HackUnit\Assertion\MixedAssertionwhenCalled($lambda) : HackPack\HackUnit\Assertion\CallableAssertion
There is only one assertion you can make about a bool: its value.
-
is(bool $expected) : void- Terminating function - Asserts that
$actual === $expected