-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
tests/end-to-end/event/_files/ExpectedAndUnexpectedAssertionsTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of PHPUnit. | ||
* | ||
* (c) Sebastian Bergmann <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace PHPUnit\TestFixture\Event; | ||
|
||
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class ExpectedAndUnexpectedAssertionsTest extends TestCase | ||
{ | ||
#[DoesNotPerformAssertions] | ||
public function testOne(): void | ||
{ | ||
} | ||
|
||
public function testTwo(): void | ||
{ | ||
$this->expectNotToPerformAssertions(); | ||
} | ||
|
||
#[DoesNotPerformAssertions] | ||
public function testThree(): void | ||
{ | ||
$this->assertTrue(true); | ||
} | ||
|
||
public function testFour(): void | ||
{ | ||
$this->expectNotToPerformAssertions(); | ||
|
||
$this->assertTrue(true); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
tests/end-to-end/event/expected-and-unexpected-assertions.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--TEST-- | ||
The right events are emitted in the right order when a test that is not expected to perform assertions does not perform assertions and when a test that is not expected to perform assertions does perform assertions | ||
--FILE-- | ||
<?php declare(strict_types=1); | ||
$_SERVER['argv'][] = '--do-not-cache-result'; | ||
$_SERVER['argv'][] = '--no-configuration'; | ||
$_SERVER['argv'][] = '--debug'; | ||
$_SERVER['argv'][] = __DIR__ . '/_files/ExpectedAndUnexpectedAssertionsTest.php'; | ||
|
||
require __DIR__ . '/../../bootstrap.php'; | ||
|
||
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']); | ||
--EXPECTF-- | ||
PHPUnit Started (PHPUnit %s using %s) | ||
Test Runner Configured | ||
Event Facade Sealed | ||
Test Suite Loaded (4 tests) | ||
Test Runner Started | ||
Test Suite Sorted | ||
Test Runner Execution Started (4 tests) | ||
Test Suite Started (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest, 4 tests) | ||
Test Preparation Started (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest::testOne) | ||
Test Prepared (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest::testOne) | ||
Test Passed (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest::testOne) | ||
Test Finished (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest::testOne) | ||
Test Preparation Started (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest::testTwo) | ||
Test Prepared (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest::testTwo) | ||
Test Passed (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest::testTwo) | ||
Test Finished (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest::testTwo) | ||
Test Preparation Started (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest::testThree) | ||
Test Prepared (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest::testThree) | ||
Test Passed (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest::testThree) | ||
Test Considered Risky (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest::testThree) | ||
This test is not expected to perform assertions but performed 1 assertion | ||
Test Finished (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest::testThree) | ||
Test Preparation Started (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest::testFour) | ||
Test Prepared (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest::testFour) | ||
Test Passed (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest::testFour) | ||
Test Considered Risky (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest::testFour) | ||
This test is not expected to perform assertions but performed 1 assertion | ||
Test Finished (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest::testFour) | ||
Test Suite Finished (PHPUnit\TestFixture\Event\ExpectedAndUnexpectedAssertionsTest, 4 tests) | ||
Test Runner Execution Finished | ||
Test Runner Finished | ||
PHPUnit Finished (Shell Exit Code: 0) |