Completed
Push — master ( 6a6e14...e9047f )
by Julián
02:21
created

EnvironmentTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 57
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 57
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUpBeforeClass() 0 4 1
A tearDownAfterClass() 0 4 1
A setUp() 0 4 1
A testIsNotActive() 0 12 1
A testIsActive() 0 12 1
1
<?php
2
/**
3
 * Effortless maintenance management (http://juliangut.com/janitor)
4
 *
5
 * @link https://github.com/juliangut/janitor for the canonical source repository
6
 *
7
 * @license https://github.com/juliangut/janitor/blob/master/LICENSE
8
 */
9
10
namespace Janitor\Test\Watcher;
11
12
use Janitor\Watcher\Environment;
13
14
/**
15
 * Class EnvironmentTest
16
 */
17
class EnvironmentTest extends \PHPUnit_Framework_TestCase
18
{
19
    /**
20
     * @var Environment
21
     */
22
    protected $watcher;
23
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public static function setUpBeforeClass()
28
    {
29
        putenv('JanitorMaintenance=On');
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public static function tearDownAfterClass()
36
    {
37
        putenv('JanitorMaintenance');
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function setUp()
44
    {
45
        $this->watcher = new Environment('JanitorMaintenance');
46
    }
47
48
    public function testIsNotActive()
49
    {
50
        putenv('JanitorMaintenance=On');
51
52
        self::assertTrue($this->watcher->isActive());
53
54
        $this->watcher->addVariable('JanitorMaintenance', 'Off');
55
56
        self::assertFalse($this->watcher->isActive());
57
58
        putenv('JanitorMaintenance');
59
    }
60
61
    public function testIsActive()
62
    {
63
        self::assertFalse($this->watcher->isActive());
64
65
        putenv('JanitorMaintenance=On');
66
67
        $this->watcher->addVariable('JanitorMaintenance', 'On');
68
69
        self::assertTrue($this->watcher->isActive());
70
71
        putenv('JanitorMaintenance');
72
    }
73
}
74