Completed
Push — master ( ecd5d7...f9662e )
by Julián
11:22
created

FileTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 5
c 4
b 0
f 0
lcom 1
cbo 2
dl 0
loc 52
rs 10
1
<?php
2
3
/*
4
 * janitor (http://juliangut.com/janitor).
5
 * Effortless maintenance management.
6
 *
7
 * @license BSD-3-Clause
8
 * @link https://github.com/juliangut/janitor
9
 * @author Julián Gutiérrez <[email protected]>
10
 */
11
12
namespace Janitor\Test\Watcher;
13
14
use Janitor\Watcher\File;
15
16
/**
17
 * Class FileTest.
18
 */
19
class FileTest extends \PHPUnit_Framework_TestCase
20
{
21
    /**
22
     * @var File
23
     */
24
    protected $watcher;
25
26
    /**
27
     * @var string
28
     */
29
    protected static $tmpFile;
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public static function setUpBeforeClass()
35
    {
36
        self::$tmpFile = sys_get_temp_dir() . '/maintenance';
37
38
        touch(self::$tmpFile);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public static function tearDownAfterClass()
45
    {
46
        unlink(self::$tmpFile);
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function setUp()
53
    {
54
        $this->watcher = new File(self::$tmpFile);
55
    }
56
57
    public function testIsActive()
58
    {
59
        self::assertTrue($this->watcher->isActive());
60
    }
61
62
    public function testIsNotActive()
63
    {
64
        unlink(self::$tmpFile);
65
66
        self::assertFalse($this->watcher->isActive());
67
68
        touch(self::$tmpFile);
69
    }
70
}
71