[FEATURE] add phpunit code coverage

This commit is contained in:
Marco Stoll 2019-06-25 14:55:08 +02:00
parent 38b89f7da8
commit cc37b305b8
6 changed files with 44 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
.idea/
/build
/logs
/vendor
composer.lock

View File

@ -0,0 +1,3 @@
@ECHO OFF
SET PROJECT_HOME=C:\dev\ffe\fastforward\DataStructures
php -dxdebug.coverage_enable=1 %PROJECT_HOME%\vendor\phpunit\phpunit\phpunit --coverage-xml %PROJECT_HOME%\logs\phpunit --configuration %PROJECT_HOME%\tests\testsuite.xml --teamcity

View File

@ -103,9 +103,9 @@
<!-- <coverage path="" /> -->
<!-- @path - the directory where the xml code coverage report can be found -->
<!--</source>-->
<!--
<source type="phpunit">
<filter directory="${phpDox.project.source}" />
<coverage path="../logs/phpunit" />
</source>
-->

View File

@ -90,7 +90,17 @@ class OrderedCollectionTest extends TestCase
/**
* Tests the namesake method/feature
*/
public function testSetPush()
public function testSetReplace()
{
$newValue = 'foo';
$this->uut->setItems(self::SOME_ITEMS)->set(3, $newValue);
$this->assertEquals($newValue, $this->uut[3]);
}
/**
* Tests the namesake method/feature
*/
public function testSetAppend()
{
$newItem = '5th';
$this->uut->setItems(self::SOME_ITEMS)->set(42, $newItem);
@ -198,6 +208,16 @@ class OrderedCollectionTest extends TestCase
}
/**
* Tests the namesake method/feature
*/
public function testPop()
{
$item = $this->uut->setItems(self::SOME_ITEMS)->pop();
$this->assertEquals(self::SOME_ITEMS[3], $item);
$this->assertEquals(count(self::SOME_ITEMS) - 1, count($this->uut));
}
/**
* Tests the namesake method/feature
*/

View File

@ -283,4 +283,17 @@ class RecordTest extends TestCase
$this->uut->get_something();
}
/**
* Tests the namesake method/feature
*/
public function testIteratorAggregate()
{
$this->uut->setData(self::SOME_DATA);
foreach ($this->uut as $field => $value) {
$this->assertArrayHasKey($field, self::SOME_DATA);
$this->assertEquals(self::SOME_DATA[$field], $value);
}
}
}

View File

@ -5,4 +5,9 @@
<directory>./</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">../src/</directory>
</whitelist>
</filter>
</phpunit>