Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9aaf683

Browse files
committed
minor: remove useless Factories trait (#1067)
1 parent 8fdf426 commit 9aaf683

16 files changed

Lines changed: 22 additions & 44 deletions

src/PHPUnit/DisplayFakerSeedOnTestSuiteFinished.php renamed to src/PHPUnit/DisplayFakerSeedOnApplicationFinished.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
* @internal
2121
* @author Nicolas PHILIPPE <[email protected]>
2222
*/
23-
final class DisplayFakerSeedOnTestSuiteFinished implements Event\TestRunner\FinishedSubscriber
23+
final class DisplayFakerSeedOnApplicationFinished implements Event\Application\FinishedSubscriber
2424
{
25-
public function notify(Event\TestRunner\Finished $event): void
25+
public function notify(Event\Application\Finished $event): void
2626
{
2727
$fakerSeed = FakerAdapter::fakerSeed();
2828

2929
if (null !== $fakerSeed) {
30-
echo "\n\nFaker seed: ".$fakerSeed; // @phpstan-ignore ekinoBannedCode.expression
30+
echo "\nFaker seed used: {$fakerSeed}\n"; // @phpstan-ignore ekinoBannedCode.expression
3131
}
3232
}
3333
}

src/PHPUnit/FoundryExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function bootstrap(
5757
new TriggerDataProviderPersistenceOnTestPrepared(),
5858
],
5959
Event\Test\Finished::class => [new ShutdownFoundryOnTestFinished()],
60-
Event\TestRunner\Finished::class => [new DisplayFakerSeedOnTestSuiteFinished()],
60+
Event\TestRunner\Finished::class => [new DisplayFakerSeedOnApplicationFinished()],
6161
];
6262

6363
$subscribers = \array_merge(...\array_values($subscribers));

tests/Integration/Attribute/WithStory/ParentClassWithStoryAttributeTestCase.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1717
use Zenstruck\Foundry\Attribute\WithStory;
18-
use Zenstruck\Foundry\Test\Factories;
1918
use Zenstruck\Foundry\Test\ResetDatabase;
2019
use Zenstruck\Foundry\Tests\Fixture\Stories\EntityStory;
2120
use Zenstruck\Foundry\Tests\Integration\RequiresORM;
@@ -26,5 +25,5 @@
2625
#[WithStory(EntityStory::class)]
2726
abstract class ParentClassWithStoryAttributeTestCase extends KernelTestCase
2827
{
29-
use Factories, RequiresORM, ResetDatabase;
28+
use RequiresORM, ResetDatabase;
3029
}

