Файл: src/vendor/way/generators/spec/Way/Generators/GeneratorSpec.php
Строк: 28
<?php
namespace specWayGenerators;
use PhpSpecObjectBehavior;
use ProphecyArgument;
use WayGeneratorsFilesystemFilesystem;
use WayGeneratorsCompilersTemplateCompiler;
class GeneratorSpec extends ObjectBehavior {
function let(Filesystem $file)
{
// By default, we'll set the file to not exist
// This may be overridden, though
$file->exists('foo.txt')->willReturn(false);
$this->beConstructedWith($file);
}
function it_is_initializable()
{
$this->shouldHaveType('WayGeneratorsGenerator');
}
function it_compiles_a_template(Filesystem $file, TemplateCompiler $compiler)
{
$template = 'class $NAME$ {}';
$data = ['NAME' => 'Bar'];
$compiledTemplate = 'class Bar {}';
$file->get('template.txt')->shouldBeCalled()->willReturn($template);
$compiler->compile($template, $data)->shouldBeCalled()->willReturn($compiledTemplate);
// When we call compile, we expect the method to
// fetch the given template, compile it down,
// and return the results
$this->compile('template.txt', $data, $compiler)->shouldBe($compiledTemplate);
}
}