spec\PhpSpec\CodeGenerator\Generator\ClassGeneratorSpec::it_uses_template_provided_by_templating_system_if_there_is_one PHP Method

it_uses_template_provided_by_templating_system_if_there_is_one() public method

public it_uses_template_provided_by_templating_system_if_there_is_one ( $io, $tpl, $fs, PhpSpec\Locator\Resource $resource )
$resource PhpSpec\Locator\Resource
    function it_uses_template_provided_by_templating_system_if_there_is_one($io, $tpl, $fs, Resource $resource)
    {
        $resource->getName()->willReturn('App');
        $resource->getSrcFilename()->willReturn('/project/src/Acme/App.php');
        $resource->getSrcNamespace()->willReturn('Acme');
        $resource->getSrcClassname()->willReturn('Acme\\App');
        $values = array('%filepath%' => '/project/src/Acme/App.php', '%name%' => 'App', '%namespace%' => 'Acme', '%namespace_block%' => "\n\nnamespace Acme;");
        $tpl->render('class', $values)->willReturn('template code');
        $tpl->renderString(Argument::type('string'), $values)->willReturn('generated code');
        $fs->pathExists('/project/src/Acme/App.php')->willReturn(false);
        $fs->isDirectory('/project/src/Acme')->willReturn(true);
        $fs->putFileContents('/project/src/Acme/App.php', 'template code')->shouldBeCalled();
        $this->generate($resource);
    }