Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🗑️ deprecate fixtures-related features #22

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ services:

### Fixtures-related

⚠️️ **Warning**: these features are now deprecated and will be removed in the next major version.

* Fast fixtures load

Load fixtures simply with `$this->loadFixtures(['YourFixtureClassName', 'YourOtherFixtureClassName'])`.
Expand Down
7 changes: 6 additions & 1 deletion src/Test/WebTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

abstract class WebTestCase extends SymfonyWebTestCase
{
protected static ?EntityManagerInterface $em = null;
protected static ?EntityManagerInterface $em = null; // @deprecated
protected static KernelBrowser $client;
private ?AbstractFixture $fixture = null;
protected static ?string $authUser = null;
Expand Down Expand Up @@ -174,13 +174,15 @@ protected static function getTxtFile(string $file = '0'): UploadedFile
*
* @throws \Doctrine\DBAL\Exception
* @throws \InvalidArgumentException
* @deprecated
*/
protected function loadFixtures(
array $fixtures,
string $namespace = 'App\\DataFixtures\\ORM\\',
?string $managerService = null,
bool $append = false,
): void {
trigger_error('loadFixtures is deprecated and will be removed in the next major version', E_USER_DEPRECATED);
if (null !== $managerService) {
$manager = static::$container->get($managerService);
if (!$manager instanceof EntityManagerInterface) {
Expand Down Expand Up @@ -249,9 +251,11 @@ protected static function commandTest(

/**
* Get an entity by its fixtures reference name.
* @deprecated
*/
protected function getReference(string $name): object
{
trigger_error('getReference is deprecated and will be removed in the next major version', E_USER_DEPRECATED);
if (null === $this->fixture) {
throw new \RuntimeException('Load some fixtures before.');
}
Expand Down Expand Up @@ -364,6 +368,7 @@ private static function findCheckbox(Form $form, string $name, string $value): C
/**
* Load a single fixture class
* (with possible other dependent fixture classes).
* @deprecated
*/
private function loadFixtureClass(Loader $loader, string $className): void
{
Expand Down
Loading