Skip to content

Commit 4103389

Browse files
Reorganize
1 parent 5aa9e6f commit 4103389

File tree

3 files changed

+69
-64
lines changed

3 files changed

+69
-64
lines changed

tests/end-to-end/_files/HookMethodsOrderTest.php

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
10-
namespace PHPUnit\DeprecatedAnnotationsTestFixture;
10+
namespace PHPUnit\TestFixture;
1111

1212
use PHPUnit\Framework\Attributes\After;
1313
use PHPUnit\Framework\Attributes\Before;
14-
use PHPUnit\Framework\TestCase;
1514

1615
final class HookMethodsOrderTest extends HookMethodsOrderTestCase
1716
{
@@ -58,26 +57,3 @@ protected function afterWithPriority(): void
5857
{
5958
}
6059
}
61-
62-
abstract class HookMethodsOrderTestCase extends TestCase
63-
{
64-
#[Before]
65-
protected function beforeInParent(): void
66-
{
67-
}
68-
69-
#[Before(priority: 1)]
70-
protected function beforeWithPriorityInParent(): void
71-
{
72-
}
73-
74-
#[After]
75-
protected function afterInParent(): void
76-
{
77-
}
78-
79-
#[After(priority: 1)]
80-
protected function afterWithPriorityInParent(): void
81-
{
82-
}
83-
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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\Attributes\After;
13+
use PHPUnit\Framework\Attributes\Before;
14+
use PHPUnit\Framework\TestCase;
15+
16+
abstract class HookMethodsOrderTestCase extends TestCase
17+
{
18+
#[Before]
19+
protected function beforeInParent(): void
20+
{
21+
}
22+
23+
#[Before(priority: 1)]
24+
protected function beforeWithPriorityInParent(): void
25+
{
26+
}
27+
28+
#[After]
29+
protected function afterInParent(): void
30+
{
31+
}
32+
33+
#[After(priority: 1)]
34+
protected function afterWithPriorityInParent(): void
35+
{
36+
}
37+
}

tests/end-to-end/metadata/hook-methods-order.phpt

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,14 @@
22
The right events are emitted in the right order for a successful test that has a before-test method that is configured with annotation
33
--FILE--
44
<?php declare(strict_types=1);
5-
$traceFile = tempnam(sys_get_temp_dir(), __FILE__);
6-
75
$_SERVER['argv'][] = '--do-not-cache-result';
86
$_SERVER['argv'][] = '--no-configuration';
9-
$_SERVER['argv'][] = '--no-output';
10-
$_SERVER['argv'][] = '--log-events-text';
11-
$_SERVER['argv'][] = $traceFile;
7+
$_SERVER['argv'][] = '--debug';
128
$_SERVER['argv'][] = __DIR__ . '/../_files/HookMethodsOrderTest.php';
139

1410
require __DIR__ . '/../../bootstrap.php';
1511

1612
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
17-
18-
print file_get_contents($traceFile);
19-
20-
unlink($traceFile);
2113
--EXPECTF--
2214
PHPUnit Started (PHPUnit %s using %s)
2315
Test Runner Configured
@@ -26,38 +18,38 @@ Test Suite Loaded (1 test)
2618
Test Runner Started
2719
Test Suite Sorted
2820
Test Runner Execution Started (1 test)
29-
Test Suite Started (PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest, 1 test)
30-
Test Preparation Started (PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::testOne)
31-
Before Test Method Called (PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::beforeWithPriorityInParent)
32-
Before Test Method Called (PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::beforeWithPriority)
33-
Before Test Method Called (PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::beforeInParent)
34-
Before Test Method Called (PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::beforeFirst)
35-
Before Test Method Called (PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::beforeSecond)
36-
Before Test Method Called (PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::setUp)
21+
Test Suite Started (PHPUnit\TestFixture\HookMethodsOrderTest, 1 test)
22+
Test Preparation Started (PHPUnit\TestFixture\HookMethodsOrderTest::testOne)
23+
Before Test Method Called (PHPUnit\TestFixture\HookMethodsOrderTest::beforeWithPriorityInParent)
24+
Before Test Method Called (PHPUnit\TestFixture\HookMethodsOrderTest::beforeWithPriority)
25+
Before Test Method Called (PHPUnit\TestFixture\HookMethodsOrderTest::beforeInParent)
26+
Before Test Method Called (PHPUnit\TestFixture\HookMethodsOrderTest::beforeFirst)
27+
Before Test Method Called (PHPUnit\TestFixture\HookMethodsOrderTest::beforeSecond)
28+
Before Test Method Called (PHPUnit\TestFixture\HookMethodsOrderTest::setUp)
3729
Before Test Method Finished:
38-
- PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::beforeWithPriorityInParent
39-
- PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::beforeWithPriority
40-
- PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::beforeInParent
41-
- PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::beforeFirst
42-
- PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::beforeSecond
43-
- PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::setUp
44-
Test Prepared (PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::testOne)
45-
Test Passed (PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::testOne)
46-
After Test Method Called (PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::afterWithPriority)
47-
After Test Method Called (PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::afterWithPriorityInParent)
48-
After Test Method Called (PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::tearDown)
49-
After Test Method Called (PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::afterFirst)
50-
After Test Method Called (PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::afterSecond)
51-
After Test Method Called (PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::afterInParent)
30+
- PHPUnit\TestFixture\HookMethodsOrderTest::beforeWithPriorityInParent
31+
- PHPUnit\TestFixture\HookMethodsOrderTest::beforeWithPriority
32+
- PHPUnit\TestFixture\HookMethodsOrderTest::beforeInParent
33+
- PHPUnit\TestFixture\HookMethodsOrderTest::beforeFirst
34+
- PHPUnit\TestFixture\HookMethodsOrderTest::beforeSecond
35+
- PHPUnit\TestFixture\HookMethodsOrderTest::setUp
36+
Test Prepared (PHPUnit\TestFixture\HookMethodsOrderTest::testOne)
37+
Test Passed (PHPUnit\TestFixture\HookMethodsOrderTest::testOne)
38+
After Test Method Called (PHPUnit\TestFixture\HookMethodsOrderTest::afterWithPriority)
39+
After Test Method Called (PHPUnit\TestFixture\HookMethodsOrderTest::afterWithPriorityInParent)
40+
After Test Method Called (PHPUnit\TestFixture\HookMethodsOrderTest::tearDown)
41+
After Test Method Called (PHPUnit\TestFixture\HookMethodsOrderTest::afterFirst)
42+
After Test Method Called (PHPUnit\TestFixture\HookMethodsOrderTest::afterSecond)
43+
After Test Method Called (PHPUnit\TestFixture\HookMethodsOrderTest::afterInParent)
5244
After Test Method Finished:
53-
- PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::afterWithPriority
54-
- PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::afterWithPriorityInParent
55-
- PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::tearDown
56-
- PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::afterFirst
57-
- PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::afterSecond
58-
- PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::afterInParent
59-
Test Finished (PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest::testOne)
60-
Test Suite Finished (PHPUnit\DeprecatedAnnotationsTestFixture\HookMethodsOrderTest, 1 test)
45+
- PHPUnit\TestFixture\HookMethodsOrderTest::afterWithPriority
46+
- PHPUnit\TestFixture\HookMethodsOrderTest::afterWithPriorityInParent
47+
- PHPUnit\TestFixture\HookMethodsOrderTest::tearDown
48+
- PHPUnit\TestFixture\HookMethodsOrderTest::afterFirst
49+
- PHPUnit\TestFixture\HookMethodsOrderTest::afterSecond
50+
- PHPUnit\TestFixture\HookMethodsOrderTest::afterInParent
51+
Test Finished (PHPUnit\TestFixture\HookMethodsOrderTest::testOne)
52+
Test Suite Finished (PHPUnit\TestFixture\HookMethodsOrderTest, 1 test)
6153
Test Runner Execution Finished
6254
Test Runner Finished
6355
PHPUnit Finished (Shell Exit Code: 0)

0 commit comments

Comments
 (0)