mirror of
https://github.com/marcostoll/FF.git
synced 2025-04-20 23:22:00 +02:00
[FEATURE] add phpunit code coverage
This commit is contained in:
parent
0901216702
commit
9abde34a32
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
.idea/
|
||||
|
||||
/build
|
||||
/logs
|
||||
/vendor
|
||||
composer.lock
|
2
bin/phpdox.bat
Normal file
2
bin/phpdox.bat
Normal file
@ -0,0 +1,2 @@
|
||||
@ECHO OFF
|
||||
vendor\bin\phpdox -f phpdox.xml
|
3
bin/phpunit-codecoverage.bat
Normal file
3
bin/phpunit-codecoverage.bat
Normal file
@ -0,0 +1,3 @@
|
||||
@ECHO OFF
|
||||
SET PROJECT_HOME=C:\dev\ffe\fastforward\FF
|
||||
php -dxdebug.coverage_enable=1 %PROJECT_HOME%\vendor\phpunit\phpunit\phpunit --coverage-xml %PROJECT_HOME%\logs\phpunit --configuration %PROJECT_HOME%\tests\testsuite.xml --teamcity
|
@ -103,11 +103,10 @@
|
||||
<!-- <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>
|
||||
-->
|
||||
|
||||
</enrich>
|
||||
|
||||
|
@ -27,7 +27,7 @@ class RenderedDocument
|
||||
*/
|
||||
public function __construct(string $contents)
|
||||
{
|
||||
$this->contents = $contents;
|
||||
$this->setContents($contents);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,6 +45,20 @@ namespace FF\Tests\Factories {
|
||||
ServicesFactory::getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the namesake method/feature
|
||||
*/
|
||||
public function testClearInstance()
|
||||
{
|
||||
$this->expectException(ConfigurationException::class);
|
||||
|
||||
$instance = new ServicesFactory(self::TEST_OPTIONS);
|
||||
$instance->getClassLocator()->prependNamespaces('FF\Tests');
|
||||
ServicesFactory::setInstance($instance);
|
||||
ServicesFactory::clearInstance();
|
||||
ServicesFactory::getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the namesake method/feature
|
||||
*/
|
||||
|
@ -114,6 +114,17 @@ namespace FF\Tests\Services\Dispatching {
|
||||
new Dispatcher();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the namesake method/feature
|
||||
*/
|
||||
public function testSetGetFireEvents()
|
||||
{
|
||||
$value = false;
|
||||
$same = $this->uut->setFireEvents($value);
|
||||
$this->assertSame($this->uut, $same);
|
||||
$this->assertSame($value, $this->uut->getFireEvents());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the namesake method/feature
|
||||
*/
|
||||
|
@ -86,9 +86,14 @@ class ExceptionHandlerTest extends TestCase
|
||||
|
||||
/**
|
||||
* @param Exception $event
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function listener(Exception $event)
|
||||
{
|
||||
if ($event->getException()->getMessage() == 'cascade') {
|
||||
throw new \Exception('cascade failure');
|
||||
}
|
||||
|
||||
self::$lastEvent = $event;
|
||||
}
|
||||
|
||||
@ -141,6 +146,18 @@ class ExceptionHandlerTest extends TestCase
|
||||
$this->assertSame($e, self::$lastEvent->getException());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the namesake method/feature
|
||||
*/
|
||||
public function testTriggerExceptionCascade()
|
||||
{
|
||||
$e = new \Exception('cascade');
|
||||
$this->uut->register()
|
||||
->onException($e);
|
||||
|
||||
$this->assertNull(self::$lastEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the namesake method/feature
|
||||
*/
|
||||
|
@ -5,4 +5,9 @@
|
||||
<directory>./</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">../src/</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
Loading…
x
Reference in New Issue
Block a user