assign() публичный Метод

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.
Результат void
Пример #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);
 }