Passed
Pull Request — master (#42)
by
unknown
12:48
created

ApcuDisabledTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 10
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A testConstructorApcuNotEnabledThrowsException() 0 8 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpMyAdmin\MoTranslator\Tests\Cache;
6
7
use PhpMyAdmin\MoTranslator\Cache\ApcuCache;
8
use PhpMyAdmin\MoTranslator\CacheException;
9
use PhpMyAdmin\MoTranslator\MoParser;
10
use PHPUnit\Framework\TestCase;
11
12
use function apcu_enabled;
13
use function function_exists;
14
15
final class ApcuDisabledTest extends TestCase
16
{
17
    public function testConstructorApcuNotEnabledThrowsException(): void
18
    {
19
        if (function_exists('apcu_enabled') && apcu_enabled()) {
20
            $this->markTestSkipped('ext-apcu is enabled');
21
        }
22
23
        $this->expectException(CacheException::class);
24
        new ApcuCache(new MoParser(null), 'foo', 'bar');
25
    }
26
}
27