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{ 168fe483c9SAndreas Gohr protected $pluginsEnabled = ['extension']; 17cf2dcf1bSAndreas Gohr 188fe483c9SAndreas Gohr /** 198fe483c9SAndreas Gohr * Run checks against the extension plugin itself 208fe483c9SAndreas Gohr */ 218fe483c9SAndreas Gohr public function testSelf() 22cf2dcf1bSAndreas Gohr { 23cf2dcf1bSAndreas Gohr $extension = Extension::createFromDirectory(__DIR__.'/../'); 24cf2dcf1bSAndreas Gohr 25cf2dcf1bSAndreas Gohr $this->assertFalse($extension->isTemplate()); 268fe483c9SAndreas Gohr $this->assertEquals('plugin', $extension->getType()); 27cf2dcf1bSAndreas Gohr $this->assertEquals('extension', $extension->getBase()); 288fe483c9SAndreas Gohr $this->assertEquals('extension', $extension->getId()); 298fe483c9SAndreas Gohr $this->assertEquals('`extension`', $extension->getId(true)); 308fe483c9SAndreas Gohr $this->assertEquals(DOKU_INC.'lib/plugins/extension', $extension->getCurrentDir()); 318fe483c9SAndreas Gohr $this->assertEquals(DOKU_INC.'lib/plugins/extension', $extension->getInstallDir()); 328fe483c9SAndreas Gohr $this->assertEquals('Extension Manager', $extension->getDisplayName()); 338fe483c9SAndreas Gohr $this->assertEquals('Andreas Gohr', $extension->getAuthor()); 348fe483c9SAndreas Gohr $this->assertEquals('andi@splitbrain.org', $extension->getEmail()); 358fe483c9SAndreas Gohr $this->assertEquals(md5('andi@splitbrain.org'), $extension->getEmailID()); 368fe483c9SAndreas Gohr $this->assertStringContainsString('plugins', $extension->getDescription()); 378fe483c9SAndreas Gohr $this->assertEquals('https://www.dokuwiki.org/plugin:extension', $extension->getURL()); 38*ea9e07cfSAndreas Gohr $this->assertMatchesRegularExpression('/\d\d\d\d-\d\d-\d\d/',$extension->getInstalledVersion()); 398fe483c9SAndreas Gohr $this->assertContains('Admin', $extension->getComponentTypes()); 408fe483c9SAndreas Gohr $this->assertIsArray($extension->getDependencyList()); 418fe483c9SAndreas Gohr $this->assertEmpty($extension->getDependencyList()); 428fe483c9SAndreas Gohr $this->assertEmpty($extension->getMinimumPHPVersion()); 438fe483c9SAndreas Gohr $this->assertEmpty($extension->getMaximumPHPVersion()); 448fe483c9SAndreas Gohr $this->assertTrue($extension->isInstalled()); 458fe483c9SAndreas Gohr $this->assertFalse($extension->isGitControlled()); 468fe483c9SAndreas Gohr $this->assertTrue($extension->isBundled()); 478fe483c9SAndreas Gohr $this->assertFalse($extension->isProtected()); 488fe483c9SAndreas Gohr $this->assertFalse($extension->isInWrongFolder()); 498fe483c9SAndreas Gohr $this->assertTrue($extension->isEnabled()); 508fe483c9SAndreas Gohr $this->assertFalse($extension->hasChangedURL()); 518fe483c9SAndreas Gohr $this->assertFalse($extension->isUpdateAvailable()); 528fe483c9SAndreas Gohr } 538fe483c9SAndreas Gohr 548fe483c9SAndreas Gohr /** 558fe483c9SAndreas Gohr * Run checks against the dokuwiki template 568fe483c9SAndreas Gohr */ 578fe483c9SAndreas Gohr public function testDokuWikiTemplate() 588fe483c9SAndreas Gohr { 598fe483c9SAndreas Gohr $extension = Extension::createFromDirectory(__DIR__.'/../../../tpl/dokuwiki/'); 608fe483c9SAndreas Gohr 618fe483c9SAndreas Gohr $this->assertTrue($extension->isTemplate()); 628fe483c9SAndreas Gohr $this->assertEquals('template', $extension->getType()); 638fe483c9SAndreas Gohr $this->assertEquals('dokuwiki', $extension->getBase()); 648fe483c9SAndreas Gohr $this->assertEquals('template:dokuwiki', $extension->getId()); 658fe483c9SAndreas Gohr $this->assertEquals('`template:dokuwiki`', $extension->getId(true)); 668fe483c9SAndreas Gohr $this->assertEquals(DOKU_INC.'lib/tpl/dokuwiki', $extension->getCurrentDir()); 678fe483c9SAndreas Gohr $this->assertEquals(DOKU_INC.'lib/tpl/dokuwiki', $extension->getInstallDir()); 688fe483c9SAndreas Gohr $this->assertEquals('DokuWiki Template', $extension->getDisplayName()); 698fe483c9SAndreas Gohr $this->assertEquals('Anika Henke', $extension->getAuthor()); 708fe483c9SAndreas Gohr $this->assertEquals('anika@selfthinker.org', $extension->getEmail()); 718fe483c9SAndreas Gohr $this->assertEquals(md5('anika@selfthinker.org'), $extension->getEmailID()); 728fe483c9SAndreas Gohr $this->assertStringContainsString('default template', $extension->getDescription()); 738fe483c9SAndreas Gohr $this->assertEquals('https://www.dokuwiki.org/template:dokuwiki', $extension->getURL()); 74*ea9e07cfSAndreas Gohr $this->assertMatchesRegularExpression('/\d\d\d\d-\d\d-\d\d/',$extension->getInstalledVersion()); 758fe483c9SAndreas Gohr $this->assertContains('Template', $extension->getComponentTypes()); 768fe483c9SAndreas Gohr $this->assertIsArray($extension->getDependencyList()); 778fe483c9SAndreas Gohr $this->assertEmpty($extension->getDependencyList()); 788fe483c9SAndreas Gohr $this->assertEmpty($extension->getMinimumPHPVersion()); 798fe483c9SAndreas Gohr $this->assertEmpty($extension->getMaximumPHPVersion()); 808fe483c9SAndreas Gohr $this->assertTrue($extension->isInstalled()); 818fe483c9SAndreas Gohr $this->assertFalse($extension->isGitControlled()); 828fe483c9SAndreas Gohr $this->assertTrue($extension->isBundled()); 83*ea9e07cfSAndreas Gohr $this->assertTrue($extension->isProtected()); // protected because it's the current template 848fe483c9SAndreas Gohr $this->assertFalse($extension->isInWrongFolder()); 858fe483c9SAndreas Gohr $this->assertTrue($extension->isEnabled()); 868fe483c9SAndreas Gohr $this->assertFalse($extension->hasChangedURL()); 878fe483c9SAndreas Gohr $this->assertFalse($extension->isUpdateAvailable()); 88cf2dcf1bSAndreas Gohr } 89cf2dcf1bSAndreas Gohr} 90