1<?php 2namespace plugin\struct\test; 3/** 4 * General tests for the skilltagicon plugin 5 * 6 * @group plugin_farmsync 7 * @group plugins 8 */ 9class general_plugin_farmsync_test extends \DokuWikiTest { 10 11 /** 12 * Simple test to make sure the plugin.info.txt is in correct format 13 */ 14 public function test_plugininfo() { 15 $file = __DIR__.'/../plugin.info.txt'; 16 $this->assertFileExists($file); 17 18 $info = confToHash($file); 19 20 $this->assertArrayHasKey('base', $info); 21 $this->assertArrayHasKey('author', $info); 22 $this->assertArrayHasKey('email', $info); 23 $this->assertArrayHasKey('date', $info); 24 $this->assertArrayHasKey('name', $info); 25 $this->assertArrayHasKey('desc', $info); 26 $this->assertArrayHasKey('url', $info); 27 28 $this->assertEquals('farmsync', $info['base']); 29 $this->assertRegExp('/^https?:\/\//', $info['url']); 30 $this->assertTrue(mail_isvalid($info['email'])); 31 $this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']); 32 $this->assertTrue(false !== strtotime($info['date'])); 33 } 34 35 /** 36 * Test to ensure that every conf['...'] entry in conf/default.php has a corresponding meta['...'] entry in 37 * conf/metadata.php. 38 */ 39 public function test_plugin_conf() { 40 include(__DIR__.'/../conf/default.php'); 41 include(__DIR__.'/../conf/metadata.php'); 42 43 if (gettype($conf) != 'NULL' && gettype($meta) != 'NULL') { 44 foreach($conf as $key => $value) { 45 $this->assertTrue(array_key_exists($key, $meta), 'Key $meta[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'farmsync/conf/metadata.php'); 46 } 47 48 foreach($meta as $key => $value) { 49 $this->assertTrue(array_key_exists($key, $conf), 'Key $conf[\'' . $key . '\'] missing in ' . DOKU_PLUGIN . 'farmsync/conf/default.php'); 50 } 51 } 52 53 } 54} 55