예제 #1
0
 public function testAddBuilderOnlyBuilderVariables()
 {
     $builder = new DemoBuilder();
     $builder->setVariables(array('foo' => 'bar'));
     $generator = new Generator();
     $generator->addBuilder($builder);
     $this->assertEquals('bar', $builder->getVariable('foo'), 'Expected builder variable');
 }
예제 #2
0
 protected function initBuilder()
 {
     $builder = new DemoBuilder();
     $generator = $this->getMockBuilder('TwigGenerator\\Builder\\Generator')->disableOriginalConstructor()->getMock();
     $builder->setGenerator($generator);
     $builder->setMustOverwriteIfExists(true);
     $builder->setOutputName('test.php');
     $builder->setTemplateDirs(array(__DIR__ . '/Fixtures/Templates'));
     $builder->setVariables(array('name' => 'cedric'));
     $builder->setTemplateName($builder->getDefaultTemplateName());
     return $builder;
 }