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

NoVcsTest::testSetup()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
nc 1
cc 1
eloc 10
nop 0
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