From 15c31823527f6fb63e4557d12af866fbc307739c Mon Sep 17 00:00:00 2001 From: Instrye Date: Tue, 14 Jan 2020 14:35:42 +0800 Subject: [PATCH 1/3] fix. HTMLhelperTest ol and ul arrt type --- tests/system/Helpers/HTMLHelperTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/system/Helpers/HTMLHelperTest.php b/tests/system/Helpers/HTMLHelperTest.php index b517fe036ff0..0ca2258e8dba 100755 --- a/tests/system/Helpers/HTMLHelperTest.php +++ b/tests/system/Helpers/HTMLHelperTest.php @@ -44,7 +44,7 @@ public function testBasicUL() public function testULWithClass() { $expected = << + @@ -57,7 +57,7 @@ public function testULWithClass() 'bar', ]; - $this->assertEquals($expected, ul($list, 'class="test"')); + $this->assertEquals($expected, ul($list, ['id' => 'testID', 'class' => 'test'])); } public function testMultiLevelUL() @@ -113,7 +113,7 @@ public function testBasicOL() public function testOLWithClass() { $expected = << +
  1. foo
  2. bar
@@ -126,7 +126,7 @@ public function testOLWithClass() 'bar', ]; - $this->assertEquals($expected, ol($list, 'class="test"')); + $this->assertEquals($expected, ol($list, ['id' => 'testID', 'class' => 'test'])); } public function testMultiLevelOL() From 8a69e2ebae2ed87d4ac2a17b2d16cb80bc74dad4 Mon Sep 17 00:00:00 2001 From: Instrye Date: Tue, 14 Jan 2020 14:36:43 +0800 Subject: [PATCH 2/3] fix. HTMLhelper ol and ul arrt type --- system/Helpers/html_helper.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/system/Helpers/html_helper.php b/system/Helpers/html_helper.php index 72891a63328c..ff3783d185e7 100755 --- a/system/Helpers/html_helper.php +++ b/system/Helpers/html_helper.php @@ -52,10 +52,10 @@ * multi-dimensional array. * * @param array $list - * @param string $attributes HTML attributes + * @param array $attributes HTML attributes * @return string */ - function ul(array $list, string $attributes = ''): string + function ul(array $list, array $attributes = []): string { return _list('ul', $list, $attributes); } @@ -71,10 +71,10 @@ function ul(array $list, string $attributes = ''): string * Generates an HTML ordered list from an single or multi-dimensional array. * * @param array $list - * @param string $attributes HTML attributes + * @param array $attributes HTML attributes * @return string */ - function ol(array $list, string $attributes = ''): string + function ol(array $list, array $attributes = []): string { return _list('ol', $list, $attributes); } @@ -91,11 +91,11 @@ function ol(array $list, string $attributes = ''): string * * @param string $type * @param mixed $list - * @param string $attributes + * @param array $attributes * @param integer $depth * @return string */ - function _list(string $type = 'ul', $list = [], string $attributes = '', int $depth = 0): string + function _list(string $type = 'ul', $list = [], array $attributes = [], int $depth = 0): string { // Set the indentation based on the depth $out = str_repeat(' ', $depth) @@ -120,7 +120,7 @@ function _list(string $type = 'ul', $list = [], string $attributes = '', int $de { $out .= $_last_list_item . "\n" - . _list($type, $val, '', $depth + 4) + . _list($type, $val, [], $depth + 4) . str_repeat(' ', $depth + 2); } From 7d2598b3747f39e8e4fc13a5cb69afdeac8094d6 Mon Sep 17 00:00:00 2001 From: Instrye Date: Tue, 14 Jan 2020 15:14:34 +0800 Subject: [PATCH 3/3] fix expected string --- tests/system/Helpers/HTMLHelperTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/Helpers/HTMLHelperTest.php b/tests/system/Helpers/HTMLHelperTest.php index 0ca2258e8dba..cb7eac011f13 100755 --- a/tests/system/Helpers/HTMLHelperTest.php +++ b/tests/system/Helpers/HTMLHelperTest.php @@ -113,7 +113,7 @@ public function testBasicOL() public function testOLWithClass() { $expected = << +
  1. foo
  2. bar