/**
  * @param array $params
  * @return CM_Dom_NodeList
  */
 private function _createSelect(array $params)
 {
     $smarty = new Smarty();
     $render = new CM_Frontend_Render();
     $template = $smarty->createTemplate('string:');
     $template->assignGlobal('render', $render);
     $html = smarty_function_select($params, $template);
     return new CM_Dom_NodeList($html);
 }
 function test_smarty_function_select()
 {
     $params = array('list' => array('1' => array('name' => 'foo'), 'value' => array('name' => 'bar')), 'name' => 'name', 'value' => 'value', 'empty' => false);
     $dummy_smarty = null;
     $expected = "<select name=\"name\">\n" . "<option value=\"1\" >foo</option>\n" . "<option value=\"value\" selected=\"selected\">bar</option>\n" . "</select>\n";
     ob_start();
     smarty_function_select($params, $dummy_smarty);
     $actual = ob_get_clean();
     $this->assertEqual($expected, $actual);
     $params['empty'] = '-- please select --';
     $expected = "<select name=\"name\">\n" . "<option value=\"\">-- please select --</option>\n" . "<option value=\"1\" >foo</option>\n" . "<option value=\"value\" selected=\"selected\">bar</option>\n" . "</select>\n";
     ob_start();
     smarty_function_select($params, $dummy_smarty);
     $actual = ob_get_clean();
     $this->assertEqual($expected, $actual);
 }