Skip to content

Commit 1271895

Browse files
Add test
1 parent 106fdd2 commit 1271895

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <[email protected]>
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;
11+
12+
use PHPUnit\Framework\TestCase;
13+
14+
final class DeprecatedAssertionTest extends TestCase
15+
{
16+
public function testUsingDeprecatedAssertion(): void
17+
{
18+
$this->assertStringNotMatchesFormat('*%s*', '**');
19+
}
20+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
--TEST--
2+
The right events are emitted in the right order for a successful test that uses a deprecated assertion
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$traceFile = tempnam(sys_get_temp_dir(), __FILE__);
6+
7+
$_SERVER['argv'][] = '--do-not-cache-result';
8+
$_SERVER['argv'][] = '--no-configuration';
9+
$_SERVER['argv'][] = '--no-output';
10+
$_SERVER['argv'][] = '--log-events-text';
11+
$_SERVER['argv'][] = $traceFile;
12+
$_SERVER['argv'][] = __DIR__ . '/_files/DeprecatedAssertionTest.php';
13+
14+
require __DIR__ . '/../../bootstrap.php';
15+
16+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
17+
18+
print file_get_contents($traceFile);
19+
20+
unlink($traceFile);
21+
--EXPECTF--
22+
PHPUnit Started (PHPUnit %s using %s)
23+
Test Runner Configured
24+
Test Suite Loaded (1 test)
25+
Event Facade Sealed
26+
Test Runner Started
27+
Test Suite Sorted
28+
Test Runner Execution Started (1 test)
29+
Test Suite Started (PHPUnit\TestFixture\DeprecatedAssertionTest, 1 test)
30+
Test Preparation Started (PHPUnit\TestFixture\DeprecatedAssertionTest::testUsingDeprecatedAssertion)
31+
Test Prepared (PHPUnit\TestFixture\DeprecatedAssertionTest::testUsingDeprecatedAssertion)
32+
Test Triggered PHPUnit Deprecation (PHPUnit\TestFixture\DeprecatedAssertionTest::testUsingDeprecatedAssertion)
33+
assertStringNotMatchesFormat() is deprecated and will be removed in PHPUnit 12 without replacement.
34+
Test Passed (PHPUnit\TestFixture\DeprecatedAssertionTest::testUsingDeprecatedAssertion)
35+
Test Finished (PHPUnit\TestFixture\DeprecatedAssertionTest::testUsingDeprecatedAssertion)
36+
Test Suite Finished (PHPUnit\TestFixture\DeprecatedAssertionTest, 1 test)
37+
Test Runner Execution Finished
38+
Test Runner Finished
39+
PHPUnit Finished (Shell Exit Code: 0)

0 commit comments

Comments
 (0)