aboutsummaryrefslogtreecommitdiffstats
path: root/tests/event/md_exporter_test.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/event/md_exporter_test.php')
-rw-r--r--tests/event/md_exporter_test.php67
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/event/md_exporter_test.php b/tests/event/md_exporter_test.php
new file mode 100644
index 0000000000..b62b55accd
--- /dev/null
+++ b/tests/event/md_exporter_test.php
@@ -0,0 +1,67 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2014 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+class phpbb_event_md_exporter_test extends phpbb_test_case
+{
+
+ static public function crawl_eventsmd_data()
+ {
+ return array(
+ array('styles'),
+ array('adm'),
+ );
+ }
+
+ /**
+ * @dataProvider crawl_eventsmd_data
+ */
+ public function test_crawl_eventsmd($filter)
+ {
+ global $phpbb_root_path;
+ $exporter = new \phpbb\event\md_exporter($phpbb_root_path);
+ $this->assertGreaterThan(0, $exporter->crawl_eventsmd('docs/events.md', $filter));
+ }
+
+ static public function crawl_template_file_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_template_file_data
+ */
+ public function test_crawl_template_file($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));
+ }
+}