File: ApcuDisabledTest.php

package info (click to toggle)
phpmyadmin-motranslator 5.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,928 kB
  • sloc: php: 1,760; makefile: 9
file content (27 lines) | stat: -rw-r--r-- 768 bytes parent folder | download | duplicates (3)
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
<?php

declare(strict_types=1);

namespace PhpMyAdmin\MoTranslator\Tests\Cache;

use PhpMyAdmin\MoTranslator\Cache\ApcuCache;
use PhpMyAdmin\MoTranslator\CacheException;
use PhpMyAdmin\MoTranslator\MoParser;
use PHPUnit\Framework\TestCase;

use function apcu_enabled;
use function function_exists;

final class ApcuDisabledTest extends TestCase
{
    public function testConstructorApcuNotEnabledThrowsException(): void
    {
        if (function_exists('apcu_enabled') && apcu_enabled()) {
            $this->markTestSkipped('ext-apcu is enabled');
        }

        $this->expectException(CacheException::class);
        $this->expectExceptionMessage('ACPu extension must be installed and enabled');
        new ApcuCache(new MoParser(null), 'foo', 'bar');
    }
}