From 4192bc36ee05a70cc4d0da22507eb8e3a870f734 Mon Sep 17 00:00:00 2001 From: Nicolas PHILIPPE Date: Wed, 18 Dec 2024 18:38:12 +0100 Subject: [PATCH] feat: throw an error if Factories trait is not used in a KernelTestCase --- .gitignore | 2 +- .php-cs-fixer.dist.php | 5 +++ phpstan.neon | 4 ++ phpunit-10.xml.dist | 1 + phpunit-paratest.xml.dist | 1 + phpunit.xml.dist | 1 + src/Configuration.php | 21 +++++++++ .../kernel_test_case_with_both_traits.phpt | 25 +++++++++++ .../kernel_test_case_with_factory_trait.phpt | 23 ++++++++++ ...nel_test_case_without_factories_trait.phpt | 45 +++++++++++++++++++ ...s_trait_but_with_reset_database_trait.phpt | 38 ++++++++++++++++ .../unit_test_case_with_factories_trait.phpt | 23 ++++++++++ ...nit_test_case_without_factories_trait.phpt | 35 +++++++++++++++ ...TestCaseWithBothTraitsInWrongOrderTest.php | 40 +++++++++++++++++ .../KernelTestCaseWithBothTraitsTest.php | 40 +++++++++++++++++ .../KernelTestCaseWithFactoriesTraitTest.php | 39 ++++++++++++++++ ...FactoriesButWithResetDatabaseTraitTest.php | 35 +++++++++++++++ ...ernelTestCaseWithoutFactoriesTraitTest.php | 32 +++++++++++++ .../UnitTestCaseWithFactoriesTraitTest.php | 30 +++++++++++++ .../UnitTestCaseWithoutFactoriesTraitTest.php | 27 +++++++++++ tests/Integration/Maker/MakerTestCase.php | 3 ++ 21 files changed, 469 insertions(+), 1 deletion(-) create mode 100644 tests/EndToEnd/ForceFactoriesTraitUsage/kernel_test_case_with_both_traits.phpt create mode 100644 tests/EndToEnd/ForceFactoriesTraitUsage/kernel_test_case_with_factory_trait.phpt create mode 100644 tests/EndToEnd/ForceFactoriesTraitUsage/kernel_test_case_without_factories_trait.phpt create mode 100644 tests/EndToEnd/ForceFactoriesTraitUsage/kernel_test_case_without_factories_trait_but_with_reset_database_trait.phpt create mode 100644 tests/EndToEnd/ForceFactoriesTraitUsage/unit_test_case_with_factories_trait.phpt create mode 100644 tests/EndToEnd/ForceFactoriesTraitUsage/unit_test_case_without_factories_trait.phpt create mode 100644 tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithBothTraitsInWrongOrderTest.php create mode 100644 tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithBothTraitsTest.php create mode 100644 tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithFactoriesTraitTest.php create mode 100644 tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithoutFactoriesButWithResetDatabaseTraitTest.php create mode 100644 tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithoutFactoriesTraitTest.php create mode 100644 tests/Fixture/ForceFactoriesTraitUsage/UnitTestCaseWithFactoriesTraitTest.php create mode 100644 tests/Fixture/ForceFactoriesTraitUsage/UnitTestCaseWithoutFactoriesTraitTest.php diff --git a/.gitignore b/.gitignore index 6d5aba94..58efde94 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ /.phpunit.cache /vendor/ /bin/tools/*/vendor/ -/bin/tools/php-cs-fixer/composer.lock +/bin/tools/csfixer /build/ /.php-cs-fixer.cache /.phpunit.result.cache diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 5fca00a6..36ed7b9e 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -7,6 +7,11 @@ \file_get_contents('https://raw.githubusercontent.com/zenstruck/.github/main/.php-cs-fixer.dist.php') ); +$finder = PhpCsFixer\Finder::create() + ->in([__DIR__.'/src', __DIR__.'/tests']) + ->notPath('ForceFactoriesTraitUsage') +; + try { return require $file; } finally { diff --git a/phpstan.neon b/phpstan.neon index 0025a4e0..2ba05647 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -68,6 +68,10 @@ parameters: - identifier: missingType.callable path: tests/Fixture/Maker/expected/ + # not relevant for factories in EndToEnd tests + - message: '#Call to static method PHPUnit\\Framework\\Assert::assertTrue\(\) with true will always evaluate to true#' + path: tests/Fixture/ForceFactoriesTraitUsage/ + excludePaths: - tests/Fixture/Maker/expected/can_create_factory_with_auto_activated_not_persisted_option.php - tests/Fixture/Maker/expected/can_create_factory_interactively.php diff --git a/phpunit-10.xml.dist b/phpunit-10.xml.dist index b9758154..2ec36faf 100644 --- a/phpunit-10.xml.dist +++ b/phpunit-10.xml.dist @@ -18,6 +18,7 @@ tests tests/Integration/Migration/ResetDatabaseWithMigrationTest.php + tests/Fixture tests/Integration/Migration/ResetDatabaseWithMigrationTest.php diff --git a/phpunit-paratest.xml.dist b/phpunit-paratest.xml.dist index 387352e8..33027af9 100644 --- a/phpunit-paratest.xml.dist +++ b/phpunit-paratest.xml.dist @@ -17,6 +17,7 @@ tests tests/Integration/Migration/ResetDatabaseWithMigrationTest.php + tests/Fixture diff --git a/phpunit.xml.dist b/phpunit.xml.dist index c6b9f26c..bee2840a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -20,6 +20,7 @@ tests tests/Integration/Migration/ResetDatabaseWithMigrationTest.php + tests/Fixture tests/Integration/Migration/ResetDatabaseWithMigrationTest.php diff --git a/src/Configuration.php b/src/Configuration.php index 1dae202a..67166464 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -12,10 +12,12 @@ namespace Zenstruck\Foundry; use Faker; +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Zenstruck\Foundry\Exception\FoundryNotBooted; use Zenstruck\Foundry\Exception\PersistenceDisabled; use Zenstruck\Foundry\Exception\PersistenceNotAvailable; use Zenstruck\Foundry\Persistence\PersistenceManager; +use Zenstruck\Foundry\Test\Factories; /** * @author Kevin Bond @@ -96,6 +98,8 @@ public static function isBooted(): bool /** @param \Closure():self|self $configuration */ public static function boot(\Closure|self $configuration): void { + self::throwIfComingFromKernelTestCaseWithoutFactoriesTrait(); + self::$instance = $configuration; } @@ -111,4 +115,21 @@ public static function shutdown(): void StoryRegistry::reset(); self::$instance = null; } + + private static function throwIfComingFromKernelTestCaseWithoutFactoriesTrait(): void + { + $backTrace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS); // @phpstan-ignore ekinoBannedCode.function + + foreach ($backTrace as $trace) { + if ( + /*'->' === ($trace['type'] ?? null) + &&*/ isset($trace['class']) + && KernelTestCase::class !== $trace['class'] + && \is_a($trace['class'], KernelTestCase::class, true) + && !(new \ReflectionClass($trace['class']))->hasMethod('_bootFoundry') + ) { + throw new \LogicException(\sprintf('You must use the trait "%s" in "%s" in order to use Foundry.', Factories::class, $trace['class'])); + } + } + } } diff --git a/tests/EndToEnd/ForceFactoriesTraitUsage/kernel_test_case_with_both_traits.phpt b/tests/EndToEnd/ForceFactoriesTraitUsage/kernel_test_case_with_both_traits.phpt new file mode 100644 index 00000000..16c32ad1 --- /dev/null +++ b/tests/EndToEnd/ForceFactoriesTraitUsage/kernel_test_case_with_both_traits.phpt @@ -0,0 +1,25 @@ +--TEST-- +phpunit --version +--FILE-- +run($_SERVER['argv']); +?> +--EXPECTF-- +PHPUnit %s by Sebastian Bergmann and contributors. + +Runtime: PHP %s + +.... 4 / 4 (100%) + +Time: %s, Memory: %s MB + +OK (4 tests, 4 assertions) diff --git a/tests/EndToEnd/ForceFactoriesTraitUsage/kernel_test_case_with_factory_trait.phpt b/tests/EndToEnd/ForceFactoriesTraitUsage/kernel_test_case_with_factory_trait.phpt new file mode 100644 index 00000000..ff273539 --- /dev/null +++ b/tests/EndToEnd/ForceFactoriesTraitUsage/kernel_test_case_with_factory_trait.phpt @@ -0,0 +1,23 @@ +--TEST-- +phpunit --version +--FILE-- +run($_SERVER['argv']); +?> +--EXPECTF-- +PHPUnit %s by Sebastian Bergmann and contributors. + +Runtime: PHP %s + +.. 2 / 2 (100%) + +Time: %s, Memory: %s MB + +OK (2 tests, 2 assertions) diff --git a/tests/EndToEnd/ForceFactoriesTraitUsage/kernel_test_case_without_factories_trait.phpt b/tests/EndToEnd/ForceFactoriesTraitUsage/kernel_test_case_without_factories_trait.phpt new file mode 100644 index 00000000..e0060b2a --- /dev/null +++ b/tests/EndToEnd/ForceFactoriesTraitUsage/kernel_test_case_without_factories_trait.phpt @@ -0,0 +1,45 @@ +--TEST-- +phpunit --version +--FILE-- +run($_SERVER['argv']); +?> +--EXPECTF-- +PHPUnit %s by Sebastian Bergmann and contributors. + +Runtime: PHP %s + +EE 2 / 2 (100%) + +Time: %s, Memory: %s MB + +There were 2 errors: + +1) Zenstruck\Foundry\Tests\Fixture\ForceFactoriesTraitUsage\KernelTestCaseWithoutFactoriesTraitTest::test_using_foundry_without_trait_should_throw +Zenstruck\Foundry\Exception\FoundryNotBooted: Foundry is not yet booted. Ensure ZenstruckFoundryBundle is enabled. If in a test, ensure your TestCase has the Factories trait. + +%s/src/Configuration.php:%d +%s/src/ObjectFactory.php:%d +%s/src/Factory.php:%d +%s/tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithoutFactoriesTraitTest.php:%d + +2) Zenstruck\Foundry\Tests\Fixture\ForceFactoriesTraitUsage\KernelTestCaseWithoutFactoriesTraitTest::test_using_foundry_without_trait_should_throw_even_when_kernel_is_booted +LogicException: You must use the trait "Zenstruck\Foundry\Test\Factories" in "Zenstruck\Foundry\Tests\Fixture\ForceFactoriesTraitUsage\KernelTestCaseWithoutFactoriesTraitTest" in order to use Foundry. + +%s/src/Configuration.php:%d +%s/src/Configuration.php:%d +%s/src/ZenstruckFoundryBundle.php:%d +%s/vendor/symfony/http-kernel/Kernel.php:%d +%s/vendor/symfony/framework-bundle/Test/KernelTestCase.php:%d +%s/vendor/symfony/framework-bundle/Test/KernelTestCase.php:%d +%s/tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithoutFactoriesTraitTest.php:%d + +ERRORS! +Tests: 2, Assertions: 0, Errors: 2. diff --git a/tests/EndToEnd/ForceFactoriesTraitUsage/kernel_test_case_without_factories_trait_but_with_reset_database_trait.phpt b/tests/EndToEnd/ForceFactoriesTraitUsage/kernel_test_case_without_factories_trait_but_with_reset_database_trait.phpt new file mode 100644 index 00000000..ec1278ff --- /dev/null +++ b/tests/EndToEnd/ForceFactoriesTraitUsage/kernel_test_case_without_factories_trait_but_with_reset_database_trait.phpt @@ -0,0 +1,38 @@ +--TEST-- +phpunit --version +--FILE-- +run($_SERVER['argv']); +?> +--EXPECTF-- +PHPUnit %s by Sebastian Bergmann and contributors. + +Runtime: PHP %s + +E + +Time: %s, Memory: %s MB + +There was 1 error: + +1) Zenstruck\Foundry\Tests\Fixture\ForceFactoriesTraitUsage\KernelTestCaseWithoutFactoriesButWithResetDatabaseTraitTest +LogicException: You must use the trait "Zenstruck\Foundry\Test\Factories" in "Zenstruck\Foundry\Tests\Fixture\ForceFactoriesTraitUsage\KernelTestCaseWithoutFactoriesButWithResetDatabaseTraitTest" in order to use Foundry. + +%s/src/Configuration.php:%d +%s/src/Configuration.php:%d +%s/src/ZenstruckFoundryBundle.php:%d +%s/vendor/symfony/http-kernel/Kernel.php:%d +%s/vendor/symfony/framework-bundle/Test/KernelTestCase.php:%d +%s/src/Test/ResetDatabase.php:%d +%s/src/Persistence/ResetDatabase/ResetDatabaseManager.php:%d +%s/src/Test/ResetDatabase.php:%d + +ERRORS! +Tests: 1, Assertions: 0, Errors: 1. diff --git a/tests/EndToEnd/ForceFactoriesTraitUsage/unit_test_case_with_factories_trait.phpt b/tests/EndToEnd/ForceFactoriesTraitUsage/unit_test_case_with_factories_trait.phpt new file mode 100644 index 00000000..2f5c2ed4 --- /dev/null +++ b/tests/EndToEnd/ForceFactoriesTraitUsage/unit_test_case_with_factories_trait.phpt @@ -0,0 +1,23 @@ +--TEST-- +phpunit --version +--FILE-- +run($_SERVER['argv']); +?> +--EXPECTF-- +PHPUnit %s by Sebastian Bergmann and contributors. + +Runtime: PHP %s + +. 1 / 1 (100%) + +Time: %s, Memory: %s MB + +OK (1 test, 1 assertion) diff --git a/tests/EndToEnd/ForceFactoriesTraitUsage/unit_test_case_without_factories_trait.phpt b/tests/EndToEnd/ForceFactoriesTraitUsage/unit_test_case_without_factories_trait.phpt new file mode 100644 index 00000000..b6dd6a49 --- /dev/null +++ b/tests/EndToEnd/ForceFactoriesTraitUsage/unit_test_case_without_factories_trait.phpt @@ -0,0 +1,35 @@ +--TEST-- +phpunit --version +--FILE-- +run($_SERVER['argv']); +?> +--EXPECTF-- +PHPUnit %s by Sebastian Bergmann and contributors. + +Runtime: PHP %s + +E 1 / 1 (100%) + +Time: %s, Memory: %s MB + +There was 1 error: + +1) Zenstruck\Foundry\Tests\Fixture\ForceFactoriesTraitUsage\UnitTestCaseWithoutFactoriesTraitTest::test_should_throw +Zenstruck\Foundry\Exception\FoundryNotBooted: Foundry is not yet booted. Ensure ZenstruckFoundryBundle is enabled. If in a test, ensure your TestCase has the Factories trait. + +%s/src/Configuration.php:%d +%s/src/ObjectFactory.php:%d +%s/src/Factory.php:%d +%s/tests/Fixture/ForceFactoriesTraitUsage/UnitTestCaseWithoutFactoriesTraitTest.php:%d + +ERRORS! +Tests: 1, Assertions: 0, Errors: 1. + diff --git a/tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithBothTraitsInWrongOrderTest.php b/tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithBothTraitsInWrongOrderTest.php new file mode 100644 index 00000000..aea653c9 --- /dev/null +++ b/tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithBothTraitsInWrongOrderTest.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Zenstruck\Foundry\Tests\Fixture\ForceFactoriesTraitUsage; + +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; +use Zenstruck\Foundry\Test\Factories; +use Zenstruck\Foundry\Test\ResetDatabase; +use Zenstruck\Foundry\Tests\Fixture\Factories\Object1Factory; + +final class KernelTestCaseWithBothTraitsInWrongOrderTest extends KernelTestCase +{ + use ResetDatabase, Factories; + + public function test_should_not_throw(): void + { + Object1Factory::createOne(); + + self::assertTrue(true); + } + + public function test_should_not_throw_even_when_kernel_is_booted(): void + { + self::getContainer(); + + Object1Factory::createOne(); + + self::assertTrue(true); + } +} diff --git a/tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithBothTraitsTest.php b/tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithBothTraitsTest.php new file mode 100644 index 00000000..d7e62102 --- /dev/null +++ b/tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithBothTraitsTest.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Zenstruck\Foundry\Tests\Fixture\ForceFactoriesTraitUsage; + +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; +use Zenstruck\Foundry\Test\Factories; +use Zenstruck\Foundry\Test\ResetDatabase; +use Zenstruck\Foundry\Tests\Fixture\Factories\Object1Factory; + +final class KernelTestCaseWithBothTraitsTest extends KernelTestCase +{ + use Factories, ResetDatabase; + + public function test_should_not_throw(): void + { + Object1Factory::createOne(); + + self::assertTrue(true); + } + + public function test_should_not_throw_even_when_kernel_is_booted(): void + { + self::getContainer(); + + Object1Factory::createOne(); + + self::assertTrue(true); + } +} diff --git a/tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithFactoriesTraitTest.php b/tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithFactoriesTraitTest.php new file mode 100644 index 00000000..b958adf4 --- /dev/null +++ b/tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithFactoriesTraitTest.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Zenstruck\Foundry\Tests\Fixture\ForceFactoriesTraitUsage; + +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; +use Zenstruck\Foundry\Test\Factories; +use Zenstruck\Foundry\Tests\Fixture\Factories\Object1Factory; + +final class KernelTestCaseWithFactoriesTraitTest extends KernelTestCase +{ + use Factories; + + public function test_should_not_throw(): void + { + Object1Factory::createOne(); + + self::assertTrue(true); + } + + public function test_should_not_throw_even_when_kernel_is_booted(): void + { + self::getContainer(); + + Object1Factory::createOne(); + + self::assertTrue(true); + } +} diff --git a/tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithoutFactoriesButWithResetDatabaseTraitTest.php b/tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithoutFactoriesButWithResetDatabaseTraitTest.php new file mode 100644 index 00000000..a7b70430 --- /dev/null +++ b/tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithoutFactoriesButWithResetDatabaseTraitTest.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Zenstruck\Foundry\Tests\Fixture\ForceFactoriesTraitUsage; + +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; +use Zenstruck\Foundry\Test\ResetDatabase; +use Zenstruck\Foundry\Tests\Fixture\Factories\Object1Factory; + +final class KernelTestCaseWithoutFactoriesButWithResetDatabaseTraitTest extends KernelTestCase +{ + use ResetDatabase; + + public function test_using_foundry_without_trait_should_throw(): void + { + Object1Factory::createOne(); + } + + public function test_using_foundry_without_trait_should_throw_even_when_kernel_is_booted(): void + { + self::getContainer(); + + Object1Factory::createOne(); + } +} diff --git a/tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithoutFactoriesTraitTest.php b/tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithoutFactoriesTraitTest.php new file mode 100644 index 00000000..c489eded --- /dev/null +++ b/tests/Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithoutFactoriesTraitTest.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Zenstruck\Foundry\Tests\Fixture\ForceFactoriesTraitUsage; + +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; +use Zenstruck\Foundry\Tests\Fixture\Factories\Object1Factory; + +final class KernelTestCaseWithoutFactoriesTraitTest extends KernelTestCase +{ + public function test_using_foundry_without_trait_should_throw(): void + { + Object1Factory::createOne(); + } + + public function test_using_foundry_without_trait_should_throw_even_when_kernel_is_booted(): void + { + self::getContainer(); + + Object1Factory::createOne(); + } +} diff --git a/tests/Fixture/ForceFactoriesTraitUsage/UnitTestCaseWithFactoriesTraitTest.php b/tests/Fixture/ForceFactoriesTraitUsage/UnitTestCaseWithFactoriesTraitTest.php new file mode 100644 index 00000000..81d620f3 --- /dev/null +++ b/tests/Fixture/ForceFactoriesTraitUsage/UnitTestCaseWithFactoriesTraitTest.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Zenstruck\Foundry\Tests\Fixture\ForceFactoriesTraitUsage; + +use PHPUnit\Framework\TestCase; +use Zenstruck\Foundry\Test\Factories; +use Zenstruck\Foundry\Tests\Fixture\Factories\Object1Factory; + +final class UnitTestCaseWithFactoriesTraitTest extends TestCase +{ + use Factories; + + public function test_should_throw(): void + { + Object1Factory::createOne(); + + self::assertTrue(true); + } +} diff --git a/tests/Fixture/ForceFactoriesTraitUsage/UnitTestCaseWithoutFactoriesTraitTest.php b/tests/Fixture/ForceFactoriesTraitUsage/UnitTestCaseWithoutFactoriesTraitTest.php new file mode 100644 index 00000000..a1cb39e2 --- /dev/null +++ b/tests/Fixture/ForceFactoriesTraitUsage/UnitTestCaseWithoutFactoriesTraitTest.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Zenstruck\Foundry\Tests\Fixture\ForceFactoriesTraitUsage; + +use PHPUnit\Framework\TestCase; +use Zenstruck\Foundry\Tests\Fixture\Factories\Object1Factory; + +final class UnitTestCaseWithoutFactoriesTraitTest extends TestCase +{ + public function test_should_throw(): void + { + Object1Factory::createOne(); + + self::assertTrue(true); + } +} diff --git a/tests/Integration/Maker/MakerTestCase.php b/tests/Integration/Maker/MakerTestCase.php index 1e830d3d..2984dd64 100644 --- a/tests/Integration/Maker/MakerTestCase.php +++ b/tests/Integration/Maker/MakerTestCase.php @@ -14,6 +14,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\String\Slugger\AsciiSlugger; +use Zenstruck\Foundry\Test\Factories; /** * @author Kevin Bond @@ -21,6 +22,8 @@ */ abstract class MakerTestCase extends KernelTestCase { + use Factories; + /** * @before */