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

ApcuExtensionTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 25
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 2
A _getCacheDriver() 0 4 1
A testApcuExtension() 0 10 2
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
}