feat: migrer vers Symfony 8, PHP 8.4 et les dépendances majeures associées
- PHP 8.3 → 8.4 (Dockerfile + composer.json) - Symfony 7.0 → 8.0 (tous les composants symfony/*) - API Platform 3.x → 4.x : migration openapiContext → openapi: new Operation(...) - Doctrine DBAL 3 → 4 : suppression use_savepoints, replace prepare/executeQuery - Doctrine ORM 2.x → 3.x : ClassMetadataInfo → ClassMetadata, setParameters → setParameter - Doctrine Bundle 2.x → 3.x, Fixtures Bundle 3.x → 4.x - zenstruck/foundry 1.x → 2.x : ModelFactory → PersistentObjectFactory, getDefaults → defaults - phpmd/phpmd 2.x → 3.x-dev (seule version supportant Symfony 8) - phparkitect 0.3 → 0.8 : NotDependsOnTheseNamespaces prend un array - symfony/mercure-bundle 0.3 → 0.4, symfony/monolog-bundle 3 → 4 - Suppression de runtime/frankenphp-symfony (intégré nativement dans symfony/runtime 8) - worker.Caddyfile : suppression de APP_RUNTIME (détection automatique Symfony 8) - Routes errors.xml/wdt.xml/profiler.xml → .php (Symfony 8 supprime le XML) - Types::ARRAY → Types::JSON dans Entity/Manga.php (DBAL 4 retire array type) - Suppression de src/Schedule.php (doublon vide avec MonitoringSchedule) - Tests : hydra:Collection → Collection, hydra:member → member (API Platform 4)
This commit is contained in:
parent
5a0888eb28
commit
5ed303612a
@@ -5,48 +5,50 @@ namespace App\Tests\Factory;
|
||||
use App\Entity\User;
|
||||
use App\Repository\UserRepository;
|
||||
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
|
||||
use Zenstruck\Foundry\ModelFactory;
|
||||
use Zenstruck\Foundry\Proxy;
|
||||
use Zenstruck\Foundry\RepositoryProxy;
|
||||
use Zenstruck\Foundry\Persistence\PersistentObjectFactory;
|
||||
use Zenstruck\Foundry\Persistence\RepositoryDecorator;
|
||||
|
||||
/**
|
||||
* @extends ModelFactory<User>
|
||||
* @extends PersistentObjectFactory<User>
|
||||
*
|
||||
* @method User|Proxy create(array|callable $attributes = [])
|
||||
* @method static User|Proxy createOne(array $attributes = [])
|
||||
* @method static User|Proxy find(object|array|mixed $criteria)
|
||||
* @method static User|Proxy findOrCreate(array $attributes)
|
||||
* @method static User|Proxy first(string $sortedField = 'id')
|
||||
* @method static User|Proxy last(string $sortedField = 'id')
|
||||
* @method static User|Proxy random(array $attributes = [])
|
||||
* @method static User|Proxy randomOrCreate(array $attributes = [])
|
||||
* @method static UserRepository|RepositoryProxy repository()
|
||||
* @method static User[]|Proxy[] all()
|
||||
* @method static User[]|Proxy[] createMany(int $number, array|callable $attributes = [])
|
||||
* @method static User[]|Proxy[] createSequence(iterable|callable $sequence)
|
||||
* @method static User[]|Proxy[] findBy(array $attributes)
|
||||
* @method static User[]|Proxy[] randomRange(int $min, int $max, array $attributes = [])
|
||||
* @method static User[]|Proxy[] randomSet(int $number, array $attributes = [])
|
||||
* @method User create(array|callable $attributes = [])
|
||||
* @method static User createOne(array $attributes = [])
|
||||
* @method static User find(object|array|mixed $criteria)
|
||||
* @method static User findOrCreate(array $attributes)
|
||||
* @method static User first(string $sortedField = 'id')
|
||||
* @method static User last(string $sortedField = 'id')
|
||||
* @method static User random(array $attributes = [])
|
||||
* @method static User randomOrCreate(array $attributes = [])
|
||||
* @method static UserRepository&RepositoryDecorator repository()
|
||||
* @method static list<User> all()
|
||||
* @method static list<User> createMany(int $number, array|callable $attributes = [])
|
||||
* @method static list<User> createSequence(iterable|callable $sequence)
|
||||
* @method static list<User> findBy(array $attributes)
|
||||
* @method static list<User> randomRange(int $min, int $max, array $attributes = [])
|
||||
* @method static list<User> randomSet(int $number, array $attributes = [])
|
||||
*/
|
||||
final class UserFactory extends ModelFactory
|
||||
final class UserFactory extends PersistentObjectFactory
|
||||
{
|
||||
public const array FIRST_NAMES = ["ALAIN", "ALEXANDRE", "ANDRÉ", "ANNIE", "ANTHONY", "AUDREY", "AURÉLIE", "BERNARD", "BRIGITTE", "BRUNO", "CATHERINE", "CEDRIC", "CHANTAL", "CHRISTELLE", "CHRISTIAN", "CHRISTIANE", "CHRISTINE", "CHRISTOPHE", "CLAUDE", "CORINNE", "CÉLINE", "DANIEL", "DANIELLE", "DAVID", "DENISE", "DIDIER", "DOMINIQUE", "ELODIE", "EMILIE", "ENZO", "ERIC", "FABRICE", "FLORENCE", "FRANCK", "FRANÇOISE", "FRÉDÉRIC", "GEORGES", "GERMAINE", "GUILLAUME", "GUY", "GÉRARD", "HENRI", "ISABELLE", "JACQUELINE", "JACQUES", "JEAN", "JEAN-CLAUDE", "JEAN-PIERRE", "JEANNE", "JEANNINE", "JEREMY", "JEROME", "JONATHAN", "JOSEPH", "JULIE", "JULIEN", "KARINE", "KEVIN", "LAETITIA", "LAURA", "LAURENCE", "LAURENT", "LOUIS", "LUCAS", "LÉA", "MADELEINE", "MANON", "MARCEL", "MARCELLE", "MARGUERITE", "MARIE", "MARINE", "MARTINE", "MAURICE", "MAXIME", "MICHEL", "MICHÈLE", "MONIQUE", "NATHALIE", "NICOLAS", "NICOLE", "ODETTE", "OLIVIER", "PASCAL", "PASCALE", "PATRICIA", "PATRICK", "PAUL", "PAULETTE", "PHILIPPE", "PIERRE", "RENÉ", "ROBERT", "ROGER", "ROMAIN", "SANDRA", "SANDRINE", "SERGE", "SOPHIE", "STÉPHANE", "STÉPHANIE", "SUZANNE", "SYLVIE", "SÉBASTIEN", "THIERRY", "THOMAS", "THÉO", "VALÉRIE", "VIRGINIE", "VÉRONIQUE", "YVETTE", "YVONNE"];
|
||||
public const array LAST_NAMES = ["Adam", "Andre", "Antoine", "Arnaud", "Aubert", "Aubry", "Bailly", "Barbier", "Baron", "Barre", "Barthelemy", "Benard", "Benoit", "Berger", "Bernard", "Bertin", "Bertrand", "Besson", "Blanc", "Blanchard", "Bonnet", "Boucher", "Bouchet", "Boulanger", "Bourgeois", "Bouvier", "Boyer", "Breton", "Brun", "Brunet", "Carlier", "Caron", "Carpentier", "Carre", "Charles", "Charpentier", "Chauvin", "Chevalier", "Chevallier", "Clement", "Colin", "Collet", "Collin", "Cordier", "Cousin", "Da Silva", "Daniel", "David", "Delaunay", "Denis", "Deschamps", "Dubois", "Dufour", "Dumas", "Dumont", "Dupont", "Dupuis", "Dupuy", "Durand", "Duval", "Etienne", "Fabre", "Faure", "Fernandez", "Fleury", "Fontaine", "Fournier", "Francois", "Gaillard", "Garcia", "Garnier", "Gauthier", "Gautier", "Gay", "Gerard", "Germain", "Gilbert", "Gillet", "Girard", "Giraud", "Gonzalez", "Grondin", "Guerin", "Guichard", "Guillaume", "Guillot", "Guyot", "Hamon", "Henry", "Herve", "Hoarau", "Hubert", "Huet", "Humbert", "Jacob", "Jacquet", "Jean", "Joly", "Julien", "Klein", "Lacroix", "Lambert", "Lamy", "Langlois", "Laporte", "Laurent", "Le Gall", "Le Goff", "Le Roux", "Leblanc", "Lebrun", "Leclerc", "Leclercq", "Lecomte", "Lefebvre", "Lefevre", "Leger", "Legrand", "Lejeune", "Lemaire", "Lemaitre", "Lemoine", "Leroux", "Leroy", "Leveque", "Lopez", "Louis", "Lucas", "Maillard", "Mallet", "Marchal", "Marchand", "Marechal", "Marie", "Martin", "Martinez", "Marty", "Masson", "Mathieu", "Menard", "Mercier", "Meunier", "Meyer", "Michaud", "Michel", "Millet", "Monnier", "Moreau", "Morel", "Morin", "Moulin", "Muller", "Nicolas", "Noel", "Olivier", "Paris", "Pasquier", "Payet", "Pelletier", "Perez", "Perret", "Perrier", "Perrin", "Perrot", "Petit", "Philippe", "Picard", "Pichon", "Pierre", "Poirier", "Poulain", "Prevost", "Remy", "Renard", "Renaud", "Renault", "Rey", "Reynaud", "Richard", "Riviere", "Robert", "Robin", "Roche", "Rodriguez", "Roger", "Rolland", "Rousseau", "Roussel", "Roux", "Roy", "Royer", "Sanchez", "Schmitt", "Schneider", "Simon", "Tessier", "Thomas", "Vasseur", "Vidal", "Vincent", "Weber"];
|
||||
public const array FIRST_NAMES = ['ALAIN', 'ALEXANDRE', 'ANDRÉ', 'ANNIE', 'ANTHONY', 'AUDREY', 'AURÉLIE', 'BERNARD', 'BRIGITTE', 'BRUNO', 'CATHERINE', 'CEDRIC', 'CHANTAL', 'CHRISTELLE', 'CHRISTIAN', 'CHRISTIANE', 'CHRISTINE', 'CHRISTOPHE', 'CLAUDE', 'CORINNE', 'CÉLINE', 'DANIEL', 'DANIELLE', 'DAVID', 'DENISE', 'DIDIER', 'DOMINIQUE', 'ELODIE', 'EMILIE', 'ENZO', 'ERIC', 'FABRICE', 'FLORENCE', 'FRANCK', 'FRANÇOISE', 'FRÉDÉRIC', 'GEORGES', 'GERMAINE', 'GUILLAUME', 'GUY', 'GÉRARD', 'HENRI', 'ISABELLE', 'JACQUELINE', 'JACQUES', 'JEAN', 'JEAN-CLAUDE', 'JEAN-PIERRE', 'JEANNE', 'JEANNINE', 'JEREMY', 'JEROME', 'JONATHAN', 'JOSEPH', 'JULIE', 'JULIEN', 'KARINE', 'KEVIN', 'LAETITIA', 'LAURA', 'LAURENCE', 'LAURENT', 'LOUIS', 'LUCAS', 'LÉA', 'MADELEINE', 'MANON', 'MARCEL', 'MARCELLE', 'MARGUERITE', 'MARIE', 'MARINE', 'MARTINE', 'MAURICE', 'MAXIME', 'MICHEL', 'MICHÈLE', 'MONIQUE', 'NATHALIE', 'NICOLAS', 'NICOLE', 'ODETTE', 'OLIVIER', 'PASCAL', 'PASCALE', 'PATRICIA', 'PATRICK', 'PAUL', 'PAULETTE', 'PHILIPPE', 'PIERRE', 'RENÉ', 'ROBERT', 'ROGER', 'ROMAIN', 'SANDRA', 'SANDRINE', 'SERGE', 'SOPHIE', 'STÉPHANE', 'STÉPHANIE', 'SUZANNE', 'SYLVIE', 'SÉBASTIEN', 'THIERRY', 'THOMAS', 'THÉO', 'VALÉRIE', 'VIRGINIE', 'VÉRONIQUE', 'YVETTE', 'YVONNE'];
|
||||
public const array LAST_NAMES = ['Adam', 'Andre', 'Antoine', 'Arnaud', 'Aubert', 'Aubry', 'Bailly', 'Barbier', 'Baron', 'Barre', 'Barthelemy', 'Benard', 'Benoit', 'Berger', 'Bernard', 'Bertin', 'Bertrand', 'Besson', 'Blanc', 'Blanchard', 'Bonnet', 'Boucher', 'Bouchet', 'Boulanger', 'Bourgeois', 'Bouvier', 'Boyer', 'Breton', 'Brun', 'Brunet', 'Carlier', 'Caron', 'Carpentier', 'Carre', 'Charles', 'Charpentier', 'Chauvin', 'Chevalier', 'Chevallier', 'Clement', 'Colin', 'Collet', 'Collin', 'Cordier', 'Cousin', 'Da Silva', 'Daniel', 'David', 'Delaunay', 'Denis', 'Deschamps', 'Dubois', 'Dufour', 'Dumas', 'Dumont', 'Dupont', 'Dupuis', 'Dupuy', 'Durand', 'Duval', 'Etienne', 'Fabre', 'Faure', 'Fernandez', 'Fleury', 'Fontaine', 'Fournier', 'Francois', 'Gaillard', 'Garcia', 'Garnier', 'Gauthier', 'Gautier', 'Gay', 'Gerard', 'Germain', 'Gilbert', 'Gillet', 'Girard', 'Giraud', 'Gonzalez', 'Grondin', 'Guerin', 'Guichard', 'Guillaume', 'Guillot', 'Guyot', 'Hamon', 'Henry', 'Herve', 'Hoarau', 'Hubert', 'Huet', 'Humbert', 'Jacob', 'Jacquet', 'Jean', 'Joly', 'Julien', 'Klein', 'Lacroix', 'Lambert', 'Lamy', 'Langlois', 'Laporte', 'Laurent', 'Le Gall', 'Le Goff', 'Le Roux', 'Leblanc', 'Lebrun', 'Leclerc', 'Leclercq', 'Lecomte', 'Lefebvre', 'Lefevre', 'Leger', 'Legrand', 'Lejeune', 'Lemaire', 'Lemaitre', 'Lemoine', 'Leroux', 'Leroy', 'Leveque', 'Lopez', 'Louis', 'Lucas', 'Maillard', 'Mallet', 'Marchal', 'Marchand', 'Marechal', 'Marie', 'Martin', 'Martinez', 'Marty', 'Masson', 'Mathieu', 'Menard', 'Mercier', 'Meunier', 'Meyer', 'Michaud', 'Michel', 'Millet', 'Monnier', 'Moreau', 'Morel', 'Morin', 'Moulin', 'Muller', 'Nicolas', 'Noel', 'Olivier', 'Paris', 'Pasquier', 'Payet', 'Pelletier', 'Perez', 'Perret', 'Perrier', 'Perrin', 'Perrot', 'Petit', 'Philippe', 'Picard', 'Pichon', 'Pierre', 'Poirier', 'Poulain', 'Prevost', 'Remy', 'Renard', 'Renaud', 'Renault', 'Rey', 'Reynaud', 'Richard', 'Riviere', 'Robert', 'Robin', 'Roche', 'Rodriguez', 'Roger', 'Rolland', 'Rousseau', 'Roussel', 'Roux', 'Roy', 'Royer', 'Sanchez', 'Schmitt', 'Schneider', 'Simon', 'Tessier', 'Thomas', 'Vasseur', 'Vidal', 'Vincent', 'Weber'];
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
|
||||
*
|
||||
*/
|
||||
public function __construct(private readonly UserPasswordHasherInterface $passwordHasher)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public static function class(): string
|
||||
{
|
||||
return User::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
|
||||
*
|
||||
*/
|
||||
protected function getDefaults(): array
|
||||
protected function defaults(): array
|
||||
{
|
||||
return [
|
||||
'email' => self::faker()->unique()->email(),
|
||||
@@ -60,7 +62,7 @@ final class UserFactory extends ModelFactory
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
|
||||
*/
|
||||
protected function initialize(): self
|
||||
protected function initialize(): static
|
||||
{
|
||||
return $this
|
||||
->afterInstantiate(function (User $user): void {
|
||||
@@ -71,9 +73,4 @@ final class UserFactory extends ModelFactory
|
||||
})
|
||||
;
|
||||
}
|
||||
|
||||
protected static function getClass(): string
|
||||
{
|
||||
return User::class;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user