Completed
Pull Request — master (#16)
by Nikola
01:29
created

AspectCacheWarmerTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 8 2
A itWarmsUpCache() 0 12 1
1
<?php
2
/**
3
 * Go! AOP framework
4
 *
5
 * @copyright Copyright 2015, Lisachenko Alexander <[email protected]>
6
 *
7
 * This source file is subject to the license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace Go\Symfony\GoAopBundle\Tests\CacheWarmer;
12
13
use Go\Aop\Proxy;
14
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
15
use Symfony\Component\Filesystem\Filesystem;
16
use Go\Symfony\GoAopBundle\Tests\TestProject\Application\Main;
17
18
/**
19
 * Class AspectCacheWarmerTest
20
 */
21
class AspectCacheWarmerTest extends WebTestCase
22
{
23
    protected $cacheDir = __DIR__.'/../Fixtures/project/var/cache/test';
24
25
    public function setUp()
26
    {
27
        $filesystem = new Filesystem();
28
29
        if ($filesystem->exists($this->cacheDir)) {
30
            $filesystem->remove($this->cacheDir);
31
        }
32
    }
33
34
    /**
35
     * @test
36
     * @runInSeparateProcess
37
     */
38
    public function itWarmsUpCache()
39
    {
40
        $this->assertFalse(file_exists($this->cacheDir));
41
42
        self::bootKernel();
43
44
        $this->assertTrue(file_exists($this->cacheDir.'/aspect/_proxies/Application/Main.php'));
45
        $this->assertTrue(file_exists($this->cacheDir.'/aspect/Application/Main.php'));
46
47
        $reflection = new \ReflectionClass(Main::class);
48
        $this->assertTrue($reflection->implementsInterface(Proxy::class));
49
    }
50
}
51