Skip to content

Commit faf7a39

Browse files
Merge branch '12.1'
2 parents 9802b77 + 60a7f8b commit faf7a39

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace PHPUnit\TestFixture\TestRunnerStopping;
11+
12+
use PHPUnit\Event\Facade as EventFacade;
13+
use PHPUnit\Framework\TestCase;
14+
15+
final class PhpunitNoticeTest extends TestCase
16+
{
17+
public function testOne(): void
18+
{
19+
EventFacade::emitter()->testTriggeredPhpunitNotice(
20+
$this->valueObjectForEvents(),
21+
'message',
22+
);
23+
24+
$this->assertTrue(true);
25+
}
26+
27+
public function testTwo(): void
28+
{
29+
$this->assertTrue(true);
30+
}
31+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
--TEST--
2+
Test Runner exits with shell exit code indicating failure when all tests are successful but at least one test triggered a PHPUnit notice
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--do-not-cache-result';
6+
$_SERVER['argv'][] = '--no-configuration';
7+
$_SERVER['argv'][] = '--debug';
8+
$_SERVER['argv'][] = '--fail-on-phpunit-notice';
9+
$_SERVER['argv'][] = __DIR__ . '/../../_files/stop-on-fail-on/PhpunitNoticeTest.php';
10+
11+
require __DIR__ . '/../../../bootstrap.php';
12+
13+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
14+
--EXPECTF--
15+
PHPUnit Started (PHPUnit %s using %s)
16+
Test Runner Configured
17+
Event Facade Sealed
18+
Test Suite Loaded (2 tests)
19+
Test Runner Started
20+
Test Suite Sorted
21+
Test Runner Execution Started (2 tests)
22+
Test Suite Started (PHPUnit\TestFixture\TestRunnerStopping\PhpunitNoticeTest, 2 tests)
23+
Test Preparation Started (PHPUnit\TestFixture\TestRunnerStopping\PhpunitNoticeTest::testOne)
24+
Test Prepared (PHPUnit\TestFixture\TestRunnerStopping\PhpunitNoticeTest::testOne)
25+
Test Triggered PHPUnit Notice (PHPUnit\TestFixture\TestRunnerStopping\PhpunitNoticeTest::testOne)
26+
message
27+
Test Passed (PHPUnit\TestFixture\TestRunnerStopping\PhpunitNoticeTest::testOne)
28+
Test Finished (PHPUnit\TestFixture\TestRunnerStopping\PhpunitNoticeTest::testOne)
29+
Test Preparation Started (PHPUnit\TestFixture\TestRunnerStopping\PhpunitNoticeTest::testTwo)
30+
Test Prepared (PHPUnit\TestFixture\TestRunnerStopping\PhpunitNoticeTest::testTwo)
31+
Test Passed (PHPUnit\TestFixture\TestRunnerStopping\PhpunitNoticeTest::testTwo)
32+
Test Finished (PHPUnit\TestFixture\TestRunnerStopping\PhpunitNoticeTest::testTwo)
33+
Test Suite Finished (PHPUnit\TestFixture\TestRunnerStopping\PhpunitNoticeTest, 2 tests)
34+
Test Runner Execution Finished
35+
Test Runner Finished
36+
PHPUnit Finished (Shell Exit Code: 1)

0 commit comments

Comments
 (0)