From 58892555299ad9df5bdd2c5401a854068860e68d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 20 Apr 2014 17:01:00 +0200 Subject: [ticket/12273] Test source files and compare with events.md PHPBB3-12273 --- phpBB/develop/export_events_for_wiki.php | 6 +++--- tests/event/md_exporter_test.php | 37 ++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/phpBB/develop/export_events_for_wiki.php b/phpBB/develop/export_events_for_wiki.php index 69b09ff136..cc4aa4444f 100644 --- a/phpBB/develop/export_events_for_wiki.php +++ b/phpBB/develop/export_events_for_wiki.php @@ -24,7 +24,7 @@ function usage() echo "php:\n"; echo " Generate the PHP event section of Event_List\n"; echo "\n"; - echo "acp:\n"; + echo "adm:\n"; echo " Generate the ACP Template event section of Event_List\n"; echo "\n"; echo "styles:\n"; @@ -66,7 +66,7 @@ switch ($action) case 'styles': $exporter = new \phpbb\event\md_exporter($phpbb_root_path); - $exporter->crawl_eventsmd('docs/events.md', 'styles'); + $exporter->crawl_phpbb_directory_styles('docs/events.md'); echo $exporter->export_events_for_wiki(); if ($action === 'styles') @@ -78,7 +78,7 @@ switch ($action) case 'adm': $exporter = new \phpbb\event\md_exporter($phpbb_root_path); - $exporter->crawl_eventsmd('docs/events.md', 'adm'); + $exporter->crawl_phpbb_directory_adm('docs/events.md'); echo $exporter->export_events_for_wiki(); if ($action === 'all') diff --git a/tests/event/md_exporter_test.php b/tests/event/md_exporter_test.php index 52d10bd3e3..5fb3a99254 100644 --- a/tests/event/md_exporter_test.php +++ b/tests/event/md_exporter_test.php @@ -27,4 +27,41 @@ class phpbb_event_md_exporter_test extends phpbb_test_case $exporter = new \phpbb\event\md_exporter($phpbb_root_path); $this->assertGreaterThan(0, $exporter->crawl_eventsmd('docs/events.md', $filter)); } + + static public function crawl_adm_files_data() + { + global $phpbb_root_path; + $exporter = new \phpbb\event\md_exporter($phpbb_root_path); + $data_provider = array(); + + $styles = array( + 'adm/style/' => 'adm', + 'styles/prosilver/template/' => 'styles', + 'styles/subsilver2/template/' => 'styles', + ); + foreach ($styles as $path => $filter) + { + $files = $exporter->get_recursive_file_list($phpbb_root_path . $path, $path); + foreach ($files as $file) + { + $data_provider[] = array($filter, $path . $file); + } + } + + return $data_provider; + } + + /** + * @dataProvider crawl_adm_files_data + */ + public function test_crawl_adm_files($filter, $file) + { + global $phpbb_root_path; + $exporter = new \phpbb\event\md_exporter($phpbb_root_path); + $exporter->crawl_eventsmd('docs/events.md', $filter); + $events = $exporter->crawl_file_for_events($file); + + $this->assertGreaterThanOrEqual(0, sizeof($events)); + $this->assertTrue($exporter->validate_events_from_file($file, $events)); + } } -- cgit v1.2.1