Completed
Push — master ( 68f30c...a95a96 )
by Christian
02:25
created

NoVcsTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 39
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testSetup() 0 14 1
A testGoodCode() 0 6 1
A testBadCode() 0 6 1
1
<?php
2
3
namespace uuf6429\ElderBrother;
4
5
class NoVcsTest extends BaseProjectTest
6
{
7
    const CUSTOM_EVENT = 'custom:test';
8
9
    public function testSetup()
10
    {
11
        $config = sprintf(
12
            '<%s return ["%s" => [%s]];',
13
            '?php',
14
            self::CUSTOM_EVENT,
15
            sprintf(
16
                'new %s( %s::get() )',
17
                Action\PhpLinter::class,
18
                Change\FullChangeSet::class
19
            )
20
        );
21
        $this->assertNotFalse(file_put_contents('.brother.php', $config));
22
    }
23
24
    /**
25
     * @depends testSetup
26
     */
27
    public function testGoodCode()
28
    {
29
        $this->assertNotFalse(file_put_contents('test1.php', '<?php echo "Hi!";'));
30
31
        $this->assertCommandSuccessful(self::getEbCmd() . 'run --no-progress -e ' . self::CUSTOM_EVENT);
32
    }
33
34
    /**
35
     * @depends testGoodCode
36
     */
37
    public function testBadCode()
38
    {
39
        $this->assertNotFalse(file_put_contents('test2.php', '<?php 3ch"o'));
40
41
        $this->assertCommand(self::getEbCmd() . 'run --no-progress -e ' . self::CUSTOM_EVENT, 1);
42
    }
43
}
44