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

CacheWarmupCommandTest::itWarmsUpCache()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
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\Command;
12
13
use PHPUnit\Framework\TestCase;
14
use Symfony\Component\Filesystem\Filesystem;
15
use Symfony\Component\Process\Process;
16
17
/**
18
 * Class CacheWarmupCommandTest
19
 */
20
class CacheWarmupCommandTest extends TestCase
21
{
22
    protected $aspectCacheDir = __DIR__.'/../Fixtures/project/var/cache/test/aspect';
23
24
    public function setUp()
25
    {
26
        $filesystem = new Filesystem();
27
28
        if ($filesystem->exists($this->aspectCacheDir)) {
29
            $filesystem->remove($this->aspectCacheDir);
30
        }
31
    }
32
33
    /**
34
     * @test
35
     * @runInSeparateProcess
36
     */
37
    public function itWarmsUpCache()
38
    {
39
        $this->assertFalse(file_exists($this->aspectCacheDir));
40
41
        $process = new Process(sprintf('php %s cache:warmup:aop', realpath(__DIR__.'/../Fixtures/project/bin/console')));
42
        $process->run();
43
44
        $this->assertTrue($process->isSuccessful(), 'Unable to execute "cache:warmup:aop" command.');
45
46
        $this->assertTrue(file_exists($this->aspectCacheDir.'/_proxies/Application/Main.php'));
47
        $this->assertTrue(file_exists($this->aspectCacheDir.'/Application/Main.php'));
48
    }
49
}
50