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

EnvironmentTest::testMutatorsAccessors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
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