Skip to content
This repository was archived by the owner on Feb 19, 2020. It is now read-only.

Commit b376df6

Browse files
committed
Test enhancement
1 parent 4988cd0 commit b376df6

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

.travis.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
language: php
22

33
php:
4-
- '7.0.17'
54
- '7.0'
6-
- '7.1.2'
5+
- '7.1'
6+
- '7.2'
77
- nightly
88

99
before_script:
1010
# In case of timeouts and build failures you may want to prepend 'travis_retry' to the following commands:
11-
- curl -s http://getcomposer.org/installer | php
12-
- php composer.phar install -n
11+
- composer install -n
1312

1413
# Explicitly use the phpunit from composer, not any system-wide found
15-
script:
14+
script:
1615
- php vendor/bin/phpunit --coverage-clover build/coverage/xml tests
1716

1817
after_success:

tests/Codacy/Coverage/Parser/CloverParserTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class CloverParserTest extends \PHPUnit\Framework\TestCase
88
public function testThrowsExceptionOnWrongPath()
99
{
1010
$this->expectException('InvalidArgumentException');
11+
$this->expectExceptionMessage('Unable to load the xml file. Make sure path is properly set. Using: "/home/foo/bar/baz/m.xml"');
1112
new CloverParser("/home/foo/bar/baz/m.xml");
1213
}
1314

tests/Codacy/Coverage/Parser/ParserTest.php

+10
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,14 @@ public function testParsersProduceSameResult()
3131

3232
$this->assertJsonStringEqualsJsonString($expectedJson, $xunitJson);
3333
}
34+
35+
public function testConstructorOnNullRootDir()
36+
{
37+
$parser = new PhpUnitXmlParser('tests/res/phpunitxml/index.xml');
38+
$parser->setDirOfFileXmls("tests/res/phpunitxml");
39+
$report = $parser->makeReport();
40+
41+
$this->assertEquals(69, $report->getTotal());
42+
$this->assertEquals(10, sizeof($report->getFileReports()));
43+
}
3444
}

tests/Codacy/Coverage/Parser/PhpUnitXmlParserTest.php

+8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ public function testThrowsExceptionOnWrongPath()
1212
new PhpUnitXmlParser("/home/foo/bar/baz/fake.xml");
1313
}
1414

15+
public function testMakeReportThrowsExceptionOnWrndPath()
16+
{
17+
$parser = new PhpUnitXmlParser('tests/res/phpunitxml/index.xml', '/home/jacke/Desktop/codacy-php');
18+
19+
$this->expectException('InvalidArgumentException');
20+
$parser->makeReport();
21+
}
22+
1523
/**
1624
* Testing against the clover coverage report 'tests/res/clover/clover.xml'
1725
* The test had been made in /home/jacke/Desktop/codacy-php so we need to pass this

0 commit comments

Comments
 (0)