You are here

function DoublerSpec::its_double_mirrors_alterates_and_instantiates_provided_class in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpspec/prophecy/spec/Prophecy/Doubler/DoublerSpec.php \spec\Prophecy\Doubler\DoublerSpec::its_double_mirrors_alterates_and_instantiates_provided_class()

Parameters

\Prophecy\Doubler\ClassPatch\ClassPatchInterface $alt1:

\Prophecy\Doubler\ClassPatch\ClassPatchInterface $alt2:

\ReflectionClass $class:

\ReflectionClass $interface1:

\ReflectionClass $interface2:

\Prophecy\Doubler\Generator\Node\ClassNode $node:

File

vendor/phpspec/prophecy/spec/Prophecy/Doubler/DoublerSpec.php, line 63

Class

DoublerSpec

Namespace

spec\Prophecy\Doubler

Code

function its_double_mirrors_alterates_and_instantiates_provided_class($mirror, $creator, $namer, $alt1, $alt2, $class, $interface1, $interface2, $node) {
  $mirror
    ->reflect($class, array(
    $interface1,
    $interface2,
  ))
    ->willReturn($node);
  $alt1
    ->supports($node)
    ->willReturn(true);
  $alt2
    ->supports($node)
    ->willReturn(false);
  $alt1
    ->getPriority()
    ->willReturn(1);
  $alt2
    ->getPriority()
    ->willReturn(2);
  $namer
    ->name($class, array(
    $interface1,
    $interface2,
  ))
    ->willReturn('SplStack');
  $class
    ->getName()
    ->willReturn('stdClass');
  $interface1
    ->getName()
    ->willReturn('ArrayAccess');
  $interface2
    ->getName()
    ->willReturn('Iterator');
  $alt1
    ->apply($node)
    ->shouldBeCalled();
  $alt2
    ->apply($node)
    ->shouldNotBeCalled();
  $creator
    ->create('SplStack', $node)
    ->shouldBeCalled();
  $this
    ->registerClassPatch($alt1);
  $this
    ->registerClassPatch($alt2);
  $this
    ->double($class, array(
    $interface1,
    $interface2,
  ))
    ->shouldReturnAnInstanceOf('SplStack');
}