Skip to content
Merged
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: 11 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ This table shows all assertions (class `Assert` means `Tester\Assert`):
- `Assert::match($pattern, $value)` - Compares result using regular expression or mask.
- `Assert::matchFile($file, $value)` - Compares result using regular expression or mask sorted in file.
- `Assert::count($count, $value)` - Reports an error if number of items in $value is not $count.
- `Assert::with($objectOrClass, $closure)` - Executes function that can access private and protected members of given object via $this.

Testing exceptions:

Expand All @@ -123,14 +124,23 @@ Assert::exception(function () {

Testing PHP errors, warnings or notices:


```php
Assert::error(function () {
$h = new Greeting;
echo $h->abc;
}, E_NOTICE, 'Undefined property: Greeting::$abc');
```

Testing private access methods:

```php
$h = new Greeting;
Assert::with($h, function () {
// normalize() is internal private method.
Assert::same('Hello David', $this->normalize('Hello david')); // $this is Greeting
});
```

Tips and features
-----------------

Expand Down