1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the Gerrie package. |
4
|
|
|
* |
5
|
|
|
* (c) Andreas Grunwald <[email protected]> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Gerrie\Tests\Check; |
12
|
|
|
|
13
|
|
|
use Gerrie\Check\ConfigFileCheck; |
14
|
|
|
|
15
|
|
|
class ConfigFileCheckTest extends \PHPUnit_Framework_TestCase |
16
|
|
|
{ |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var \Gerrie\Check\CheckInterface |
20
|
|
|
*/ |
21
|
|
|
protected $checkInstance; |
22
|
|
|
|
23
|
|
|
public function setUp() |
24
|
|
|
{ |
25
|
|
|
$this->checkInstance = new ConfigFileCheck($this->getPathOfFixtureConfigFile()); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
public function tearDown() |
29
|
|
|
{ |
30
|
|
|
$this->checkInstance = null; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
protected function getPathOfFixtureConfigFile() |
34
|
|
|
{ |
35
|
|
|
$configFile = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; |
36
|
|
|
$configFile .= 'Fixture' . DIRECTORY_SEPARATOR . 'DummyConfig.yml'; |
37
|
|
|
$configFile = realpath($configFile); |
38
|
|
|
|
39
|
|
|
return $configFile; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function testCheck() |
43
|
|
|
{ |
44
|
|
|
$this->assertTrue($this->checkInstance->check()); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function testWithNotExistingConfigCheck() |
48
|
|
|
{ |
49
|
|
|
$checkInstance = new ConfigFileCheck(''); |
50
|
|
|
$this->assertFalse($checkInstance->check()); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function testGetFailureMessage() |
54
|
|
|
{ |
55
|
|
|
$this->checkInstance->check(); |
56
|
|
|
$this->assertInternalType('string', $this->checkInstance->getFailureMessage()); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function testGetSuccessMessage() |
60
|
|
|
{ |
61
|
|
|
$this->assertInternalType('string', $this->checkInstance->getSuccessMessage()); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function testIsOptional() |
65
|
|
|
{ |
66
|
|
|
$this->assertInternalType('bool', $this->checkInstance->isOptional()); |
67
|
|
|
} |
68
|
|
|
} |