File: PluginTest.php

package info (click to toggle)
phpmyadmin 4%3A5.2.1%2Bdfsg-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 131,332 kB
  • sloc: javascript: 212,681; php: 168,094; xml: 18,098; sql: 504; sh: 274; makefile: 205; python: 199
file content (77 lines) | stat: -rw-r--r-- 2,623 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php

declare(strict_types=1);

namespace PhpMyAdmin\Tests\Server;

use PhpMyAdmin\Server\Plugin;
use PhpMyAdmin\Tests\AbstractTestCase;

/**
 * @covers \PhpMyAdmin\Server\Plugin
 */
class PluginTest extends AbstractTestCase
{
    public function testFromState(): Plugin
    {
        $plugin = Plugin::fromState([
            'name' => 'BLACKHOLE',
            'version' => '1.0',
            'status' => 'ACTIVE',
            'type' => 'STORAGE ENGINE',
            'typeVersion' => '100316.0',
            'library' => 'ha_blackhole.so',
            'libraryVersion' => '1.13',
            'author' => 'MySQL AB',
            'description' => '/dev/null storage engine (anything you write to it disappears)',
            'license' => 'GPL',
            'loadOption' => 'ON',
            'maturity' => 'Stable',
            'authVersion' => '1.0',
        ]);

        $this->assertInstanceOf(Plugin::class, $plugin);
        $this->assertSame('BLACKHOLE', $plugin->getName());
        $this->assertSame('1.0', $plugin->getVersion());
        $this->assertSame('ACTIVE', $plugin->getStatus());
        $this->assertSame('STORAGE ENGINE', $plugin->getType());
        $this->assertSame('100316.0', $plugin->getTypeVersion());
        $this->assertSame('ha_blackhole.so', $plugin->getLibrary());
        $this->assertSame('1.13', $plugin->getLibraryVersion());
        $this->assertSame('MySQL AB', $plugin->getAuthor());
        $this->assertSame('GPL', $plugin->getLicense());
        $this->assertSame('ON', $plugin->getLoadOption());
        $this->assertSame('Stable', $plugin->getMaturity());
        $this->assertSame('1.0', $plugin->getAuthVersion());
        $this->assertSame(
            '/dev/null storage engine (anything you write to it disappears)',
            $plugin->getDescription()
        );

        return $plugin;
    }

    /**
     * @param Plugin $plugin Plugin object to be tested
     *
     * @depends testFromState
     */
    public function testToArray(Plugin $plugin): void
    {
        $this->assertSame([
            'name' => 'BLACKHOLE',
            'version' => '1.0',
            'status' => 'ACTIVE',
            'type' => 'STORAGE ENGINE',
            'type_version' => '100316.0',
            'library' => 'ha_blackhole.so',
            'library_version' => '1.13',
            'author' => 'MySQL AB',
            'description' => '/dev/null storage engine (anything you write to it disappears)',
            'license' => 'GPL',
            'load_option' => 'ON',
            'maturity' => 'Stable',
            'auth_version' => '1.0',
        ], $plugin->toArray());
    }
}