You are here

function ArrayEntryTokenSpec::it_does_not_score_traversable_object_if_key_and_value_tokens_do_not_score_same_entry in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/ArrayEntryTokenSpec.php \spec\Prophecy\Argument\Token\ArrayEntryTokenSpec::it_does_not_score_traversable_object_if_key_and_value_tokens_do_not_score_same_entry()

Parameters

\Prophecy\Argument\Token\TokenInterface $key:

\Prophecy\Argument\Token\TokenInterface $value:

\Iterator $object:

File

vendor/phpspec/prophecy/spec/Prophecy/Argument/Token/ArrayEntryTokenSpec.php, line 177

Class

ArrayEntryTokenSpec

Namespace

spec\Prophecy\Argument\Token

Code

function it_does_not_score_traversable_object_if_key_and_value_tokens_do_not_score_same_entry($key, $value, $object) {
  $object
    ->current()
    ->willReturn('foo');
  $object
    ->current()
    ->will(function () use ($object) {
    $object
      ->valid()
      ->willReturn(false);
    return 'bar';
  });
  $object
    ->key()
    ->willReturn(1);
  $object
    ->key()
    ->willReturn(2);
  $object
    ->rewind()
    ->willReturn(null);
  $object
    ->next()
    ->willReturn(null);
  $object
    ->valid()
    ->willReturn(true);
  $key
    ->scoreArgument(1)
    ->willReturn(true);
  $key
    ->scoreArgument(2)
    ->willReturn(false);
  $value
    ->scoreArgument('foo')
    ->willReturn(false);
  $value
    ->scoreArgument('bar')
    ->willReturn(true);
  $this
    ->scoreArgument($object)
    ->shouldBe(false);
}