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
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user