Completed
Pull Request — master (#227)
by
unknown
05:50
created

ApcuExtensionTest::testApcuExtension()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 6
nc 2
nop 0
1
<?php
2
3
namespace Doctrine\Tests\Common\Cache;
4
5
use Doctrine\Common\Cache\ApcuCache;
6
use Doctrine\Common\Cache\CacheProvider;
7
8
/**
9
 * Tests if APCu extension is installed
10
 */
11
class ApcuExtensionTest extends CacheTest
12
{
13
    protected function setUp() : void
14
    {
15
        if (function_exists('apcu_fetch')) {
16
            $this->markTestSkipped('APCu is actually enabled');
17
        }
18
    }
19
20
    protected function _getCacheDriver() : CacheProvider
21
    {
22
        return new ApcuCache();
23
    }
24
25
    public function testApcuExtension() : void
26
    {
27
        if (! function_exists('apcu_fetch')) {
28
            $this->expectException(RuntimeException::ApcuCache);
29
30
            new ApcuCache();
31
        } else {
32
            $this->markTestSkipped('APCu is actually enabled');
33
        }
34
    }
35
}