assign() public method

Assign variables to the view.
public assign ( array $data, string $root = 'Ctrl' )
$data array List of variables that should be assigned.
$root string Variable root. Default root is Ctrl.
コード例 #1
0
ファイル: ViewTest.php プロジェクト: Webiny/Framework
 public function testAssignments()
 {
     $view = new View();
     $view->assign(['name' => 'john']);
     $data = ['name' => 'john'];
     $this->assertSame($data, $view->getAssignedData()['Ctrl']);
     $view->assign(['new' => 'data']);
     $data['new'] = 'data';
     $this->assertSame($data, $view->getAssignedData()['Ctrl']);
 }