You are here

class ClassCreatorSpec in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpspec/prophecy/spec/Prophecy/Doubler/Generator/ClassCreatorSpec.php \spec\Prophecy\Doubler\Generator\ClassCreatorSpec

Hierarchy

  • class \spec\Prophecy\Doubler\Generator\ClassCreatorSpec extends \PhpSpec\ObjectBehavior

Expanded class hierarchy of ClassCreatorSpec

File

vendor/phpspec/prophecy/spec/Prophecy/Doubler/Generator/ClassCreatorSpec.php, line 7

Namespace

spec\Prophecy\Doubler\Generator
View source
class ClassCreatorSpec extends ObjectBehavior {

  /**
   * @param \Prophecy\Doubler\Generator\ClassCodeGenerator $generator
   */
  function let($generator) {
    $this
      ->beConstructedWith($generator);
  }

  /**
   * @param \Prophecy\Doubler\Generator\Node\ClassNode $class
   */
  function it_evaluates_code_generated_by_ClassCodeGenerator($generator, $class) {
    $generator
      ->generate('stdClass', $class)
      ->shouldBeCalled()
      ->willReturn('return 42;');
    $this
      ->create('stdClass', $class)
      ->shouldReturn(42);
  }

  /**
   * @param \Prophecy\Doubler\Generator\Node\ClassNode $class
   */
  function it_throws_an_exception_if_class_does_not_exist_after_evaluation($generator, $class) {
    $generator
      ->generate('CustomClass', $class)
      ->shouldBeCalled()
      ->willReturn('return 42;');
    $class
      ->getParentClass()
      ->willReturn('stdClass');
    $class
      ->getInterfaces()
      ->willReturn(array(
      'Interface1',
      'Interface2',
    ));
    $this
      ->shouldThrow('Prophecy\\Exception\\Doubler\\ClassCreatorException')
      ->duringCreate('CustomClass', $class);
  }

}

Members