Skip to content

Commit

Permalink
Add ArrayKeyValueMatcher entry in the 'Matchers' chapter of the cookb…
Browse files Browse the repository at this point in the history
…ook documentation
  • Loading branch information
franciscosantamaria committed Mar 30, 2015
1 parent abd6e9b commit 4911db5
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/cookbook/matchers.rst
Expand Up @@ -289,6 +289,28 @@ identity (``===``).
}
ArrayKeyWithValue Matcher
--------------------

This matcher lets you assert a specific value for a specific key on a method that returns an array or an implementor of ArrayAccess.

.. code-block:: php
<?php
namespace spec;
use PhpSpec\ObjectBehavior;
class MovieSpec extends ObjectBehavior
{
function it_should_have_jane_smith_in_the_cast_with_a_lead_role()
{
$this->getCast()->shouldHaveKeyWithValue('leadRole', 'John Smith');
}
}
ArrayKey Matcher
----------------

Expand Down

0 comments on commit 4911db5

Please sign in to comment.