Skip to content

Instantly share code, notes, and snippets.

@mvriel
Created September 4, 2014 07:30
Show Gist options
  • Save mvriel/c811f7996ed28b478bf9 to your computer and use it in GitHub Desktop.
Save mvriel/c811f7996ed28b478bf9 to your computer and use it in GitHub Desktop.
Mocking two invocations of one call with different arguments
<?php
$resolverMock = m::mock('Symfony\Component\OptionsResolver\OptionsResolver');
$resolverMock->shouldReceive('setNormalizers');
$resolverMock->shouldReceive('setAllowedTypes');
$resolverMock->shouldReceive('setDefaults')->atMost()->once()->withAnyArgs();
$resolverMock->shouldReceive('setDefaults')->atLeast()->once()->with(
array(
'label' => 'MyLabel',
'choices' => array(
'1' => 'Option1',
'2' => 'Option2',
'3' => 'Option3',
)
)
);
$this->fixture->setDefaultOptions($resolverMock);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment