1cf2dcf1bSAndreas Gohr<?php 2cf2dcf1bSAndreas Gohr 3cf2dcf1bSAndreas Gohrnamespace dokuwiki\plugin\extension\test; 4cf2dcf1bSAndreas Gohr 5cf2dcf1bSAndreas Gohruse dokuwiki\plugin\extension\Extension; 6cf2dcf1bSAndreas Gohruse DokuWikiTest; 7cf2dcf1bSAndreas Gohr 8cf2dcf1bSAndreas Gohr/** 9cf2dcf1bSAndreas Gohr * Tests for the extension plugin 10cf2dcf1bSAndreas Gohr * 11cf2dcf1bSAndreas Gohr * @group plugin_extension 12cf2dcf1bSAndreas Gohr * @group plugins 13cf2dcf1bSAndreas Gohr */ 14cf2dcf1bSAndreas Gohrclass ExtensionTest extends DokuWikiTest 15cf2dcf1bSAndreas Gohr{ 16*8fe483c9SAndreas Gohr protected $pluginsEnabled = ['extension']; 17cf2dcf1bSAndreas Gohr 18*8fe483c9SAndreas Gohr /** 19*8fe483c9SAndreas Gohr * Run checks against the extension plugin itself 20*8fe483c9SAndreas Gohr */ 21*8fe483c9SAndreas Gohr public function testSelf() 22cf2dcf1bSAndreas Gohr { 23cf2dcf1bSAndreas Gohr $extension = Extension::createFromDirectory(__DIR__.'/../'); 24cf2dcf1bSAndreas Gohr 25cf2dcf1bSAndreas Gohr $this->assertFalse($extension->isTemplate()); 26*8fe483c9SAndreas Gohr $this->assertEquals('plugin', $extension->getType()); 27cf2dcf1bSAndreas Gohr $this->assertEquals('extension', $extension->getBase()); 28*8fe483c9SAndreas Gohr $this->assertEquals('extension', $extension->getId()); 29*8fe483c9SAndreas Gohr $this->assertEquals('`extension`', $extension->getId(true)); 30*8fe483c9SAndreas Gohr $this->assertEquals(DOKU_INC.'lib/plugins/extension', $extension->getCurrentDir()); 31*8fe483c9SAndreas Gohr $this->assertEquals(DOKU_INC.'lib/plugins/extension', $extension->getInstallDir()); 32*8fe483c9SAndreas Gohr $this->assertEquals('Extension Manager', $extension->getDisplayName()); 33*8fe483c9SAndreas Gohr $this->assertEquals('Andreas Gohr', $extension->getAuthor()); 34*8fe483c9SAndreas Gohr $this->assertEquals('andi@splitbrain.org', $extension->getEmail()); 35*8fe483c9SAndreas Gohr $this->assertEquals(md5('andi@splitbrain.org'), $extension->getEmailID()); 36*8fe483c9SAndreas Gohr $this->assertStringContainsString('plugins', $extension->getDescription()); 37*8fe483c9SAndreas Gohr $this->assertEquals('https://www.dokuwiki.org/plugin:extension', $extension->getURL()); 38*8fe483c9SAndreas Gohr $this->assertRegExp('/\d\d\d\d-\d\d-\d\d/',$extension->getInstalledVersion()); 39*8fe483c9SAndreas Gohr $this->assertContains('Admin', $extension->getComponentTypes()); 40*8fe483c9SAndreas Gohr $this->assertIsArray($extension->getDependencyList()); 41*8fe483c9SAndreas Gohr $this->assertEmpty($extension->getDependencyList()); 42*8fe483c9SAndreas Gohr $this->assertEmpty($extension->getMinimumPHPVersion()); 43*8fe483c9SAndreas Gohr $this->assertEmpty($extension->getMaximumPHPVersion()); 44*8fe483c9SAndreas Gohr $this->assertTrue($extension->isInstalled()); 45*8fe483c9SAndreas Gohr $this->assertFalse($extension->isGitControlled()); 46*8fe483c9SAndreas Gohr $this->assertTrue($extension->isBundled()); 47*8fe483c9SAndreas Gohr $this->assertFalse($extension->isProtected()); 48*8fe483c9SAndreas Gohr $this->assertFalse($extension->isInWrongFolder()); 49*8fe483c9SAndreas Gohr $this->assertTrue($extension->isEnabled()); 50*8fe483c9SAndreas Gohr $this->assertFalse($extension->hasChangedURL()); 51*8fe483c9SAndreas Gohr $this->assertFalse($extension->isUpdateAvailable()); 52*8fe483c9SAndreas Gohr } 53*8fe483c9SAndreas Gohr 54*8fe483c9SAndreas Gohr /** 55*8fe483c9SAndreas Gohr * Run checks against the dokuwiki template 56*8fe483c9SAndreas Gohr */ 57*8fe483c9SAndreas Gohr public function testDokuWikiTemplate() 58*8fe483c9SAndreas Gohr { 59*8fe483c9SAndreas Gohr $extension = Extension::createFromDirectory(__DIR__.'/../../../tpl/dokuwiki/'); 60*8fe483c9SAndreas Gohr 61*8fe483c9SAndreas Gohr $this->assertTrue($extension->isTemplate()); 62*8fe483c9SAndreas Gohr $this->assertEquals('template', $extension->getType()); 63*8fe483c9SAndreas Gohr $this->assertEquals('dokuwiki', $extension->getBase()); 64*8fe483c9SAndreas Gohr $this->assertEquals('template:dokuwiki', $extension->getId()); 65*8fe483c9SAndreas Gohr $this->assertEquals('`template:dokuwiki`', $extension->getId(true)); 66*8fe483c9SAndreas Gohr $this->assertEquals(DOKU_INC.'lib/tpl/dokuwiki', $extension->getCurrentDir()); 67*8fe483c9SAndreas Gohr $this->assertEquals(DOKU_INC.'lib/tpl/dokuwiki', $extension->getInstallDir()); 68*8fe483c9SAndreas Gohr $this->assertEquals('DokuWiki Template', $extension->getDisplayName()); 69*8fe483c9SAndreas Gohr $this->assertEquals('Anika Henke', $extension->getAuthor()); 70*8fe483c9SAndreas Gohr $this->assertEquals('anika@selfthinker.org', $extension->getEmail()); 71*8fe483c9SAndreas Gohr $this->assertEquals(md5('anika@selfthinker.org'), $extension->getEmailID()); 72*8fe483c9SAndreas Gohr $this->assertStringContainsString('default template', $extension->getDescription()); 73*8fe483c9SAndreas Gohr $this->assertEquals('https://www.dokuwiki.org/template:dokuwiki', $extension->getURL()); 74*8fe483c9SAndreas Gohr $this->assertRegExp('/\d\d\d\d-\d\d-\d\d/',$extension->getInstalledVersion()); 75*8fe483c9SAndreas Gohr $this->assertContains('Template', $extension->getComponentTypes()); 76*8fe483c9SAndreas Gohr $this->assertIsArray($extension->getDependencyList()); 77*8fe483c9SAndreas Gohr $this->assertEmpty($extension->getDependencyList()); 78*8fe483c9SAndreas Gohr $this->assertEmpty($extension->getMinimumPHPVersion()); 79*8fe483c9SAndreas Gohr $this->assertEmpty($extension->getMaximumPHPVersion()); 80*8fe483c9SAndreas Gohr $this->assertTrue($extension->isInstalled()); 81*8fe483c9SAndreas Gohr $this->assertFalse($extension->isGitControlled()); 82*8fe483c9SAndreas Gohr $this->assertTrue($extension->isBundled()); 83*8fe483c9SAndreas Gohr $this->assertFalse($extension->isProtected()); 84*8fe483c9SAndreas Gohr $this->assertFalse($extension->isInWrongFolder()); 85*8fe483c9SAndreas Gohr $this->assertTrue($extension->isEnabled()); 86*8fe483c9SAndreas Gohr $this->assertFalse($extension->hasChangedURL()); 87*8fe483c9SAndreas Gohr $this->assertFalse($extension->isUpdateAvailable()); 88cf2dcf1bSAndreas Gohr } 89cf2dcf1bSAndreas Gohr} 90