From dc3becd3525d3e4715206989a307bcbb745c2f51 Mon Sep 17 00:00:00 2001 From: otrok7 <50595291+otrok7@users.noreply.github.com> Date: Wed, 6 Nov 2024 20:17:18 +0100 Subject: [PATCH] lint --- public/class-bread-meetingslist-structure.php | 3 +- tests/BreadMeetinglistStructureTest.php | 68 +++++++++++++++---- tests/bootstrap.php | 14 ++-- tests/mock/class-bread-bmlt.php | 12 ++-- 4 files changed, 71 insertions(+), 26 deletions(-) diff --git a/public/class-bread-meetingslist-structure.php b/public/class-bread-meetingslist-structure.php index bb980d7..0117f80 100644 --- a/public/class-bread-meetingslist-structure.php +++ b/public/class-bread-meetingslist-structure.php @@ -479,8 +479,7 @@ public function calculateContHeader(): string $header_string = str_replace('main_grouping', $this->remove_sort_key($this->main_heading_raw), $header_string); $header_string = str_replace('subgrouping', $this->remove_sort_key($this->main_heading_raw), $header_string); $header .= "
" . $header_string . $cont . "
"; - } - else if (!$this->newMainHeading) { + } else if (!$this->newMainHeading) { $cont = $this->cont; } $header = "
" . $this->remove_sort_key($this->main_heading_raw) . " " . $cont . "
"; diff --git a/tests/BreadMeetinglistStructureTest.php b/tests/BreadMeetinglistStructureTest.php index c2bb516..f98185c 100644 --- a/tests/BreadMeetinglistStructureTest.php +++ b/tests/BreadMeetinglistStructureTest.php @@ -51,39 +51,81 @@ public function calculateExpectedHeadingStyle($options): string } public function testBerlinByDayMain() { - $this->doTest('berlin-booklet', 'berlin', 'berlin-formats-de', 'german-formats', -1, + $this->doTest( + 'berlin-booklet', + 'berlin', + 'berlin-formats-de', + 'german-formats', + -1, ['Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag','Sonntag'], - [[0],[0],[0],[0],[0],[0],[0]], 'de'); + [[0],[0],[0],[0],[0],[0],[0]], + 'de' + ); } public function testBerlinByDayAdditional() { - $this->doTest('berlin-booklet', 'berlin', 'berlin-formats-de', 'german-formats', 1, + $this->doTest( + 'berlin-booklet', + 'berlin', + 'berlin-formats-de', + 'german-formats', + 1, ['','','','','','',''], - [[0],[0],[0],[0],[0],[0],[0]], 'de'); + [[0],[0],[0],[0],[0],[0],[0]], + 'de' + ); } public function testBerlinByCityPlusDayMain() { - $this->doTest('berlin-by-city-plus-day', 'berlin', 'berlin-formats-de', 'german-formats', -1, + $this->doTest( + 'berlin-by-city-plus-day', + 'berlin', + 'berlin-formats-de', + 'german-formats', + -1, ['Berlin','Dallgow-Döberitz','Eberswalde','Potsdam','Rathenow'], - [[0],[0],[0],[0],[0]], 'de'); + [[0],[0],[0],[0],[0]], + 'de' + ); } public function testBerlinByCityPlusDayAdditional() { - $this->doTest('berlin-booklet', 'berlin', 'berlin-formats-de', 'german-formats', 1, + $this->doTest( + 'berlin-booklet', + 'berlin', + 'berlin-formats-de', + 'german-formats', + 1, ['','','','','','',''], - [[0],[0],[0],[0],[0],[0],[0]], 'de'); + [[0],[0],[0],[0],[0],[0],[0]], + 'de' + ); } public function testBerlinByDayThenCityPlusDayAdditionalMain() { - $this->doTest('berlin-by-day-then-city-plus-day', 'berlin', 'berlin-formats-de', 'german-formats', -1, + $this->doTest( + 'berlin-by-day-then-city-plus-day', + 'berlin', + 'berlin-formats-de', + 'german-formats', + -1, ['Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag','Sonntag'], - [['Berlin',],['Berlin','Potsdam','Rathenow'],['Berlin','Dallgow-Döberitz','Eberswalde'],['Berlin','Potsdam'],['Berlin',],['Berlin','Potsdam'],['Berlin','Potsdam']], 'de'); + [['Berlin',],['Berlin','Potsdam','Rathenow'],['Berlin','Dallgow-Döberitz','Eberswalde'],['Berlin','Potsdam'],['Berlin',],['Berlin','Potsdam'],['Berlin','Potsdam']], + 'de' + ); } public function testBerlinByDayThenCityPlusDayAdditional() { - $this->doTest('berlin-by-day-then-city-plus-day', 'berlin', 'berlin-formats-de', 'german-formats', 1, + $this->doTest( + 'berlin-by-day-then-city-plus-day', + 'berlin', + 'berlin-formats-de', + 'german-formats', + 1, ['','','','','','',''], - [[0],[0],[0],[0],[0],[0],[0]], 'de'); + [[0],[0],[0],[0],[0],[0],[0]], + 'de' + ); } public function doTest($config, $meetingJson, $usedFormats, $formatBase, $include, $expectedHeading, $expectedSubHeading, $lang): void { @@ -92,7 +134,7 @@ public function doTest($config, $meetingJson, $usedFormats, $formatBase, $includ $meetings = $this->getMeetings($meetingJson); $formatMgr = $this->getFormatMgr($usedFormats, $lang); Bread_Bmlt::setFormatBase($formatBase); - $this->enhanceMeetings($meetings, $options,$formatMgr); + $this->enhanceMeetings($meetings, $options, $formatMgr); $bms = new Bread_Meetingslist_Structure($options, $meetings, $lang, $include); $knt = 0; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 37b0c9f..cd2758b 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -4,9 +4,11 @@ require_once __DIR__.'/../public/class-bread-meetingslist-structure.php'; require_once __DIR__.'/../public/class-bread-meeting-enhancer.php'; require_once __DIR__.'/../public/class-bread-format-manager.php'; - function apply_filters( $hook_name, $value, $args ) { - return $value; - } - function plugin_dir_url( $file) { - return './'; - } +function apply_filters($hook_name, $value, $args) +{ + return $value; +} +function plugin_dir_url($file) +{ + return './'; +} diff --git a/tests/mock/class-bread-bmlt.php b/tests/mock/class-bread-bmlt.php index cb30a08..9d79d8c 100644 --- a/tests/mock/class-bread-bmlt.php +++ b/tests/mock/class-bread-bmlt.php @@ -1,5 +1,5 @@