tests/Integration/Attribute/WithStory/WithStoryOnClassTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
2020
use Zenstruck\Foundry\Attribute\WithStory;
2121
use Zenstruck\Foundry\PHPUnit\FoundryExtension;
22-
use Zenstruck\Foundry\Test\Factories;
2322
use Zenstruck\Foundry\Test\ResetDatabase;
2423
use Zenstruck\Foundry\Tests\Fixture\Factories\Entity\GenericEntityFactory;
2524
use Zenstruck\Foundry\Tests\Fixture\Stories\EntityPoolStory;
@@ -35,7 +34,7 @@
3534
#[WithStory(EntityStory::class)]
3635
final class WithStoryOnClassTest extends KernelTestCase
3736
{
38-
use Factories, RequiresORM, ResetDatabase;
37+
use RequiresORM, ResetDatabase;
3938

4039
#[Test]
4140
public function can_use_story_in_attribute(): void

tests/Integration/Attribute/WithStory/WithStoryOnMethodTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
2020
use Zenstruck\Foundry\Attribute\WithStory;
2121
use Zenstruck\Foundry\PHPUnit\FoundryExtension;
22-
use Zenstruck\Foundry\Test\Factories;
2322
use Zenstruck\Foundry\Test\ResetDatabase;
2423
use Zenstruck\Foundry\Tests\Fixture\Factories\Entity\GenericEntityFactory;
2524
use Zenstruck\Foundry\Tests\Fixture\Stories\EntityPoolStory;
@@ -35,7 +34,7 @@
3534
#[RequiresPhpunitExtension(FoundryExtension::class)]
3635
final class WithStoryOnMethodTest extends KernelTestCase
3736
{
38-
use Factories, RequiresORM, ResetDatabase;
37+
use RequiresORM, ResetDatabase;
3938

4039
#[Test]
4140
#[WithStory(EntityStory::class)]

tests/Integration/DataProvider/DataProviderForServiceFactoryInKernelTestCaseTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
2121
use Zenstruck\Foundry\Configuration;
2222
use Zenstruck\Foundry\PHPUnit\FoundryExtension;
23-
use Zenstruck\Foundry\Test\Factories;
2423
use Zenstruck\Foundry\Tests\Fixture\Factories\Object1Factory;
2524
use Zenstruck\Foundry\Tests\Fixture\Object1;
2625

@@ -34,8 +33,6 @@
3433
#[RequiresPhpunitExtension(FoundryExtension::class)]
3534
final class DataProviderForServiceFactoryInKernelTestCaseTest extends KernelTestCase
3635
{
37-
use Factories;
38-
3936
#[Test]
4037
#[DataProvider('createObjectFromServiceFactoryInDataProvider')]
4138
public function it_can_create_one_object_in_data_provider(?Object1 $providedData, string $expected): void

tests/Integration/DataProvider/DataProviderInUnitTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
use PHPUnit\Framework\TestCase;
2222
use Zenstruck\Foundry\Persistence\ProxyGenerator;
2323
use Zenstruck\Foundry\PHPUnit\FoundryExtension;
24-
use Zenstruck\Foundry\Test\Factories;
2524
use Zenstruck\Foundry\Tests\Fixture\Entity\GenericEntity;
2625
use Zenstruck\Foundry\Tests\Fixture\Factories\Entity\GenericEntityFactory;
2726
use Zenstruck\Foundry\Tests\Fixture\Factories\Entity\GenericProxyEntityFactory;
@@ -41,8 +40,6 @@
4140
#[RequiresPhpunitExtension(FoundryExtension::class)]
4241
final class DataProviderInUnitTest extends TestCase
4342
{
44-
use Factories;
45-
4643
#[Test]
4744
#[DataProvider('createObjectWithObjectFactoryInDataProvider')]
4845
public function assert_it_can_create_object_with_object_factory_in_data_provider(mixed $providedData, mixed $expectedData): void

tests/Integration/DataProvider/DataProviderWithInMemoryTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
use Zenstruck\Foundry\Persistence\PersistentObjectFactory;
2727
use Zenstruck\Foundry\Persistence\ProxyGenerator;
2828
use Zenstruck\Foundry\PHPUnit\FoundryExtension;
29-
use Zenstruck\Foundry\Test\Factories;
3029
use Zenstruck\Foundry\Test\ResetDatabase;
3130
use Zenstruck\Foundry\Tests\Fixture\Entity\Contact;
3231
use Zenstruck\Foundry\Tests\Fixture\Factories\Entity\Contact\ContactFactory;
@@ -43,7 +42,6 @@
4342
#[RequiresPhpunitExtension(FoundryExtension::class)]
4443
final class DataProviderWithInMemoryTest extends KernelTestCase
4544
{
46-
use Factories;
4745
use RequiresORM; // needed to use the entity manager
4846
use ResetDatabase;
4947

tests/Integration/DataProvider/DataProviderWithPersistentDocumentFactoryTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,20 @@
2020
use Zenstruck\Foundry\Tests\Fixture\Document\DocumentWithReadonly;
2121
use Zenstruck\Foundry\Tests\Fixture\Factories\Document\GenericDocumentFactory;
2222
use Zenstruck\Foundry\Tests\Fixture\Model\Embeddable;
23-
use Zenstruck\Foundry\Tests\Integration\RequiresMongo;
2423

2524
use function Zenstruck\Foundry\Persistence\persistent_factory;
2625

2726
/**
2827
* @author Nicolas PHILIPPE <[email protected]>
2928
* @requires PHPUnit >=12
3029
*/
31-
#[RequiresPhpunit('>=12')]
3230
#[RequiresPhp('>=8.4')]
31+
#[RequiresPhpunit('>=12')]
3332
#[RequiresPhpunitExtension(FoundryExtension::class)]
3433
#[RequiresEnvironmentVariable('USE_PHP_84_LAZY_OBJECTS', '1')]
34+
#[RequiresEnvironmentVariable('MONGO_URL')]
3535
final class DataProviderWithPersistentDocumentFactoryTest extends DataProviderWithPersistentFactoryTestCase
3636
{
37-
use RequiresMongo;
38-
3937
protected static function factory(): PersistentObjectFactory
4038
{
4139
return GenericDocumentFactory::new();

tests/Integration/DataProvider/DataProviderWithPersistentEntityFactoryTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,20 @@
2020
use Zenstruck\Foundry\Tests\Fixture\Entity\EdgeCases\EntityWithReadonly\EntityWithReadonly;
2121
use Zenstruck\Foundry\Tests\Fixture\Factories\Entity\GenericEntityFactory;
2222
use Zenstruck\Foundry\Tests\Fixture\Model\Embeddable;
23-
use Zenstruck\Foundry\Tests\Integration\RequiresORM;
2423

2524
use function Zenstruck\Foundry\Persistence\persistent_factory;
2625

2726
/**
2827
* @author Nicolas PHILIPPE <[email protected]>
2928
* @requires PHPUnit >=12
3029
*/
31-
#[RequiresPhpunit('>=12')]
3230
#[RequiresPhp('>=8.4')]
31+
#[RequiresPhpunit('>=12')]
3332
#[RequiresPhpunitExtension(FoundryExtension::class)]
3433
#[RequiresEnvironmentVariable('USE_PHP_84_LAZY_OBJECTS', '1')]
34+
#[RequiresEnvironmentVariable('DATABASE_URL')]
3535
final class DataProviderWithPersistentEntityFactoryTest extends DataProviderWithPersistentFactoryTestCase
3636
{
37-
use RequiresORM;
38-
3937
protected static function factory(): PersistentObjectFactory
4038
{
4139
return GenericEntityFactory::new();

0 commit comments

Comments
 (0)