|
@@ 294-332 (lines=39) @@
|
| 291 |
|
} |
| 292 |
|
|
| 293 |
|
// F F F |
| 294 |
|
function it_creates_two_class_definitions_for_different_classes_with_different_interfaces_and_patches( |
| 295 |
|
ClassMirror $mirror, |
| 296 |
|
ClassCreator $creator, |
| 297 |
|
NameGenerator $namer, |
| 298 |
|
ClassPatchInterface $alt1, |
| 299 |
|
ClassPatchInterface $alt2, |
| 300 |
|
\ReflectionClass $class1, |
| 301 |
|
\ReflectionClass $class2, |
| 302 |
|
\ReflectionClass $interface1, |
| 303 |
|
\ReflectionClass $interface2, |
| 304 |
|
ClassNode $node1, |
| 305 |
|
ClassNode $node2 |
| 306 |
|
) { |
| 307 |
|
$mirror->reflect($class1, array($interface1))->willReturn($node1); |
| 308 |
|
$mirror->reflect($class2, array($interface2))->willReturn($node2); |
| 309 |
|
$alt1->supports($node1)->willReturn(true); |
| 310 |
|
$alt1->supports($node2)->willReturn(true); |
| 311 |
|
$alt2->supports($node2)->willReturn(false); |
| 312 |
|
$alt1->getPriority()->willReturn(1); |
| 313 |
|
$alt2->getPriority()->willReturn(2); |
| 314 |
|
$namer->name($class1, array($interface1))->willReturn('SplStack'); |
| 315 |
|
$namer->name($class2, array($interface2))->willReturn('spec\Prophecy\Doubler\aClass'); |
| 316 |
|
$class1->getName()->willReturn('stdClass'); |
| 317 |
|
$class2->getName()->willReturn('aClass'); |
| 318 |
|
$interface1->getName()->willReturn('ArrayAccess'); |
| 319 |
|
$interface2->getName()->willReturn('Iterator'); |
| 320 |
|
|
| 321 |
|
$alt1->apply($node1)->shouldBeCalled(); |
| 322 |
|
$alt1->apply($node2)->shouldBeCalled(); |
| 323 |
|
$alt2->apply($node2)->shouldNotBeCalled(); |
| 324 |
|
$creator->create('SplStack', $node1)->shouldBeCalledTimes(1); |
| 325 |
|
$creator->create('spec\Prophecy\Doubler\aClass', $node2)->shouldBeCalledTimes(1); |
| 326 |
|
|
| 327 |
|
$this->registerClassPatch($alt1); |
| 328 |
|
$this->double($class1, array($interface1)); |
| 329 |
|
|
| 330 |
|
$this->registerClassPatch($alt2); |
| 331 |
|
$this->double($class2, array($interface2)); |
| 332 |
|
} |
| 333 |
|
|
| 334 |
|
// T F F |
| 335 |
|
function it_creates_two_class_definitions_for_the_same_class_with_different_interfaces_and_patches( |
|
@@ 335-371 (lines=37) @@
|
| 332 |
|
} |
| 333 |
|
|
| 334 |
|
// T F F |
| 335 |
|
function it_creates_two_class_definitions_for_the_same_class_with_different_interfaces_and_patches( |
| 336 |
|
ClassMirror $mirror, |
| 337 |
|
ClassCreator $creator, |
| 338 |
|
NameGenerator $namer, |
| 339 |
|
ClassPatchInterface $alt1, |
| 340 |
|
ClassPatchInterface $alt2, |
| 341 |
|
\ReflectionClass $class, |
| 342 |
|
\ReflectionClass $interface1, |
| 343 |
|
\ReflectionClass $interface2, |
| 344 |
|
ClassNode $node1, |
| 345 |
|
ClassNode $node2 |
| 346 |
|
) { |
| 347 |
|
$mirror->reflect($class, array($interface1))->willReturn($node1); |
| 348 |
|
$mirror->reflect($class, array($interface2))->willReturn($node2); |
| 349 |
|
$alt1->supports($node1)->willReturn(true); |
| 350 |
|
$alt1->supports($node2)->willReturn(true); |
| 351 |
|
$alt2->supports($node2)->willReturn(false); |
| 352 |
|
$alt1->getPriority()->willReturn(1); |
| 353 |
|
$alt2->getPriority()->willReturn(2); |
| 354 |
|
$namer->name($class, array($interface1))->willReturn('SplStack'); |
| 355 |
|
$namer->name($class, array($interface2))->willReturn('SplStack'); |
| 356 |
|
$class->getName()->willReturn('stdClass'); |
| 357 |
|
$interface1->getName()->willReturn('ArrayAccess'); |
| 358 |
|
$interface2->getName()->willReturn('Iterator'); |
| 359 |
|
|
| 360 |
|
$alt1->apply($node1)->shouldBeCalled(); |
| 361 |
|
$alt1->apply($node2)->shouldBeCalled(); |
| 362 |
|
$alt2->apply($node2)->shouldNotBeCalled(); |
| 363 |
|
$creator->create('SplStack', $node1)->shouldBeCalledTimes(1); |
| 364 |
|
$creator->create('SplStack', $node2)->shouldBeCalledTimes(1); |
| 365 |
|
|
| 366 |
|
$this->registerClassPatch($alt1); |
| 367 |
|
$this->double($class, array($interface1)); |
| 368 |
|
|
| 369 |
|
$this->registerClassPatch($alt2); |
| 370 |
|
$this->double($class, array($interface2)); |
| 371 |
|
} |
| 372 |
|
|
| 373 |
|
// T T F |
| 374 |
|
function it_creates_two_different_class_definitions_for_the_same_class_with_same_interfaces_and_different_patches( |