Passed
Push — master ( 0c03f0...e5b487 )
by Siad
10:58
created

CoverageMergeTest::testCoverage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 13
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 15
rs 9.8333
1
<?php
2
/**
3
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
 *
15
 * This software consists of voluntary contributions made by many individuals
16
 * and is licensed under the LGPL. For more information please see
17
 * <http://phing.info>.
18
 */
19
20
/**
21
 * @author Siad Ardroumli <[email protected]>
22
 * @package phing.tasks.ext
23
 */
24
class CoverageMergeTest extends BuildFileTest
25
{
26
    public function setUp(): void
27
    {
28
        if (!file_exists(PHING_TEST_BASE . "/etc/tasks/ext/coverage/workspace")) {
29
            mkdir(PHING_TEST_BASE . "/etc/tasks/ext/coverage/workspace");
30
        }
31
        $this->configureProject(PHING_TEST_BASE . "/etc/tasks/ext/coverage/build.xml");
32
    }
33
34
    public function tearDown(): void
35
    {
36
        $this->rmdir(PHING_TEST_BASE . "/etc/tasks/ext/coverage/workspace");
37
    }
38
39
    public function testCoverage(): void
40
    {
41
        $workspace = PHING_TEST_BASE . "/etc/tasks/ext/coverage/workspace";
42
        $this->executeTarget('collect');
43
        $this->assertFileExists($workspace . '/1/clover-coverage.xml');
44
        $this->assertFileExists($workspace . '/2/clover-coverage.xml');
45
        $this->assertFileExists($workspace . '/3/clover-coverage.xml');
46
        $this->assertFileExists($workspace . '/output.xml');
47
        $this->assertFileExists($workspace . '/test.db');
48
        $this->assertFileExists($workspace . '/test-results1.xml');
49
        $this->assertFileExists($workspace . '/test-results2.xml');
50
        $this->assertFileExists($workspace . '/test-results3.xml');
51
        $this->assertStringContainsString('Dummy1Test.php', file_get_contents($workspace . '/test.db'));
52
        $this->assertStringContainsString('Dummy2Test.php', file_get_contents($workspace . '/test.db'));
53
        $this->assertStringContainsString('Dummy3Test.php', file_get_contents($workspace . '/test.db'));
54
    }
55
}
56