'',
];
$this->context = $this->getMock('Cake\View\Form\ContextInterface');
$this->templates = new StringTemplate($templates);
}
/**
* Test render in a simple case.
*
* @return void
*/
public function testRenderSimple() {
$input = new Textarea($this->templates);
$result = $input->render(['name' => 'comment'], $this->context);
$expected = [
'textarea' => ['name' => 'comment'],
'/textarea',
];
$this->assertHtml($expected, $result);
}
/**
* Test render with a value
*
* @return void
*/
public function testRenderWithValue() {
$input = new Textarea($this->templates);
$data = ['name' => 'comment', 'data-foo' => '', 'val' => 'some '];
$result = $input->render($data, $this->context);
$expected = [
'textarea' => ['name' => 'comment', 'data-foo' => '<val>'],
'some <html>',
'/textarea',
];
$this->assertHtml($expected, $result);
$data['escape'] = false;
$result = $input->render($data, $this->context);
$expected = [
'textarea' => ['name' => 'comment', 'data-foo' => ''],
'some ',
'/textarea',
];
$this->assertHtml($expected, $result);
}
}