Skip to content

Commit 8746b8a

Browse files
authored
Fix swapped preCondition and postCondition attribute mapping (#746)
1 parent 6065b56 commit 8746b8a

2 files changed

Lines changed: 43 additions & 2 deletions

File tree

‎config/sets/annotations-to-attributes.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@
6969
new AnnotationToAttribute('doesNotPerformAssertions', 'PHPUnit\Framework\Attributes\DoesNotPerformAssertions'),
7070
new AnnotationToAttribute('large', 'PHPUnit\Framework\Attributes\Large'),
7171
new AnnotationToAttribute('medium', 'PHPUnit\Framework\Attributes\Medium'),
72-
new AnnotationToAttribute('preCondition', 'PHPUnit\Framework\Attributes\PostCondition'),
73-
new AnnotationToAttribute('postCondition', 'PHPUnit\Framework\Attributes\PreCondition'),
72+
new AnnotationToAttribute('preCondition', 'PHPUnit\Framework\Attributes\PreCondition'),
73+
new AnnotationToAttribute('postCondition', 'PHPUnit\Framework\Attributes\PostCondition'),
7474
new AnnotationToAttribute('runInSeparateProcess', 'PHPUnit\Framework\Attributes\RunInSeparateProcess'),
7575
new AnnotationToAttribute(
7676
'runTestsInSeparateProcesses',
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
use PHPUnit\Framework\TestCase;
4+
5+
class PrePostConditionTest extends TestCase
6+
{
7+
/**
8+
* @preCondition
9+
*/
10+
protected function setUpSomething()
11+
{
12+
}
13+
14+
/**
15+
* @postCondition
16+
*/
17+
protected function tearDownSomething()
18+
{
19+
}
20+
}
21+
22+
?>
23+
-----
24+
<?php
25+
26+
use PHPUnit\Framework\TestCase;
27+
28+
class PrePostConditionTest extends TestCase
29+
{
30+
#[\PHPUnit\Framework\Attributes\PreCondition]
31+
protected function setUpSomething()
32+
{
33+
}
34+
35+
#[\PHPUnit\Framework\Attributes\PostCondition]
36+
protected function tearDownSomething()
37+
{
38+
}
39+
}
40+
41+
?>

0 commit comments

Comments
 (0)