Test Failed
Pull Request — master (#132)
by Alessandro
03:15
created

testGetFileFullPathWithPathDoesNotExistWillThrowException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
dl 8
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Tests\Unit\Configuration;
6
7
use Paraunit\Configuration\PHPUnitConfig;
8
use Tests\BaseUnitTestCase;
9
10
/**
11
 * Class PHPUnitConfigTest
12
 * @package Tests\Unit\Configuration
13
 */
14
class PHPUnitConfigTest extends BaseUnitTestCase
15
{
16
    public function testGetBaseDirectoryIsNotLazy()
17
    {
18
        $config = new PHPUnitConfig('');
19
20
        $directoryPath = $config->getBaseDirectory();
21
        $this->assertNotEquals('', $directoryPath);
22
        $this->assertNotEquals('/', $directoryPath);
23
        $this->assertNotEquals('C:\\', $directoryPath);
24
    }
25
26
    public function testGetFileFullPathWithDirAndUseDefaultFileName()
27
    {
28
        $dir = $this->getStubPath() . 'StubbedXMLConfigs';
29
        $configurationFile = $dir . DIRECTORY_SEPARATOR . 'phpunit.xml.dist';
30
31
        $config = new PHPUnitConfig($dir);
32
33
        $this->assertEquals($configurationFile, $config->getFileFullPath());
34
    }
35
36 View Code Duplication
    public function testGetFileFullPathWithFileDoesNotExistWillThrowException()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
37
    {
38
        $dir = $this->getStubPath() . 'PHPUnitJSONLogOutput';
39
        $this->expectException(\InvalidArgumentException::class);
40
        $this->expectExceptionMessage(PHPUnitConfig::DEFAULT_FILE_NAME . ' does not exist');
41
42
        new PHPUnitConfig($dir);
43
    }
44
45 View Code Duplication
    public function testGetFileFullPathWithPathDoesNotExistWillThrowException()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
46
    {
47
        $dir = $this->getStubPath() . 'foobar';
48
        $this->expectException(\InvalidArgumentException::class);
49
        $this->expectExceptionMessage('Config path/file provided is not valid');
50
51
        new PHPUnitConfig($dir);
52
    }
53
}
54