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'); }
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; }