/** * @param \Prophecy\Doubler\Generator\Node\ClassNode $class * @param \Prophecy\Doubler\Generator\Node\MethodNode $method * @param \Prophecy\Doubler\Generator\Node\ArgumentNode $argument */ function it_overrides_properly_methods_with_args_passed_by_reference($class, $method, $argument) { $class->getParentClass()->willReturn('RuntimeException'); $class->getInterfaces()->willReturn(array('Prophecy\\Doubler\\Generator\\MirroredInterface')); $class->getProperties()->willReturn(array()); $class->getMethods()->willReturn(array($method)); $method->getName()->willReturn('getName'); $method->getVisibility()->willReturn('public'); $method->isStatic()->willReturn(false); $method->getArguments()->willReturn(array($argument)); $method->getCode()->willReturn('return $this->name;'); $argument->getName()->willReturn('fullname'); $argument->getTypeHint()->willReturn('array'); $argument->isOptional()->willReturn(true); $argument->getDefault()->willReturn(null); $argument->isPassedByReference()->willReturn(true); $code = $this->generate('CustomClass', $class); $expected = <<<'PHP' namespace { class CustomClass extends \RuntimeException implements \Prophecy\Doubler\Generator\MirroredInterface { public function getName(array &$fullname = NULL) { return $this->name; } } } PHP; $expected = strtr($expected, array("\r\n" => "\n", "\r" => "\n")); $code->shouldBe($expected); }