refactor: supprimer tout le code legacy MVC/Twig/Stimulus
Supprime toutes les couches pré-DDD pour ne garder que l'architecture hexagonale (src/Domain/), les entités Doctrine et le front Vue.js SPA. Supprimé : - src/Controller/ (9 controllers Twig, garde SecurityController) - src/Service/, src/Message/, src/MessageHandler/ (services et messages legacy) - src/Manager/, src/Twig/, src/Form/ (UI legacy) - src/Event/, src/EventListener/, src/EventSubscriber/QueueStatusSubscriber - src/Client/MangadexClient.php (doublon du Domain) - src/Interface/, src/Factory/, src/DataFixtures/, src/Scheduler/MainSchedule - templates/ (tous sauf vue/ et base retiré — SecurityController = pur JSON) - assets/controllers/ (20 Stimulus controllers), app.js, bootstrap.js, controllers.json Modifié : - config/routes.yaml : suppression du chargement des controllers legacy - config/packages/messenger.yaml : suppression des routes legacy - config/services.yaml : suppression des bindings legacy + entrées Domain\Import fantômes - webpack.config.js : suppression entry 'app' et enableStimulusBridge - src/Entity/Chapter.php : suppression #[Broadcast] (Turbo Streams legacy) Déplacé : - src/Factory/*.php → tests/Factory/ (namespace App\Tests\Factory)
This commit is contained in:
parent
d7e6bf56d0
commit
5a0888eb28
69
tests/Factory/ApiTokenFactory.php
Normal file
69
tests/Factory/ApiTokenFactory.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Factory;
|
||||
|
||||
use App\Entity\ApiToken;
|
||||
use App\Repository\ApiTokenRepository;
|
||||
use Zenstruck\Foundry\ModelFactory;
|
||||
use Zenstruck\Foundry\Proxy;
|
||||
use Zenstruck\Foundry\RepositoryProxy;
|
||||
|
||||
/**
|
||||
* @extends ModelFactory<ApiToken>
|
||||
*
|
||||
* @method ApiToken|Proxy create(array|callable $attributes = [])
|
||||
* @method static ApiToken|Proxy createOne(array $attributes = [])
|
||||
* @method static ApiToken|Proxy find(object|array|mixed $criteria)
|
||||
* @method static ApiToken|Proxy findOrCreate(array $attributes)
|
||||
* @method static ApiToken|Proxy first(string $sortedField = 'id')
|
||||
* @method static ApiToken|Proxy last(string $sortedField = 'id')
|
||||
* @method static ApiToken|Proxy random(array $attributes = [])
|
||||
* @method static ApiToken|Proxy randomOrCreate(array $attributes = [])
|
||||
* @method static ApiTokenRepository|RepositoryProxy repository()
|
||||
* @method static ApiToken[]|Proxy[] all()
|
||||
* @method static ApiToken[]|Proxy[] createMany(int $number, array|callable $attributes = [])
|
||||
* @method static ApiToken[]|Proxy[] createSequence(iterable|callable $sequence)
|
||||
* @method static ApiToken[]|Proxy[] findBy(array $attributes)
|
||||
* @method static ApiToken[]|Proxy[] randomRange(int $min, int $max, array $attributes = [])
|
||||
* @method static ApiToken[]|Proxy[] randomSet(int $number, array $attributes = [])
|
||||
*/
|
||||
final class ApiTokenFactory extends ModelFactory
|
||||
{
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
|
||||
*
|
||||
* @todo inject services if required
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
|
||||
*
|
||||
* @todo add your default values here
|
||||
*/
|
||||
protected function getDefaults(): array
|
||||
{
|
||||
return [
|
||||
'ownedBy' => UserFactory::new(),
|
||||
'scopes' => [],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
|
||||
*/
|
||||
protected function initialize(): self
|
||||
{
|
||||
return $this
|
||||
// ->afterInstantiate(function(ApiToken $apiToken): void {})
|
||||
;
|
||||
}
|
||||
|
||||
protected static function getClass(): string
|
||||
{
|
||||
return ApiToken::class;
|
||||
}
|
||||
}
|
||||
75
tests/Factory/ChapterFactory.php
Normal file
75
tests/Factory/ChapterFactory.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Factory;
|
||||
|
||||
use App\Entity\Chapter;
|
||||
use App\Repository\ChapterRepository;
|
||||
use Zenstruck\Foundry\ModelFactory;
|
||||
use Zenstruck\Foundry\Proxy;
|
||||
use Zenstruck\Foundry\RepositoryProxy;
|
||||
|
||||
/**
|
||||
* @extends ModelFactory<Chapter>
|
||||
*
|
||||
* @method Chapter|Proxy create(array|callable $attributes = [])
|
||||
* @method static Chapter|Proxy createOne(array $attributes = [])
|
||||
* @method static Chapter|Proxy find(object|array|mixed $criteria)
|
||||
* @method static Chapter|Proxy findOrCreate(array $attributes)
|
||||
* @method static Chapter|Proxy first(string $sortedField = 'id')
|
||||
* @method static Chapter|Proxy last(string $sortedField = 'id')
|
||||
* @method static Chapter|Proxy random(array $attributes = [])
|
||||
* @method static Chapter|Proxy randomOrCreate(array $attributes = [])
|
||||
* @method static ChapterRepository|RepositoryProxy repository()
|
||||
* @method static Chapter[]|Proxy[] all()
|
||||
* @method static Chapter[]|Proxy[] createMany(int $number, array|callable $attributes = [])
|
||||
* @method static Chapter[]|Proxy[] createSequence(iterable|callable $sequence)
|
||||
* @method static Chapter[]|Proxy[] findBy(array $attributes)
|
||||
* @method static Chapter[]|Proxy[] randomRange(int $min, int $max, array $attributes = [])
|
||||
* @method static Chapter[]|Proxy[] randomSet(int $number, array $attributes = [])
|
||||
*/
|
||||
final class ChapterFactory extends ModelFactory
|
||||
{
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
|
||||
*
|
||||
* @todo inject services if required
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
|
||||
*
|
||||
* @todo add your default values here
|
||||
*/
|
||||
protected function getDefaults(): array
|
||||
{
|
||||
return [
|
||||
'manga' => MangaFactory::new(),
|
||||
'number' => self::faker()->randomFloat(2, 0, 999),
|
||||
'volume' => self::faker()->optional()->numberBetween(1, 100),
|
||||
'title' => self::faker()->optional()->sentence(3),
|
||||
'localPath' => self::faker()->optional()->filePath(),
|
||||
'externalId' => self::faker()->optional()->uuid(),
|
||||
'cbzPath' => self::faker()->optional()->filePath(),
|
||||
'visible' => true,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
|
||||
*/
|
||||
protected function initialize(): self
|
||||
{
|
||||
return $this
|
||||
// ->afterInstantiate(function(Chapter $chapter): void {})
|
||||
;
|
||||
}
|
||||
|
||||
protected static function getClass(): string
|
||||
{
|
||||
return Chapter::class;
|
||||
}
|
||||
}
|
||||
78
tests/Factory/MangaFactory.php
Normal file
78
tests/Factory/MangaFactory.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Factory;
|
||||
|
||||
use App\Entity\Manga;
|
||||
use App\Repository\MangaRepository;
|
||||
use Zenstruck\Foundry\ModelFactory;
|
||||
use Zenstruck\Foundry\Proxy;
|
||||
use Zenstruck\Foundry\RepositoryProxy;
|
||||
|
||||
/**
|
||||
* @extends ModelFactory<Manga>
|
||||
*
|
||||
* @method Manga|Proxy create(array|callable $attributes = [])
|
||||
* @method static Manga|Proxy createOne(array $attributes = [])
|
||||
* @method static Manga|Proxy find(object|array|mixed $criteria)
|
||||
* @method static Manga|Proxy findOrCreate(array $attributes)
|
||||
* @method static Manga|Proxy first(string $sortedField = 'id')
|
||||
* @method static Manga|Proxy last(string $sortedField = 'id')
|
||||
* @method static Manga|Proxy random(array $attributes = [])
|
||||
* @method static Manga|Proxy randomOrCreate(array $attributes = [])
|
||||
* @method static MangaRepository|RepositoryProxy repository()
|
||||
* @method static Manga[]|Proxy[] all()
|
||||
* @method static Manga[]|Proxy[] createMany(int $number, array|callable $attributes = [])
|
||||
* @method static Manga[]|Proxy[] createSequence(iterable|callable $sequence)
|
||||
* @method static Manga[]|Proxy[] findBy(array $attributes)
|
||||
* @method static Manga[]|Proxy[] randomRange(int $min, int $max, array $attributes = [])
|
||||
* @method static Manga[]|Proxy[] randomSet(int $number, array $attributes = [])
|
||||
*/
|
||||
final class MangaFactory extends ModelFactory
|
||||
{
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
|
||||
*
|
||||
* @todo inject services if required
|
||||
*/
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
|
||||
*
|
||||
* @todo add your default values here
|
||||
*/
|
||||
protected function getDefaults(): array
|
||||
{
|
||||
$title = self::faker()->words(rand(1, 3), true);
|
||||
|
||||
return [
|
||||
'title' => $title,
|
||||
'slug' => strtolower(str_replace(' ', '-', $title)),
|
||||
'imageUrl' => self::faker()->optional()->imageUrl(),
|
||||
'publicationYear' => self::faker()->optional()->year(),
|
||||
'description' => self::faker()->optional()->text(),
|
||||
'genres' => self::faker()->optional()->words(rand(1, 5)),
|
||||
'createdAt' => \DateTimeImmutable::createFromMutable(self::faker()->dateTime()),
|
||||
'rating' => self::faker()->optional()->randomFloat(1, 0, 10),
|
||||
'author' => self::faker()->optional()->name(),
|
||||
'externalId' => self::faker()->optional()->uuid(),
|
||||
'status' => self::faker()->optional()->randomElement(['ongoing', 'completed', 'hiatus']),
|
||||
'thumbnailUrl' => self::faker()->optional()->imageUrl(150, 150),
|
||||
'monitored' => self::faker()->boolean(),
|
||||
'AlternativeSlugs' => self::faker()->optional()->words(3),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
|
||||
*/
|
||||
protected function initialize(): self
|
||||
{
|
||||
return $this
|
||||
// ->afterInstantiate(function(Manga $manga): void {})
|
||||
;
|
||||
}
|
||||
|
||||
protected static function getClass(): string
|
||||
{
|
||||
return Manga::class;
|
||||
}
|
||||
}
|
||||
71
tests/Factory/PageFactory.php
Normal file
71
tests/Factory/PageFactory.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Factory;
|
||||
|
||||
use App\Entity\Page;
|
||||
use App\Repository\PageRepository;
|
||||
use Zenstruck\Foundry\ModelFactory;
|
||||
use Zenstruck\Foundry\Proxy;
|
||||
use Zenstruck\Foundry\RepositoryProxy;
|
||||
|
||||
/**
|
||||
* @extends ModelFactory<Page>
|
||||
*
|
||||
* @method Page|Proxy create(array|callable $attributes = [])
|
||||
* @method static Page|Proxy createOne(array $attributes = [])
|
||||
* @method static Page|Proxy find(object|array|mixed $criteria)
|
||||
* @method static Page|Proxy findOrCreate(array $attributes)
|
||||
* @method static Page|Proxy first(string $sortedField = 'id')
|
||||
* @method static Page|Proxy last(string $sortedField = 'id')
|
||||
* @method static Page|Proxy random(array $attributes = [])
|
||||
* @method static Page|Proxy randomOrCreate(array $attributes = [])
|
||||
* @method static PageRepository|RepositoryProxy repository()
|
||||
* @method static Page[]|Proxy[] all()
|
||||
* @method static Page[]|Proxy[] createMany(int $number, array|callable $attributes = [])
|
||||
* @method static Page[]|Proxy[] createSequence(iterable|callable $sequence)
|
||||
* @method static Page[]|Proxy[] findBy(array $attributes)
|
||||
* @method static Page[]|Proxy[] randomRange(int $min, int $max, array $attributes = [])
|
||||
* @method static Page[]|Proxy[] randomSet(int $number, array $attributes = [])
|
||||
*/
|
||||
final class PageFactory extends ModelFactory
|
||||
{
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
|
||||
*
|
||||
* @todo inject services if required
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
|
||||
*
|
||||
* @todo add your default values here
|
||||
*/
|
||||
protected function getDefaults(): array
|
||||
{
|
||||
return [
|
||||
'chapter' => ChapterFactory::new(),
|
||||
'imageLocalUrl' => 'https://placehold.co/770x1090',
|
||||
'imageUrl' => 'https://placehold.co/770x1090',
|
||||
'number' => self::faker()->randomNumber(2),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
|
||||
*/
|
||||
protected function initialize(): self
|
||||
{
|
||||
return $this
|
||||
// ->afterInstantiate(function(Page $page): void {})
|
||||
;
|
||||
}
|
||||
|
||||
protected static function getClass(): string
|
||||
{
|
||||
return Page::class;
|
||||
}
|
||||
}
|
||||
74
tests/Factory/SourceFactory.php
Normal file
74
tests/Factory/SourceFactory.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Factory;
|
||||
|
||||
use App\Entity\Source;
|
||||
use App\Repository\SourceRepository;
|
||||
use Zenstruck\Foundry\ModelFactory;
|
||||
use Zenstruck\Foundry\Proxy;
|
||||
use Zenstruck\Foundry\RepositoryProxy;
|
||||
|
||||
/**
|
||||
* @extends ModelFactory<Source>
|
||||
*
|
||||
* @method Source|Proxy create(array|callable $attributes = [])
|
||||
* @method static Source|Proxy createOne(array $attributes = [])
|
||||
* @method static Source|Proxy find(object|array|mixed $criteria)
|
||||
* @method static Source|Proxy findOrCreate(array $attributes)
|
||||
* @method static Source|Proxy first(string $sortedField = 'id')
|
||||
* @method static Source|Proxy last(string $sortedField = 'id')
|
||||
* @method static Source|Proxy random(array $attributes = [])
|
||||
* @method static Source|Proxy randomOrCreate(array $attributes = [])
|
||||
* @method static SourceRepository|RepositoryProxy repository()
|
||||
* @method static Source[]|Proxy[] all()
|
||||
* @method static Source[]|Proxy[] createMany(int $number, array|callable $attributes = [])
|
||||
* @method static Source[]|Proxy[] createSequence(iterable|callable $sequence)
|
||||
* @method static Source[]|Proxy[] findBy(array $attributes)
|
||||
* @method static Source[]|Proxy[] randomRange(int $min, int $max, array $attributes = [])
|
||||
* @method static Source[]|Proxy[] randomSet(int $number, array $attributes = [])
|
||||
*/
|
||||
final class SourceFactory extends ModelFactory
|
||||
{
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
|
||||
*
|
||||
* @todo inject services if required
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
|
||||
*
|
||||
* @todo add your default values here
|
||||
*/
|
||||
protected function getDefaults(): array
|
||||
{
|
||||
return [
|
||||
'name' => self::faker()->optional()->company(),
|
||||
'description' => self::faker()->optional()->text(),
|
||||
'baseUrl' => self::faker()->url(),
|
||||
'scrappingParameters' => [],
|
||||
'isActive' => self::faker()->boolean(),
|
||||
'createdAt' => \DateTimeImmutable::createFromMutable(self::faker()->dateTime()),
|
||||
'updatedAt' => \DateTimeImmutable::createFromMutable(self::faker()->dateTime()),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
|
||||
*/
|
||||
protected function initialize(): self
|
||||
{
|
||||
return $this
|
||||
// ->afterInstantiate(function(Source $source): void {})
|
||||
;
|
||||
}
|
||||
|
||||
protected static function getClass(): string
|
||||
{
|
||||
return Source::class;
|
||||
}
|
||||
}
|
||||
79
tests/Factory/UserFactory.php
Normal file
79
tests/Factory/UserFactory.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* @extends ModelFactory<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 = [])
|
||||
*/
|
||||
final class UserFactory extends ModelFactory
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
|
||||
*
|
||||
*/
|
||||
protected function getDefaults(): array
|
||||
{
|
||||
return [
|
||||
'email' => self::faker()->unique()->email(),
|
||||
'password' => 'password',
|
||||
'roles' => [],
|
||||
'firstName' => self::faker()->randomElement(self::FIRST_NAMES),
|
||||
'lastName' => self::faker()->randomElement(self::LAST_NAMES),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
|
||||
*/
|
||||
protected function initialize(): self
|
||||
{
|
||||
return $this
|
||||
->afterInstantiate(function (User $user): void {
|
||||
$user->setPassword($this->passwordHasher->hashPassword(
|
||||
$user,
|
||||
$user->getPassword()
|
||||
));
|
||||
})
|
||||
;
|
||||
}
|
||||
|
||||
protected static function getClass(): string
|
||||
{
|
||||
return User::class;
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\Tests\Feature\Manga;
|
||||
|
||||
use App\Entity\Chapter;
|
||||
use App\Factory\ChapterFactory;
|
||||
use App\Factory\MangaFactory;
|
||||
use App\Tests\Factory\ChapterFactory;
|
||||
use App\Tests\Factory\MangaFactory;
|
||||
use App\Tests\Feature\AbstractApiTestCase;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Zenstruck\Foundry\Test\Factories;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\Tests\Feature\Manga;
|
||||
|
||||
use App\Entity\Chapter;
|
||||
use App\Factory\ChapterFactory;
|
||||
use App\Factory\MangaFactory;
|
||||
use App\Tests\Factory\ChapterFactory;
|
||||
use App\Tests\Factory\MangaFactory;
|
||||
use App\Tests\Feature\AbstractApiTestCase;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Zenstruck\Foundry\Test\Factories;
|
||||
|
||||
@@ -4,8 +4,8 @@ namespace App\Tests\Feature\Manga;
|
||||
|
||||
use App\Entity\Manga;
|
||||
use App\Entity\Chapter;
|
||||
use App\Factory\MangaFactory;
|
||||
use App\Factory\ChapterFactory;
|
||||
use App\Tests\Factory\MangaFactory;
|
||||
use App\Tests\Factory\ChapterFactory;
|
||||
use App\Tests\Feature\AbstractApiTestCase;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Zenstruck\Foundry\Test\Factories;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\Tests\Feature\Manga;
|
||||
|
||||
use App\Entity\Chapter;
|
||||
use App\Factory\ChapterFactory;
|
||||
use App\Factory\MangaFactory;
|
||||
use App\Tests\Factory\ChapterFactory;
|
||||
use App\Tests\Factory\MangaFactory;
|
||||
use App\Tests\Feature\AbstractApiTestCase;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Zenstruck\Foundry\Test\Factories;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\Tests\Feature\Manga;
|
||||
|
||||
use App\Entity\Chapter;
|
||||
use App\Factory\ChapterFactory;
|
||||
use App\Factory\MangaFactory;
|
||||
use App\Tests\Factory\ChapterFactory;
|
||||
use App\Tests\Factory\MangaFactory;
|
||||
use App\Tests\Feature\AbstractApiTestCase;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Zenstruck\Foundry\Test\Factories;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\Tests\Feature\Manga;
|
||||
|
||||
use App\Entity\Manga;
|
||||
use App\Factory\MangaFactory;
|
||||
use App\Tests\Factory\MangaFactory;
|
||||
use App\Tests\Feature\AbstractApiTestCase;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Zenstruck\Foundry\Test\Factories;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\Tests\Feature\Manga;
|
||||
|
||||
use App\Entity\Manga;
|
||||
use App\Factory\ChapterFactory;
|
||||
use App\Factory\MangaFactory;
|
||||
use App\Tests\Factory\ChapterFactory;
|
||||
use App\Tests\Factory\MangaFactory;
|
||||
use App\Tests\Feature\AbstractApiTestCase;
|
||||
use Zenstruck\Foundry\Test\Factories;
|
||||
use Zenstruck\Foundry\Test\ResetDatabase;
|
||||
|
||||
@@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Feature\Reader;
|
||||
|
||||
use App\Factory\ChapterFactory;
|
||||
use App\Factory\MangaFactory;
|
||||
use App\Tests\Factory\ChapterFactory;
|
||||
use App\Tests\Factory\MangaFactory;
|
||||
use App\Tests\Feature\AbstractApiTestCase;
|
||||
use Zenstruck\Foundry\Test\ResetDatabase;
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Feature\Reader;
|
||||
|
||||
use App\Factory\ChapterFactory;
|
||||
use App\Factory\MangaFactory;
|
||||
use App\Tests\Factory\ChapterFactory;
|
||||
use App\Tests\Factory\MangaFactory;
|
||||
use App\Tests\Feature\AbstractApiTestCase;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Zenstruck\Foundry\Test\ResetDatabase;
|
||||
|
||||
Reference in New Issue
Block a user