Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions fixtures/NoProphecy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Prophecy\PhpUnit\Tests\Fixtures;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;

class NoProphecy extends TestCase
{
use ProphecyTrait;

public function testMethod()
{
// to avoid warnings/risky status
$this->assertTrue(true);
}
}
14 changes: 14 additions & 0 deletions tests/ProphecyTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use PHPUnit\Runner\BaseTestRunner;
use Prophecy\PhpUnit\Tests\Fixtures\Error;
use Prophecy\PhpUnit\Tests\Fixtures\MockFailure;
use Prophecy\PhpUnit\Tests\Fixtures\NoProphecy;
use Prophecy\PhpUnit\Tests\Fixtures\SpyFailure;
use Prophecy\PhpUnit\Tests\Fixtures\Success;

Expand Down Expand Up @@ -73,4 +74,17 @@ public function testDoublingError(): void
$this->assertSame(0, $test->getNumAssertions());
$this->assertSame(BaseTestRunner::STATUS_ERROR, $test->getStatus());
}

public function testNoProphecy(): void
{
$test = new NoProphecy('testMethod');

$result = $test->run();

$this->assertSame(0, $result->errorCount());
$this->assertSame(0, $result->failureCount());
$this->assertCount(1, $result);
$this->assertSame(1, $test->getNumAssertions());
$this->assertSame(BaseTestRunner::STATUS_PASSED, $test->getStatus());
}
}