Skip to content

Commit 228dd04

Browse files
committed
chore(v3): remove all PHPUnit un-needed PHPUnit annotations and attributes
1 parent 2d54d69 commit 228dd04

File tree

72 files changed

+55
-1063
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+55
-1063
lines changed

phpunit-deprecation-baseline.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
11
<?xml version="1.0"?>
22
<files version="1">
3-
<file path="vendor/symfony/deprecation-contracts/function.php">
4-
<line number="25" hash="c6af5d66288d0667e424978000f29571e4954b81">
5-
<issue><![CDATA[Since symfony/framework-bundle 6.4: Not setting the "framework.php_errors.log" config option is deprecated. It will default to "true" in 7.0.]]></issue>
6-
7-
<issue><![CDATA[Since doctrine/mongodb-odm 2.14: Not using native lazy objects is deprecated and will be impossible in Doctrine MongoDB ODM 3.0.]]></issue>
8-
<issue><![CDATA[Since symfony/framework-bundle 7.3: Not setting the "property_info.with_constructor_extractor" option explicitly is deprecated because its default value will change in version 8.0.]]></issue>
9-
<issue><![CDATA[Since symfony/console 7.4: The "Symfony\Component\Console\Application::add()" method is deprecated and will be removed in Symfony 8.0, use "Symfony\Component\Console\Application::addCommand()" instead.]]></issue>
10-
<issue><![CDATA[Since doctrine/mongodb-odm 2.3: Document short namespace aliases are deprecated, use ::class constant instead.]]></issue>
11-
</line>
12-
</file>
133
<file path="vendor/doctrine/deprecations/src/Deprecation.php">
144
<line number="208" hash="815824609bbd80ce3a5cc8a6a19c2e6dd0c6985c">
15-
<issue><![CDATA[Support for MySQL < 8 is deprecated and will be removed in DBAL 5 (AbstractMySQLDriver.php:70 called by AbstractDriverMiddleware.php:32, https://github.com/doctrine/dbal/pull/6343, package doctrine/dbal)]]></issue>
165
<issue><![CDATA[Support for MySQL < 8 is deprecated and will be removed in DBAL 5 (AbstractMySQLDriver.php:75 called by AbstractDriverMiddleware.php:32, https://github.com/doctrine/dbal/pull/6343, package doctrine/dbal)]]></issue>
176
</line>
187
</file>

tests/Fixture/DoctrineCascadeRelationship/ChangesEntityRelationshipCascadePersist.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
2020
use Zenstruck\Foundry\Configuration;
2121
use Zenstruck\Foundry\Persistence\PersistenceManager;
22-
use Zenstruck\Foundry\Tests\Integration\RequiresORM;
2322

2423
/**
2524
* @author Nicolas PHILIPPE <nikophil@gmail.com>
@@ -36,8 +35,6 @@
3635
*/
3736
trait ChangesEntityRelationshipCascadePersist
3837
{
39-
use RequiresORM;
40-
4138
private static string $methodName = '';
4239

4340
#[Before]
@@ -81,10 +78,9 @@ public static function provideCascadeRelationshipsCombinations(): iterable
8178
return;
8279
}
8380

81+
// todo !
8482
if (!\getenv('DATABASE_URL') || !self::$methodName) {
85-
// this test requires the ORM, but trait RequiresORM is analysed after data provider are called
86-
// then we need to return at least one empty array to avoid an error
87-
// in PHPUnit 12, we will be able to use #[RequiresEnvironmentVariable('DATABASE_URL')] to prevent this
83+
// data providers are resolved before #[RequiresEnvironmentVariable] is checked
8884
yield []; // @phpstan-ignore generator.valueType
8985

9086
return;

tests/Integration/ArrayFactoryTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
*/
2222
final class ArrayFactoryTest extends KernelTestCase
2323
{
24-
/**
25-
* @test
26-
*/
2724
#[Test]
2825
public function can_create_with_defaults(): void
2926
{
@@ -38,9 +35,6 @@ public function can_create_with_defaults(): void
3835
);
3936
}
4037

41-
/**
42-
* @test
43-
*/
4438
#[Test]
4539
public function can_create_with_overrides(): void
4640
{

tests/Integration/Attribute/WithStory/ParentClassWithStoryAttributeTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
1111

1212
namespace Zenstruck\Foundry\Tests\Integration\Attribute\WithStory;
1313

14+
use PHPUnit\Framework\Attributes\RequiresEnvironmentVariable;
1415
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1516
use Zenstruck\Foundry\Attribute\ResetDatabase;
1617
use Zenstruck\Foundry\Attribute\WithStory;
1718
use Zenstruck\Foundry\Tests\Fixture\Stories\EntityStory;
18-
use Zenstruck\Foundry\Tests\Integration\RequiresORM;
1919

2020
/**
2121
* @author Nicolas PHILIPPE <nikophil@gmail.com>
2222
*/
2323
#[WithStory(EntityStory::class)]
2424
#[ResetDatabase]
25+
#[RequiresEnvironmentVariable('DATABASE_URL')]
2526
abstract class ParentClassWithStoryAttributeTestCase extends KernelTestCase
2627
{
27-
use RequiresORM;
2828
}

tests/Integration/Attribute/WithStory/WithStoryOnClassTest.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,23 @@
1111

1212
namespace Zenstruck\Foundry\Tests\Integration\Attribute\WithStory;
1313

14-
use PHPUnit\Framework\Attributes\RequiresPhpunit;
15-
use PHPUnit\Framework\Attributes\RequiresPhpunitExtension;
14+
use PHPUnit\Framework\Attributes\RequiresEnvironmentVariable;
1615
use PHPUnit\Framework\Attributes\Test;
1716
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1817
use Zenstruck\Foundry\Attribute\ResetDatabase;
1918
use Zenstruck\Foundry\Attribute\WithStory;
20-
use Zenstruck\Foundry\PHPUnit\FoundryExtension;
2119
use Zenstruck\Foundry\Tests\Fixture\Factories\Entity\GenericEntityFactory;
2220
use Zenstruck\Foundry\Tests\Fixture\Stories\EntityPoolStory;
2321
use Zenstruck\Foundry\Tests\Fixture\Stories\EntityStory;
24-
use Zenstruck\Foundry\Tests\Integration\RequiresORM;
2522

2623
/**
2724
* @author Nicolas PHILIPPE <nikophil@gmail.com>
28-
* @requires PHPUnit >=11.0
2925
*/
30-
#[RequiresPhpunit('>=11.0')]
31-
#[RequiresPhpunitExtension(FoundryExtension::class)]
3226
#[WithStory(EntityStory::class)]
3327
#[ResetDatabase]
28+
#[RequiresEnvironmentVariable('DATABASE_URL')]
3429
final class WithStoryOnClassTest extends KernelTestCase
3530
{
36-
use RequiresORM;
37-
3831
#[Test]
3932
public function can_use_story_in_attribute(): void
4033
{

tests/Integration/Attribute/WithStory/WithStoryOnMethodTest.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,23 @@
1111

1212
namespace Zenstruck\Foundry\Tests\Integration\Attribute\WithStory;
1313

14-
use PHPUnit\Framework\Attributes\RequiresPhpunit;
15-
use PHPUnit\Framework\Attributes\RequiresPhpunitExtension;
14+
use PHPUnit\Framework\Attributes\RequiresEnvironmentVariable;
1615
use PHPUnit\Framework\Attributes\Test;
1716
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1817
use Zenstruck\Foundry\Attribute\ResetDatabase;
1918
use Zenstruck\Foundry\Attribute\WithStory;
20-
use Zenstruck\Foundry\PHPUnit\FoundryExtension;
2119
use Zenstruck\Foundry\Tests\Fixture\Factories\Entity\GenericEntityFactory;
2220
use Zenstruck\Foundry\Tests\Fixture\Stories\EntityPoolStory;
2321
use Zenstruck\Foundry\Tests\Fixture\Stories\EntityStory;
2422
use Zenstruck\Foundry\Tests\Fixture\Stories\ServiceStory;
25-
use Zenstruck\Foundry\Tests\Integration\RequiresORM;
2623

2724
/**
2825
* @author Nicolas PHILIPPE <nikophil@gmail.com>
29-
* @requires PHPUnit >=11.0
3026
*/
31-
#[RequiresPhpunit('>=11.0')]
32-
#[RequiresPhpunitExtension(FoundryExtension::class)]
3327
#[ResetDatabase]
28+
#[RequiresEnvironmentVariable('DATABASE_URL')]
3429
final class WithStoryOnMethodTest extends KernelTestCase
3530
{
36-
use RequiresORM;
37-
3831
#[Test]
3932
#[WithStory(EntityStory::class)]
4033
public function can_use_story_in_attribute(): void

tests/Integration/Attribute/WithStory/WithStoryOnParentClassTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,14 @@
1111

1212
namespace Zenstruck\Foundry\Tests\Integration\Attribute\WithStory;
1313

14-
use PHPUnit\Framework\Attributes\RequiresPhpunit;
15-
use PHPUnit\Framework\Attributes\RequiresPhpunitExtension;
1614
use PHPUnit\Framework\Attributes\Test;
1715
use Zenstruck\Foundry\Attribute\WithStory;
18-
use Zenstruck\Foundry\PHPUnit\FoundryExtension;
1916
use Zenstruck\Foundry\Tests\Fixture\Factories\Entity\GenericEntityFactory;
2017
use Zenstruck\Foundry\Tests\Fixture\Stories\EntityPoolStory;
2118

2219
/**
2320
* @author Nicolas PHILIPPE <nikophil@gmail.com>
24-
* @requires PHPUnit >=11.0
2521
*/
26-
#[RequiresPhpunit('>=11.0')]
27-
#[RequiresPhpunitExtension(FoundryExtension::class)]
2822
#[WithStory(EntityPoolStory::class)]
2923
final class WithStoryOnParentClassTest extends ParentClassWithStoryAttributeTestCase
3024
{

tests/Integration/Command/LoadFixturesCommandTest.php

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Zenstruck\Foundry\Tests\Integration\Command;
1313

1414
use PHPUnit\Framework\Attributes\DataProvider;
15+
use PHPUnit\Framework\Attributes\RequiresEnvironmentVariable;
1516
use PHPUnit\Framework\Attributes\Test;
1617
use Symfony\Bundle\FrameworkBundle\Console\Application;
1718
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
@@ -25,18 +26,13 @@
2526
use Zenstruck\Foundry\Tests\Fixture\Stories\Fixtures\FixtureStory;
2627
use Zenstruck\Foundry\Tests\Fixture\Stories\Fixtures\FixtureStoryWithNameCollision;
2728
use Zenstruck\Foundry\Tests\Fixture\TestKernel;
28-
use Zenstruck\Foundry\Tests\Integration\RequiresORM;
2929

3030
use function Zenstruck\Foundry\Persistence\repository;
3131

3232
#[ResetDatabase]
33+
#[RequiresEnvironmentVariable('DATABASE_URL')]
3334
final class LoadFixturesCommandTest extends KernelTestCase
3435
{
35-
use RequiresORM;
36-
37-
/**
38-
* @test
39-
*/
4036
#[Test]
4137
public function it_throws_if_no_story_marked_as_fixture(): void
4238
{
@@ -46,9 +42,6 @@ public function it_throws_if_no_story_marked_as_fixture(): void
4642
$this->commandTester()->execute(['name' => 'foo']);
4743
}
4844

49-
/**
50-
* @test
51-
*/
5245
#[Test]
5346
public function it_throws_if_story_does_not_exist(): void
5447
{
@@ -58,9 +51,6 @@ public function it_throws_if_story_does_not_exist(): void
5851
$this->commandTester(['environment' => 'stories_as_fixtures'])->execute(['name' => 'invalid-name', '--append' => true]);
5952
}
6053

61-
/**
62-
* @test
63-
*/
6454
#[Test]
6555
public function it_can_load_a_story(): void
6656
{
@@ -70,9 +60,6 @@ public function it_can_load_a_story(): void
7060
GenericEntityFactory::assert()->count(1, ['prop1' => 'fixture-story']);
7161
}
7262

73-
/**
74-
* @test
75-
*/
7663
#[Test]
7764
public function it_can_load_a_story_with_verbose_mode(): void
7865
{
@@ -85,9 +72,6 @@ public function it_can_load_a_story_with_verbose_mode(): void
8572
self::assertStringContainsString('loaded (name: fixture-story)', $commandTester->getDisplay());
8673
}
8774

88-
/**
89-
* @test
90-
*/
9175
#[Test]
9276
public function it_throws_if_name_collision_between_two_stories_name(): void
9377
{
@@ -103,9 +87,6 @@ public function it_throws_if_name_collision_between_two_stories_name(): void
10387
$this->commandTester(['environment' => 'story_fixture_with_name_collision'])->execute(['name' => 'fixture-story', '--append' => true]);
10488
}
10589

106-
/**
107-
* @test
108-
*/
10990
#[Test]
11091
public function it_throws_if_name_collision_between_story_name_and_group_name(): void
11192
{
@@ -115,9 +96,6 @@ public function it_throws_if_name_collision_between_story_name_and_group_name():
11596
$this->commandTester(['environment' => 'story_fixture_with_group_name_collision'])->execute(['name' => 'fixture-story', '--append' => true]);
11697
}
11798

118-
/**
119-
* @test
120-
*/
12199
#[Test]
122100
public function it_can_load_one_single_story_based_on_its_group_name(): void
123101
{
@@ -127,9 +105,6 @@ public function it_can_load_one_single_story_based_on_its_group_name(): void
127105
GenericEntityFactory::assert()->count(1, ['prop1' => 'fixture-story']);
128106
}
129107

130-
/**
131-
* @test
132-
*/
133108
#[Test]
134109
public function it_can_load_multiple_stories_based_on_their_group_name(): void
135110
{
@@ -140,10 +115,6 @@ public function it_can_load_multiple_stories_based_on_their_group_name(): void
140115
GenericEntityFactory::assert()->count(1, ['prop1' => 'fixture-story-for-group']);
141116
}
142117

143-
/**
144-
* @test
145-
* @dataProvider provideFixturesWhichLoadAnotherFixtureCases
146-
*/
147118
#[Test]
148119
#[DataProvider('provideFixturesWhichLoadAnotherFixtureCases')]
149120
public function it_can_load_fixture_which_loads_another_fixture(string $name): void
@@ -161,9 +132,6 @@ public static function provideFixturesWhichLoadAnotherFixtureCases(): iterable
161132
yield 'by group name' => ['fixture-using-another-fixture-group'];
162133
}
163134

164-
/**
165-
* @test
166-
*/
167135
#[Test]
168136
public function it_can_load_a_story_and_reset_database(): void
169137
{
@@ -179,9 +147,6 @@ public function it_can_load_a_story_and_reset_database(): void
179147
GenericEntityFactory::assert()->count(1, ['prop1' => 'fixture-story']);
180148
}
181149

182-
/**
183-
* @test
184-
*/
185150
#[Test]
186151
public function user_can_refuse_to_reset_database(): void
187152
{
@@ -194,9 +159,6 @@ public function user_can_refuse_to_reset_database(): void
194159
GenericEntityFactory::assert()->count(0);
195160
}
196161

197-
/**
198-
* @test
199-
*/
200162
#[Test]
201163
public function it_does_not_reset_database_if_append_option_is_used(): void
202164
{
@@ -211,9 +173,6 @@ public function it_does_not_reset_database_if_append_option_is_used(): void
211173
GenericEntityFactory::assert()->count(6);
212174
}
213175

214-
/**
215-
* @test
216-
*/
217176
#[Test]
218177
public function if_no_name_provided_it_asks_for_story_to_load(): void
219178
{
@@ -228,9 +187,6 @@ public function if_no_name_provided_it_asks_for_story_to_load(): void
228187
self::assertStringContainsString('Loading story with name "fixture-story"', $commandTester->getDisplay());
229188
}
230189

231-
/**
232-
* @test
233-
*/
234190
#[Test]
235191
public function if_no_name_provided_it_asks_for_group_to_load(): void
236192
{
@@ -246,9 +202,6 @@ public function if_no_name_provided_it_asks_for_group_to_load(): void
246202
self::assertStringContainsString('Loading stories group "multiple-fixtures-in-group"', $commandTester->getDisplay());
247203
}
248204

249-
/**
250-
* @test
251-
*/
252205
#[Test]
253206
public function if_no_name_provided_and_on_one_story_fixture_it_loads_it_automatically(): void
254207
{
@@ -261,9 +214,6 @@ public function if_no_name_provided_and_on_one_story_fixture_it_loads_it_automat
261214
self::assertStringContainsString('Loading story with name "fixture-story"', $commandTester->getDisplay());
262215
}
263216

264-
/**
265-
* @test
266-
*/
267217
#[Test]
268218
public function it_does_not_load_global_state(): void
269219
{

tests/Integration/DataProvider/DataProviderForServiceFactoryInKernelTestCaseTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,17 @@
1212
namespace Zenstruck\Foundry\Tests\Integration\DataProvider;
1313

1414
use PHPUnit\Framework\Attributes\DataProvider;
15-
use PHPUnit\Framework\Attributes\RequiresPhpunit;
16-
use PHPUnit\Framework\Attributes\RequiresPhpunitExtension;
1715
use PHPUnit\Framework\Attributes\Test;
1816
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1917
use Zenstruck\Foundry\Configuration;
20-
use Zenstruck\Foundry\PHPUnit\FoundryExtension;
2118
use Zenstruck\Foundry\Tests\Fixture\Factories\Object1Factory;
2219
use Zenstruck\Foundry\Tests\Fixture\Object1;
2320

2421
use function Zenstruck\Foundry\faker;
2522

2623
/**
2724
* @author Nicolas PHILIPPE <nikophil@gmail.com>
28-
* @requires PHPUnit >=11.4
2925
*/
30-
#[RequiresPhpunit('>=11.4')]
31-
#[RequiresPhpunitExtension(FoundryExtension::class)]
3226
final class DataProviderForServiceFactoryInKernelTestCaseTest extends KernelTestCase
3327
{
3428
#[Test]

tests/Integration/DataProvider/DataProviderInUnitTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
namespace Zenstruck\Foundry\Tests\Integration\DataProvider;
1313

1414
use PHPUnit\Framework\Attributes\DataProvider;
15-
use PHPUnit\Framework\Attributes\RequiresPhpunitExtension;
1615
use PHPUnit\Framework\Attributes\Test;
1716
use PHPUnit\Framework\TestCase;
18-
use Zenstruck\Foundry\PHPUnit\FoundryExtension;
1917
use Zenstruck\Foundry\Tests\Fixture\Entity\GenericEntity;
2018
use Zenstruck\Foundry\Tests\Fixture\Factories\Entity\GenericEntityFactory;
2119
use Zenstruck\Foundry\Tests\Fixture\Factories\Object1Factory;
@@ -28,7 +26,6 @@
2826
/**
2927
* @author Nicolas PHILIPPE <nikophil@gmail.com>
3028
*/
31-
#[RequiresPhpunitExtension(FoundryExtension::class)]
3229
final class DataProviderInUnitTest extends TestCase
3330
{
3431
#[Test]

0 commit comments

Comments
 (0)