xref: /dokuwiki/lib/plugins/extension/_test/LocalTest.php (revision 8fe483c9dd38f0052abe729cc74057c9cdf54ad3)
1*8fe483c9SAndreas Gohr<?php
2*8fe483c9SAndreas Gohr
3*8fe483c9SAndreas Gohrnamespace dokuwiki\plugin\extension\test;
4*8fe483c9SAndreas Gohr
5*8fe483c9SAndreas Gohruse dokuwiki\plugin\extension\Extension;
6*8fe483c9SAndreas Gohruse dokuwiki\plugin\extension\Local;
7*8fe483c9SAndreas Gohruse DokuWikiTest;
8*8fe483c9SAndreas Gohr
9*8fe483c9SAndreas Gohr/**
10*8fe483c9SAndreas Gohr * Tests for the Local class
11*8fe483c9SAndreas Gohr *
12*8fe483c9SAndreas Gohr * @group plugin_extension
13*8fe483c9SAndreas Gohr * @group plugins
14*8fe483c9SAndreas Gohr */
15*8fe483c9SAndreas Gohrclass LocalTest extends DokuWikiTest
16*8fe483c9SAndreas Gohr{
17*8fe483c9SAndreas Gohr
18*8fe483c9SAndreas Gohr    public function testGetTemplates()
19*8fe483c9SAndreas Gohr    {
20*8fe483c9SAndreas Gohr        $local = new Local();
21*8fe483c9SAndreas Gohr        $templates = $local->getTemplates();
22*8fe483c9SAndreas Gohr
23*8fe483c9SAndreas Gohr        $this->assertIsArray($templates);
24*8fe483c9SAndreas Gohr        foreach ($templates as $template) {
25*8fe483c9SAndreas Gohr            $this->assertInstanceOf(Extension::class, $template);
26*8fe483c9SAndreas Gohr            $this->assertTrue($template->isTemplate());
27*8fe483c9SAndreas Gohr        }
28*8fe483c9SAndreas Gohr
29*8fe483c9SAndreas Gohr        $this->assertArrayHasKey('template:dokuwiki', $templates);
30*8fe483c9SAndreas Gohr    }
31*8fe483c9SAndreas Gohr
32*8fe483c9SAndreas Gohr    public function testGetPlugins()
33*8fe483c9SAndreas Gohr    {
34*8fe483c9SAndreas Gohr        $local = new Local();
35*8fe483c9SAndreas Gohr        $plugins = $local->getPlugins();
36*8fe483c9SAndreas Gohr
37*8fe483c9SAndreas Gohr        $this->assertIsArray($plugins);
38*8fe483c9SAndreas Gohr        foreach ($plugins as $plugin) {
39*8fe483c9SAndreas Gohr            $this->assertInstanceOf(Extension::class, $plugin);
40*8fe483c9SAndreas Gohr            $this->assertFalse($plugin->isTemplate());
41*8fe483c9SAndreas Gohr        }
42*8fe483c9SAndreas Gohr
43*8fe483c9SAndreas Gohr        $this->assertArrayHasKey('extension', $plugins);
44*8fe483c9SAndreas Gohr    }
45*8fe483c9SAndreas Gohr
46*8fe483c9SAndreas Gohr    public function testGetExtensions()
47*8fe483c9SAndreas Gohr    {
48*8fe483c9SAndreas Gohr        $local = new Local();
49*8fe483c9SAndreas Gohr        $extensions = $local->getExtensions();
50*8fe483c9SAndreas Gohr
51*8fe483c9SAndreas Gohr        $this->assertIsArray($extensions);
52*8fe483c9SAndreas Gohr        foreach ($extensions as $extension) {
53*8fe483c9SAndreas Gohr            $this->assertInstanceOf(Extension::class, $extension);
54*8fe483c9SAndreas Gohr        }
55*8fe483c9SAndreas Gohr
56*8fe483c9SAndreas Gohr        $this->assertArrayHasKey('template:dokuwiki', $extensions);
57*8fe483c9SAndreas Gohr        $this->assertArrayHasKey('extension', $extensions);
58*8fe483c9SAndreas Gohr    }
59*8fe483c9SAndreas Gohr}
60