-
-
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
1 parent
aab26da
commit aecdcb2
Showing
9 changed files
with
300 additions
and
1 deletion.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
tests/end-to-end/event/_files/AssertionFailureInPostConditionTest.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,27 @@ | ||
<?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\PostCondition; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class AssertionFailureInPostConditionTest extends TestCase | ||
{ | ||
#[PostCondition] | ||
public function postCondition(): void | ||
{ | ||
$this->assertTrue(false); | ||
} | ||
|
||
public function testOne(): void | ||
{ | ||
$this->assertTrue(true); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
tests/end-to-end/event/_files/AssertionFailureInPreConditionTest.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,27 @@ | ||
<?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\PreCondition; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class AssertionFailureInPreConditionTest extends TestCase | ||
{ | ||
#[PreCondition] | ||
public function preCondition(): void | ||
{ | ||
$this->assertTrue(false); | ||
} | ||
|
||
public function testOne(): void | ||
{ | ||
$this->assertTrue(true); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
tests/end-to-end/event/_files/AssertionFailureInSetUpTest.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,27 @@ | ||
<?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\Before; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class AssertionFailureInSetUpTest extends TestCase | ||
{ | ||
#[Before] | ||
public function beforeTest(): void | ||
{ | ||
$this->assertTrue(false); | ||
} | ||
|
||
public function testOne(): void | ||
{ | ||
$this->assertTrue(true); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
tests/end-to-end/event/_files/AssertionFailureInTearDownTest.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,27 @@ | ||
<?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\After; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class AssertionFailureInTearDownTest extends TestCase | ||
{ | ||
#[After] | ||
public function afterTest(): void | ||
{ | ||
$this->assertTrue(false); | ||
} | ||
|
||
public function testOne(): void | ||
{ | ||
$this->assertTrue(true); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
tests/end-to-end/event/assertion-failure-in-after-test-method.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,49 @@ | ||
--TEST-- | ||
The right events are emitted in the right order for a test that fails because of an assertion failure in a "after test" method | ||
--SKIPIF-- | ||
<?php declare(strict_types=1); | ||
if (DIRECTORY_SEPARATOR === '\\') { | ||
print "skip: this test does not work on Windows / GitHub Actions\n"; | ||
} | ||
--FILE-- | ||
<?php declare(strict_types=1); | ||
$traceFile = tempnam(sys_get_temp_dir(), __FILE__); | ||
|
||
$_SERVER['argv'][] = '--do-not-cache-result'; | ||
$_SERVER['argv'][] = '--no-configuration'; | ||
$_SERVER['argv'][] = '--no-output'; | ||
$_SERVER['argv'][] = '--log-events-text'; | ||
$_SERVER['argv'][] = $traceFile; | ||
$_SERVER['argv'][] = __DIR__ . '/_files/AssertionFailureInTearDownTest.php'; | ||
|
||
require __DIR__ . '/../../bootstrap.php'; | ||
|
||
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']); | ||
|
||
print file_get_contents($traceFile); | ||
|
||
unlink($traceFile); | ||
--EXPECTF-- | ||
PHPUnit Started (PHPUnit %s using %s) | ||
Test Runner Configured | ||
Test Suite Loaded (1 test) | ||
Event Facade Sealed | ||
Test Runner Started | ||
Test Suite Sorted | ||
Test Runner Execution Started (1 test) | ||
Test Suite Started (PHPUnit\TestFixture\Event\AssertionFailureInTearDownTest, 1 test) | ||
Test Preparation Started (PHPUnit\TestFixture\Event\AssertionFailureInTearDownTest::testOne) | ||
Test Prepared (PHPUnit\TestFixture\Event\AssertionFailureInTearDownTest::testOne) | ||
Assertion Succeeded (Constraint: is true, Value: true) | ||
Test Passed (PHPUnit\TestFixture\Event\AssertionFailureInTearDownTest::testOne) | ||
Assertion Failed (Constraint: is true, Value: false) | ||
After Test Method Called (PHPUnit\TestFixture\Event\AssertionFailureInTearDownTest::afterTest) | ||
After Test Method Finished: | ||
- PHPUnit\TestFixture\Event\AssertionFailureInTearDownTest::afterTest | ||
Test Failed (PHPUnit\TestFixture\Event\AssertionFailureInTearDownTest::testOne) | ||
Failed asserting that false is true. | ||
Test Finished (PHPUnit\TestFixture\Event\AssertionFailureInTearDownTest::testOne) | ||
Test Suite Finished (PHPUnit\TestFixture\Event\AssertionFailureInTearDownTest, 1 test) | ||
Test Runner Execution Finished | ||
Test Runner Finished | ||
PHPUnit Finished (Shell Exit Code: 1) |
47 changes: 47 additions & 0 deletions
47
tests/end-to-end/event/assertion-failure-in-before-test-method.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,47 @@ | ||
--TEST-- | ||
The right events are emitted in the right order for a test that fails because of an assertion failure in a "before test" method | ||
--SKIPIF-- | ||
<?php declare(strict_types=1); | ||
if (DIRECTORY_SEPARATOR === '\\') { | ||
print "skip: this test does not work on Windows / GitHub Actions\n"; | ||
} | ||
--FILE-- | ||
<?php declare(strict_types=1); | ||
$traceFile = tempnam(sys_get_temp_dir(), __FILE__); | ||
|
||
$_SERVER['argv'][] = '--do-not-cache-result'; | ||
$_SERVER['argv'][] = '--no-configuration'; | ||
$_SERVER['argv'][] = '--no-output'; | ||
$_SERVER['argv'][] = '--log-events-text'; | ||
$_SERVER['argv'][] = $traceFile; | ||
$_SERVER['argv'][] = __DIR__ . '/_files/AssertionFailureInSetUpTest.php'; | ||
|
||
require __DIR__ . '/../../bootstrap.php'; | ||
|
||
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']); | ||
|
||
print file_get_contents($traceFile); | ||
|
||
unlink($traceFile); | ||
--EXPECTF-- | ||
PHPUnit Started (PHPUnit %s using %s) | ||
Test Runner Configured | ||
Test Suite Loaded (1 test) | ||
Event Facade Sealed | ||
Test Runner Started | ||
Test Suite Sorted | ||
Test Runner Execution Started (1 test) | ||
Test Suite Started (PHPUnit\TestFixture\Event\AssertionFailureInSetUpTest, 1 test) | ||
Test Preparation Started (PHPUnit\TestFixture\Event\AssertionFailureInSetUpTest::testOne) | ||
Assertion Failed (Constraint: is true, Value: false) | ||
Before Test Method Called (PHPUnit\TestFixture\Event\AssertionFailureInSetUpTest::beforeTest) | ||
Before Test Method Finished: | ||
- PHPUnit\TestFixture\Event\AssertionFailureInSetUpTest::beforeTest | ||
Test Preparation Failed (PHPUnit\TestFixture\Event\AssertionFailureInSetUpTest::testOne) | ||
Test Failed (PHPUnit\TestFixture\Event\AssertionFailureInSetUpTest::testOne) | ||
Failed asserting that false is true. | ||
Test Finished (PHPUnit\TestFixture\Event\AssertionFailureInSetUpTest::testOne) | ||
Test Suite Finished (PHPUnit\TestFixture\Event\AssertionFailureInSetUpTest, 1 test) | ||
Test Runner Execution Finished | ||
Test Runner Finished | ||
PHPUnit Finished (Shell Exit Code: 1) |
48 changes: 48 additions & 0 deletions
48
tests/end-to-end/event/assertion-failure-in-postcondition-method.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,48 @@ | ||
--TEST-- | ||
The right events are emitted in the right order for a test that fails because of an assertion failure in a postcondition method | ||
--SKIPIF-- | ||
<?php declare(strict_types=1); | ||
if (DIRECTORY_SEPARATOR === '\\') { | ||
print "skip: this test does not work on Windows / GitHub Actions\n"; | ||
} | ||
--FILE-- | ||
<?php declare(strict_types=1); | ||
$traceFile = tempnam(sys_get_temp_dir(), __FILE__); | ||
|
||
$_SERVER['argv'][] = '--do-not-cache-result'; | ||
$_SERVER['argv'][] = '--no-configuration'; | ||
$_SERVER['argv'][] = '--no-output'; | ||
$_SERVER['argv'][] = '--log-events-text'; | ||
$_SERVER['argv'][] = $traceFile; | ||
$_SERVER['argv'][] = __DIR__ . '/_files/AssertionFailureInPostConditionTest.php'; | ||
|
||
require __DIR__ . '/../../bootstrap.php'; | ||
|
||
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']); | ||
|
||
print file_get_contents($traceFile); | ||
|
||
unlink($traceFile); | ||
--EXPECTF-- | ||
PHPUnit Started (PHPUnit %s using %s) | ||
Test Runner Configured | ||
Test Suite Loaded (1 test) | ||
Event Facade Sealed | ||
Test Runner Started | ||
Test Suite Sorted | ||
Test Runner Execution Started (1 test) | ||
Test Suite Started (PHPUnit\TestFixture\Event\AssertionFailureInPostConditionTest, 1 test) | ||
Test Preparation Started (PHPUnit\TestFixture\Event\AssertionFailureInPostConditionTest::testOne) | ||
Test Prepared (PHPUnit\TestFixture\Event\AssertionFailureInPostConditionTest::testOne) | ||
Assertion Succeeded (Constraint: is true, Value: true) | ||
Assertion Failed (Constraint: is true, Value: false) | ||
Post Condition Method Called (PHPUnit\TestFixture\Event\AssertionFailureInPostConditionTest::postCondition) | ||
Post Condition Method Finished: | ||
- PHPUnit\TestFixture\Event\AssertionFailureInPostConditionTest::postCondition | ||
Test Failed (PHPUnit\TestFixture\Event\AssertionFailureInPostConditionTest::testOne) | ||
Failed asserting that false is true. | ||
Test Finished (PHPUnit\TestFixture\Event\AssertionFailureInPostConditionTest::testOne) | ||
Test Suite Finished (PHPUnit\TestFixture\Event\AssertionFailureInPostConditionTest, 1 test) | ||
Test Runner Execution Finished | ||
Test Runner Finished | ||
PHPUnit Finished (Shell Exit Code: 1) |
47 changes: 47 additions & 0 deletions
47
tests/end-to-end/event/assertion-failure-in-precondition-method.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,47 @@ | ||
--TEST-- | ||
The right events are emitted in the right order for a test that fails because of an assertion failure in a precondition method | ||
--SKIPIF-- | ||
<?php declare(strict_types=1); | ||
if (DIRECTORY_SEPARATOR === '\\') { | ||
print "skip: this test does not work on Windows / GitHub Actions\n"; | ||
} | ||
--FILE-- | ||
<?php declare(strict_types=1); | ||
$traceFile = tempnam(sys_get_temp_dir(), __FILE__); | ||
|
||
$_SERVER['argv'][] = '--do-not-cache-result'; | ||
$_SERVER['argv'][] = '--no-configuration'; | ||
$_SERVER['argv'][] = '--no-output'; | ||
$_SERVER['argv'][] = '--log-events-text'; | ||
$_SERVER['argv'][] = $traceFile; | ||
$_SERVER['argv'][] = __DIR__ . '/_files/AssertionFailureInPreConditionTest.php'; | ||
|
||
require __DIR__ . '/../../bootstrap.php'; | ||
|
||
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']); | ||
|
||
print file_get_contents($traceFile); | ||
|
||
unlink($traceFile); | ||
--EXPECTF-- | ||
PHPUnit Started (PHPUnit %s using %s) | ||
Test Runner Configured | ||
Test Suite Loaded (1 test) | ||
Event Facade Sealed | ||
Test Runner Started | ||
Test Suite Sorted | ||
Test Runner Execution Started (1 test) | ||
Test Suite Started (PHPUnit\TestFixture\Event\AssertionFailureInPreConditionTest, 1 test) | ||
Test Preparation Started (PHPUnit\TestFixture\Event\AssertionFailureInPreConditionTest::testOne) | ||
Assertion Failed (Constraint: is true, Value: false) | ||
Pre Condition Method Called (PHPUnit\TestFixture\Event\AssertionFailureInPreConditionTest::preCondition) | ||
Pre Condition Method Finished: | ||
- PHPUnit\TestFixture\Event\AssertionFailureInPreConditionTest::preCondition | ||
Test Preparation Failed (PHPUnit\TestFixture\Event\AssertionFailureInPreConditionTest::testOne) | ||
Test Failed (PHPUnit\TestFixture\Event\AssertionFailureInPreConditionTest::testOne) | ||
Failed asserting that false is true. | ||
Test Finished (PHPUnit\TestFixture\Event\AssertionFailureInPreConditionTest::testOne) | ||
Test Suite Finished (PHPUnit\TestFixture\Event\AssertionFailureInPreConditionTest, 1 test) | ||
Test Runner Execution Finished | ||
Test Runner Finished | ||
PHPUnit Finished (Shell Exit Code: 1) |
2 changes: 1 addition & 1 deletion
2
...o-end/event/assertion-method-failure.phpt → ...ent/assertion-failure-in-test-method.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