assign() public method

Assign a variable and its value into the template engine.
public assign ( string $var, mixed $value ) : void
$var string Variable name.
$value mixed Variable value.
return void
Exemplo n.º 1
0
 /**
  * @dataProvider dataProvider
  */
 public function testRegisterExtensions(Smarty $smarty)
 {
     DemoComponent::setConfig(__DIR__ . '/Mocks/DemoComponentConfig.yaml');
     $smarty->registerExtensions();
     $smarty->assign('name', 'WORLD');
     $result = $smarty->fetch('DemoComponent.tpl');
     $this->assertSame('Hello world', $result);
 }