diff options
-rw-r--r-- | phpBB/phpbb/event/md_exporter.php | 11 | ||||
-rw-r--r-- | tests/event/md_exporter_test.php | 6 |
2 files changed, 14 insertions, 3 deletions
diff --git a/phpBB/phpbb/event/md_exporter.php b/phpBB/phpbb/event/md_exporter.php index 8dba963f11..708900c693 100644 --- a/phpBB/phpbb/event/md_exporter.php +++ b/phpBB/phpbb/event/md_exporter.php @@ -241,6 +241,11 @@ class md_exporter $files = explode("\n + ", $file_details); foreach ($files as $file) { + if (!file_exists($this->root_path . $file)) + { + throw new \LogicException("Invalid file '{$file}' not found for event '{$this->current_event}'", 1); + } + if (($this->filter !== 'adm') && strpos($file, 'styles/prosilver/template/') === 0) { $files_list['prosilver'][] = substr($file, strlen('styles/prosilver/template/')); @@ -312,6 +317,12 @@ class md_exporter { return true; } + else if (empty($this->events_by_file[$file])) + { + $event_list = implode("', '", $events); + throw new \LogicException("File '{$file}' should not contain events, but contains: " + . "'{$event_list}'", 1); + } else if (empty($events)) { $event_list = implode("', '", $this->events_by_file[$file]); diff --git a/tests/event/md_exporter_test.php b/tests/event/md_exporter_test.php index 5fb3a99254..b62b55accd 100644 --- a/tests/event/md_exporter_test.php +++ b/tests/event/md_exporter_test.php @@ -28,7 +28,7 @@ class phpbb_event_md_exporter_test extends phpbb_test_case $this->assertGreaterThan(0, $exporter->crawl_eventsmd('docs/events.md', $filter)); } - static public function crawl_adm_files_data() + static public function crawl_template_file_data() { global $phpbb_root_path; $exporter = new \phpbb\event\md_exporter($phpbb_root_path); @@ -52,9 +52,9 @@ class phpbb_event_md_exporter_test extends phpbb_test_case } /** - * @dataProvider crawl_adm_files_data + * @dataProvider crawl_template_file_data */ - public function test_crawl_adm_files($filter, $file) + public function test_crawl_template_file($filter, $file) { global $phpbb_root_path; $exporter = new \phpbb\event\md_exporter($phpbb_root_path); |