diff --git a/e107_tests/tests/unit/e_formTest.php b/e107_tests/tests/unit/e_formTest.php index 3597bdec5..6f858246a 100644 --- a/e107_tests/tests/unit/e_formTest.php +++ b/e107_tests/tests/unit/e_formTest.php @@ -751,12 +751,54 @@ class e_formTest extends \Codeception\Test\Unit $this->assertEquals($expected, $actual); } - /* - public function testOption_multi() - { - } + public function testOption_multi() + { + $tests = array( + 0 => array( + 'options' => array ( 2 => 'Category 1', 3 => 'Category 2', 1 => 'Misc', ), + 'value' => '3', + 'expected' => "", + ), + 1 => array( + 'options' => array ( 'noindex' => 'NoIndex', 'nofollow' => 'NoFollow', 'noarchive' => 'NoArchive', 'noimageindex' => 'NoImageIndex', ), + 'value' => array ( 0 => 'noarchive', 1 => 'noimageindex', ), + 'expected' => "", + + ), + + 2 => array( + 'options' => array ( 'default' => 'Default', 'nav' => 'Nav', ), + 'value' => 'default', + 'expected' => "", + + ), + + 3 => array( + 'options' => array ( 0 => 'Default Area', 1 => 'Default Area - Title', 4 => 'Default Area - Title/Summary', 2 => 'Sidebar - Othernews', 3 => 'Sidebar - Othernews 2', 5 => 'Carousel', 6 => 'News Grid Menu', ), + 'value' => array ( 0 => '1', 1 => '4', ), + 'expected' => "", + ), + + 4 => array( + 'options' => array ( 0 => 'Default Area', 1 => 'Default Area - Title', 4 => 'Default Area - Title/Summary', 2 => 'Sidebar - Othernews', 3 => 'Sidebar - Othernews 2', 5 => 'Carousel', 6 => 'News Grid Menu', ), + 'value' => array ( 0 => ''), + 'expected' => "", + ), + + + ); + + foreach($tests as $row) + { + $actual = $this->_frm->option_multi($row['options'],$row['value']); + $actual = str_replace("\n", '', $actual); + $this->assertSame($row['expected'], $actual); + } + + } +/* public function testOptgroup_close() { @@ -1130,7 +1172,7 @@ class e_formTest extends \Codeception\Test\Unit 'image_002' => "\"butterfly.jpg\"", 'checkboxes_001' => "
", - 'country_001' => "", + // 'country_001' => "", 'ip_001' => "", 'templates_001' => "", 'radio_001' => " ", @@ -1153,7 +1195,7 @@ class e_formTest extends \Codeception\Test\Unit 'email_001' => "", 'hidden_001' => "", // 'method_001' => 'custom-value', - 'language_001' => "", + // 'language_001' => "", 'media_001' => "
", // Test Dropdown Multiple. @@ -1166,11 +1208,6 @@ class e_formTest extends \Codeception\Test\Unit foreach($this->_fields as $field=>$att) { - $value = $this->_values[$field]; - $result = $frm->renderElement($field, $value, $att); - - $result = str_replace(array("\n", "\r"), "", $result); - if(!isset($expected[$field])) { @@ -1183,8 +1220,16 @@ class e_formTest extends \Codeception\Test\Unit } + $value = $this->_values[$field]; + $result = $frm->renderElement($field, $value, $att); - $this->assertEquals($expected[$field], $result, 'Field: '.$field); + $result = str_replace(array("\n", "\r"), "", $result); + + // ignore tabindex. + $result = preg_replace("/tabindex='[0-9]*'/", '', $result); + $expect = preg_replace("/tabindex='[0-9]*'/", '', $expected[$field]); + + $this->assertEquals($expect, $result, 'Field: '.$field); }