File: ConsoleTest.php

package info (click to toggle)
phpmyadmin 4%3A5.2.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 142,056 kB
  • sloc: javascript: 228,532; php: 167,409; xml: 17,850; sql: 504; sh: 278; makefile: 208; python: 205
file content (39 lines) | stat: -rw-r--r-- 933 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
<?php

declare(strict_types=1);

namespace PhpMyAdmin\Tests;

use PhpMyAdmin\Console;
use ReflectionProperty;

use const PHP_VERSION_ID;

/**
 * @covers \PhpMyAdmin\Console
 */
#[\PHPUnit\Framework\Attributes\CoversClass(\PhpMyAdmin\Console::class)]
class ConsoleTest extends AbstractTestCase
{
    public function testGetScripts(): void
    {
        $console = new Console();
        self::assertSame(['console.js'], $console->getScripts());
    }

    public function testSetAjax(): void
    {
        $isAjax = new ReflectionProperty(Console::class, 'isAjax');
        if (PHP_VERSION_ID < 80100) {
            $isAjax->setAccessible(true);
        }

        $console = new Console();

        self::assertFalse($isAjax->getValue($console));
        $console->setAjax(true);
        self::assertTrue($isAjax->getValue($console));
        $console->setAjax(false);
        self::assertFalse($isAjax->getValue($console));
    }
}