Skip to content

Commit

Permalink
simplified code-coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
kilip committed Jun 11, 2019
1 parent 0977afa commit 89c8c5e
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 423 deletions.
34 changes: 0 additions & 34 deletions spec/Event/CoverageEventSpec.php

This file was deleted.

3 changes: 0 additions & 3 deletions spec/ExtensionSpec.php
Expand Up @@ -4,14 +4,11 @@

use Doyo\Bridge\CodeCoverage\Driver\Dummy;
use Doyo\PhpSpec\CodeCoverage\Extension;
use Doyo\PhpSpec\CodeCoverage\Report;
use PhpSpec\Console\ConsoleIO;
use PhpSpec\Exception\Example\SkippingException;
use PhpSpec\ObjectBehavior;
use PhpSpec\ServiceContainer;
use Prophecy\Argument;
use SebastianBergmann\CodeCoverage\Driver\Driver;
use SebastianBergmann\CodeCoverage\Filter;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down
41 changes: 11 additions & 30 deletions spec/Listener/CoverageListenerSpec.php
Expand Up @@ -2,13 +2,12 @@

namespace spec\Doyo\PhpSpec\CodeCoverage\Listener;

use Doyo\Bridge\CodeCoverage\CodeCoverage;
use Doyo\Bridge\CodeCoverage\ProcessorInterface;
use Doyo\Bridge\CodeCoverage\TestCase;
use Doyo\PhpSpec\CodeCoverage\Event\CoverageEvent;
use Doyo\PhpSpec\CodeCoverage\Listener\CoverageListener;
use Doyo\Symfony\Bridge\EventDispatcher\EventDispatcher;
use Doyo\Symfony\Bridge\EventDispatcher\EventDispatcherInterface;
use PhpSpec\Console\ConsoleIO;
use PhpSpec\Event\ExampleEvent;
use PhpSpec\Event\SuiteEvent;
use PhpSpec\Loader\Node\ExampleNode;
Expand All @@ -20,12 +19,10 @@
class CoverageListenerSpec extends ObjectBehavior
{
function let(
ProcessorInterface $processor,
EventDispatcher $dispatcher,
ConsoleIO $consoleIO
CodeCoverage $coverage
)
{
$this->beConstructedWith($dispatcher, $processor, $consoleIO, true);
$this->beConstructedWith($coverage);
}

function it_is_initializable()
Expand Down Expand Up @@ -65,56 +62,40 @@ function it_should_handle_before_example_event(
ExampleNode $example,
SpecificationNode $specification,
\ReflectionFunctionAbstract $reflection,
ProcessorInterface $processor
CodeCoverage $coverage
)
{
$this->decorateBeforeExampleEvent($exampleEvent, $example,$specification,$reflection);

$processor->setCurrentTestCase(Argument::type(TestCase::class))
->shouldBeCalledOnce();
$processor->start(Argument::type(TestCase::class))
$coverage->start(Argument::type(TestCase::class))
->shouldBeCalledOnce();

$this->beforeExample($exampleEvent);
}

public function it_should_handle_after_example_event(
ExampleEvent $exampleEvent,
ProcessorInterface $processor,
TestCase $testCase
CodeCoverage $coverage
)
{
$exampleEvent
->getResult()
->shouldBeCalledOnce()
->willReturn(0);

$testCase->setResult(0)
->shouldBeCalledOnce();

$processor
->getCurrentTestCase()
->willReturn($testCase)
;
$processor->stop(Argument::cetera())
->shouldBeCalledOnce();

$processor->addTestCase($testCase)
$coverage->setResult(0)
->shouldBeCalledOnce();

$coverage->stop()->shouldBeCalledOnce();
$this->afterExample($exampleEvent);
}

function it_should_handle_after_suite_event(
SuiteEvent $suiteEvent,
EventDispatcher $dispatcher
CodeCoverage $coverage
)
{
$dispatcher
->dispatch(Argument::type(CoverageEvent::class), CoverageEvent::REPORT)
->shouldBeCalledOnce();

$this->afterSuite($suiteEvent);
$coverage->complete()->shouldBeCalledOnce();
$this->afterSuite();
}

}
91 changes: 0 additions & 91 deletions spec/ReportSpec.php

This file was deleted.

15 changes: 0 additions & 15 deletions spec/TestReportProcessor.php

This file was deleted.

55 changes: 0 additions & 55 deletions src/Event/CoverageEvent.php

This file was deleted.

0 comments on commit 89c8c5e

Please sign in to comment.