Passed
Push — main ( f4a49b...9bd4e4 )
by Siad
08:17
created

PhpCSTaskTest::testFileSetInPhpCs1OutfileSet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
 *
16
 * This software consists of voluntary contributions made by many individuals
17
 * and is licensed under the LGPL. For more information please see
18
 * <http://phing.info>.
19
 */
20
21
namespace Phing\Test\Task\Optional;
22
23
use Phing\Exception\BuildException;
24
use Phing\Test\Support\BuildFileTest;
25
26
/**
27
 * Tests for PhpCSTask.
28
 *
29
 * @author Siad Ardroumli <[email protected]>
30
 */
31
class PhpCSTaskTest extends BuildFileTest
32
{
33
    public function setUp(): void
34
    {
35
        if (class_exists('PHP_CodeSniffer')) {
36
            $this->markTestSkipped('PHP CodeSniffer 2 package available.');
37
        }
38
        $this->configureProject(PHING_TEST_BASE . '/etc/tasks/ext/phpcs/build.xml');
39
    }
40
41
    public function testPhpCs(): void
42
    {
43
        $this->executeTarget(__FUNCTION__);
44
        $this->assertInLogs('Missing');
45
    }
46
47
    public function testMissingFileSetAndFilePhpCs1(): void
48
    {
49
        $this->expectException(BuildException::class);
50
        $this->executeTarget(__FUNCTION__);
51
    }
52
53
    public function testFileSetInPhpCs1(): void
54
    {
55
        $this->expectNotToPerformAssertions();
56
        $this->executeTarget(__FUNCTION__);
57
    }
58
59
    public function testFileSetInPhpCs1OutfileSet(): void
60
    {
61
        $this->executeTarget(__FUNCTION__);
62
        $this->assertInLogs('Outfile set to /dev/null');
63
    }
64
65
    public function testFileSetInPhpCs1FormatSet(): void
66
    {
67
        $this->executeTarget(__FUNCTION__);
68
        $this->assertInLogs('Format set to checkstyle');
69
    }
70
}
71