mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 13:17:24 +02:00
added tests for uc_select
This commit is contained in:
@@ -92,10 +92,11 @@
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->_frm = $this->make('e_form');
|
$this->_frm = $this->make('e_form');
|
||||||
|
$this->_frm->__construct();
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
$this->assertTrue(false, "Couldn't load e_parser object");
|
$this->assertTrue(false, "Couldn't load e_form object");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,12 +403,63 @@
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
public function testUc_select()
|
public function testUc_select_single_numeric()
|
||||||
{
|
{
|
||||||
|
$uc_options = 'admin';
|
||||||
|
$select_options = array('multiple' => false);
|
||||||
|
$opt_options = array();
|
||||||
|
$actual = $this->_frm->uc_select('uc', 254, $uc_options, $select_options, $opt_options);
|
||||||
|
$expected = "<select name='uc' id='uc' class='tbox select form-control'>\n<option value='254' selected='selected'> Admin</option>\n\n<optgroup label=\"Everyone but..\">\n<option value='-254'> Not Admin</option>\n</optgroup>\n\n</select>";
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testUc_select_single_string()
|
||||||
|
{
|
||||||
|
$uc_options = 'admin';
|
||||||
|
$select_options = array('multiple' => false);
|
||||||
|
$opt_options = array();
|
||||||
|
$actual = $this->_frm->uc_select('uc', 'Admin', $uc_options, $select_options, $opt_options);
|
||||||
|
$expected = "<select name='uc' id='uc' class='tbox select form-control'>\n<option value='254' selected='selected'> Admin</option>\n\n<optgroup label=\"Everyone but..\">\n<option value='-254'> Not Admin</option>\n</optgroup>\n\n</select>";
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testUc_select_multi_numeric()
|
||||||
|
{
|
||||||
|
$uc_options = 'member,admin';
|
||||||
|
$select_options = array('multiple' => true);
|
||||||
|
$opt_options = array();
|
||||||
|
$actual = $this->_frm->uc_select('uc', '254,253', $uc_options, $select_options, $opt_options);
|
||||||
|
$expected = "<select name='uc[]' id='uc' class='tbox select form-control' multiple='multiple'>\n<option value='254' selected='selected'> Admin</option>\n<option value='253' selected='selected'> Members</option>\n\n<optgroup label=\"Everyone but..\">\n<option value='-254'> Not Admin</option>\n<option value='-253'> Not Members</option>\n</optgroup>\n\n</select>";
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testUc_select_multi_string()
|
||||||
|
{
|
||||||
|
$uc_options = 'member,admin';
|
||||||
|
$select_options = array('multiple' => true);
|
||||||
|
$opt_options = array();
|
||||||
|
$actual = $this->_frm->uc_select('uc', 'Admin,Members', $uc_options, $select_options, $opt_options);
|
||||||
|
$expected = "<select name='uc[]' id='uc' class='tbox select form-control' multiple='multiple'>\n<option value='254' selected='selected'> Admin</option>\n<option value='253' selected='selected'> Members</option>\n\n<optgroup label=\"Everyone but..\">\n<option value='-254'> Not Admin</option>\n<option value='-253'> Not Members</option>\n</optgroup>\n\n</select>";
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testUc_select_multi_mixed()
|
||||||
|
{
|
||||||
|
$uc_options = 'member,admin';
|
||||||
|
$select_options = array('multiple' => true);
|
||||||
|
$opt_options = array();
|
||||||
|
$actual = $this->_frm->uc_select('uc', 'Admin,253', $uc_options, $select_options, $opt_options);
|
||||||
|
$expected = "<select name='uc[]' id='uc' class='tbox select form-control' multiple='multiple'>\n<option value='254' selected='selected'> Admin</option>\n<option value='253' selected='selected'> Members</option>\n\n<optgroup label=\"Everyone but..\">\n<option value='-254'> Not Admin</option>\n<option value='-253'> Not Members</option>\n</optgroup>\n\n</select>";
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public function test_uc_select_cb()
|
public function test_uc_select_cb()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -417,7 +469,7 @@
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
public function testOption()
|
public function testOption()
|
||||||
{
|
{
|
||||||
$options = array('disabled'=>true);
|
$options = array('disabled'=>true);
|
||||||
|
Reference in New Issue
Block a user