Skip to content

Commit

Permalink
Add match_pattern() to README
Browse files Browse the repository at this point in the history
  • Loading branch information
sirbrillig committed Sep 25, 2017
1 parent f78c028 commit bc19e32
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,15 @@ function test_calculation() {
}
```

If you need to match just part of a string, you can use `\Spies\match_pattern()`.

```php
$spy = \Spies\get_spy_for( 'run_experiment' );
run_experiment( 'slartibartfast' );
\Spies\expect_spy( $spy )->to_have_been_called->with( \Spies\match_pattern( '/bart/' ) );
\Spies\finish_spying();
```

You can also use `\Spies\match_array()` to match elements of an array while ignoring other parts:

```php
Expand Down

0 comments on commit bc19e32

Please sign in to comment.