Browse Source

Added test

Giuseppe Di Terlizzi 10 years ago
parent
commit
c42e3c11e3
2 changed files with 47 additions and 0 deletions
  1. 12 0
      .travis.yml
  2. 35 0
      _test/general.test.php

+ 12 - 0
.travis.yml

@@ -0,0 +1,12 @@
+language: php
+php:
+  - "5.5"
+  - "5.4"
+  - "5.3"
+env:
+  - DOKUWIKI=master
+  - DOKUWIKI=stable
+  - DOKUWIKI=old-stable
+before_install: wget https://raw.github.com/splitbrain/dokuwiki-travis/master/travis.sh
+install: sh travis.sh
+script: cd _test && phpunit --stderr --group plugin_icons

+ 35 - 0
_test/general.test.php

@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * General tests for the icons plugin
+ *
+ * @group plugin_icons
+ * @group plugins
+ */
+class general_plugin_icons_test extends DokuWikiTest {
+
+    /**
+     * Simple test to make sure the plugin.info.txt is in correct format
+     */
+    public function test_plugininfo() {
+        $file = __DIR__.'/../plugin.info.txt';
+        $this->assertFileExists($file);
+
+        $info = confToHash($file);
+
+        $this->assertArrayHasKey('base', $info);
+        $this->assertArrayHasKey('author', $info);
+        $this->assertArrayHasKey('email', $info);
+        $this->assertArrayHasKey('date', $info);
+        $this->assertArrayHasKey('name', $info);
+        $this->assertArrayHasKey('desc', $info);
+        $this->assertArrayHasKey('url', $info);
+
+        $this->assertEquals('icons', $info['base']);
+        $this->assertRegExp('/^https?:\/\//', $info['url']);
+        $this->assertTrue(mail_isvalid($info['email']));
+        $this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']);
+        $this->assertTrue(false !== strtotime($info['date']));
+    }
+}
+