示例#1
0
 /**
  * Test rendering with disabling escaping.
  *
  * @return void
  */
 public function testRenderEscapingOption()
 {
     $select = new SelectBox($this->templates);
     $data = ['name' => 'Birds[name]', 'options' => ['a' => '>Albatross', 'b' => '>Budgie', 'c' => '>Canary']];
     $result = $select->render($data);
     $expected = ['select' => ['name' => 'Birds[name]'], ['option' => ['value' => 'a']], '>Albatross', '/option', ['option' => ['value' => 'b']], '>Budgie', '/option', ['option' => ['value' => 'c']], '>Canary', '/option', '/select'];
     $this->assertTags($result, $expected);
     $data = ['escape' => false, 'name' => 'Birds[name]', 'options' => ['>a' => '>Albatross']];
     $result = $select->render($data);
     $expected = ['select' => ['name' => 'Birds[name]'], ['option' => ['value' => '>a']], '>Albatross', '/option', '/select'];
     $this->assertTags($result, $expected);
 }
示例#2
0
 /**
  * Generates a meridian select
  *
  * @param array $options The options to generate a meridian select with.
  * @param \Cake\View\Form\ContextInterface $context The current form context.
  * @return string
  */
 protected function _meridianSelect($options, $context)
 {
     $options += ['name' => '', 'val' => null, 'options' => ['am' => 'am', 'pm' => 'pm']];
     return $this->_select->render($options, $context);
 }