Skip to content

Commit 880b24e

Browse files
authored
Merge pull request #42 from Jean85/increase-coverage
Add test to reach 100% coverage
2 parents a65425c + ecc08fc commit 880b24e

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

fixtures/NoProphecy.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Prophecy\PhpUnit\Tests\Fixtures;
4+
5+
use PHPUnit\Framework\TestCase;
6+
use Prophecy\PhpUnit\ProphecyTrait;
7+
8+
class NoProphecy extends TestCase
9+
{
10+
use ProphecyTrait;
11+
12+
public function testMethod()
13+
{
14+
// to avoid warnings/risky status
15+
$this->assertTrue(true);
16+
}
17+
}

tests/ProphecyTraitTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use PHPUnit\Runner\BaseTestRunner;
77
use Prophecy\PhpUnit\Tests\Fixtures\Error;
88
use Prophecy\PhpUnit\Tests\Fixtures\MockFailure;
9+
use Prophecy\PhpUnit\Tests\Fixtures\NoProphecy;
910
use Prophecy\PhpUnit\Tests\Fixtures\SpyFailure;
1011
use Prophecy\PhpUnit\Tests\Fixtures\Success;
1112

@@ -73,4 +74,17 @@ public function testDoublingError(): void
7374
$this->assertSame(0, $test->getNumAssertions());
7475
$this->assertSame(BaseTestRunner::STATUS_ERROR, $test->getStatus());
7576
}
77+
78+
public function testNoProphecy(): void
79+
{
80+
$test = new NoProphecy('testMethod');
81+
82+
$result = $test->run();
83+
84+
$this->assertSame(0, $result->errorCount());
85+
$this->assertSame(0, $result->failureCount());
86+
$this->assertCount(1, $result);
87+
$this->assertSame(1, $test->getNumAssertions());
88+
$this->assertSame(BaseTestRunner::STATUS_PASSED, $test->getStatus());
89+
}
7690
}

0 commit comments

Comments
 (0)