phpspec/prophecy — pull request #50 by peterjmit (2013-09-06 19:42:23+00:00)
Title: Added StringContainsToken

We have `ArrayEntryToken` and we have `Argument::containing`. Currently `Argument::containing` is specific to arrays but it may be useful for strings too?

I have had a couple of use-cases (logging) spring up and have currently implemented with:

```php
/**
* Spec/example
*/
function it_logs_an_error($logger)
{
$argumentToken = Argument::that(function ($arg) {
return strpos($arg, 'test') !== false;
});

$logger->error($argumentToken)->shouldBeCalled();

// ...
}

/**
* Implementation
*/
class UsesLogger
{
public function methodUnderTest()
{
$this->logger->error('This string contains the word test');
}
// ...
```

This PR would make the following possible:

```php
use Prophecy\Argument;
use Prophecy\Argument\Token\StringContainsToken;

$logger->error()->shouldBeCalled(Argument::containingString('test'));
// or
$logger->error()->shouldBeCalled(StringContainsToken('test'));
```