@@ -96,6 +96,18 @@ function purge(): void
9696 success (exit_code ('rm -rf ./var/cache/* ./var/log/* ./var/coverage/* ' ));
9797}
9898
99+ #[AsTask(namespace: 'app ' , description: 'Load the database fixtures ' , aliases: ['load-fixtures ' ])]
100+ function loadFixtures (): void
101+ {
102+ title ('app:load-fixtures ' );
103+ io ()->note ('Resetting db... ' );
104+ success (exit_code ('rm -f ./var/data.db ' ));
105+ io ()->note ('Running db migrations... ' );
106+ success (exit_code ('bin/console doctrine:migrations:migrate --no-interaction ' ));
107+ io ()->note ('Load fixtures... ' );
108+ success (exit_code ('bin/console foundry:load-fixtures --env=dev --no-interaction ' ));
109+ }
110+
99111const PHP_UNIT_CMD = '/vendor/bin/phpunit --testsuite=%s --filter=%s %s ' ;
100112const PHP_UNIT_SUITES = ['api ' , 'e2e ' , 'functional ' , 'integration ' , 'unit ' ];
101113
@@ -111,6 +123,7 @@ function getParameters(): array
111123function test_all (): int
112124{
113125 title ('test:all ' );
126+ loadFixtures ();
114127 [$ filter , $ options ] = getParameters ();
115128 $ ec = exit_code (__DIR__ .sprintf (PHP_UNIT_CMD , implode (', ' , PHP_UNIT_SUITES ), $ filter , $ options ));
116129 io ()->writeln ('' );
@@ -177,6 +190,7 @@ function test_unit(
177190function coverage (): int
178191{
179192 title ('test:coverage ' );
193+ loadFixtures ();
180194 $ ec = exit_code ('php -d xdebug.enable=1 -d memory_limit=-1 vendor/bin/phpunit --coverage-html=var/coverage --coverage-clover=var/coverage/clover.xml ' ,
181195 context: context ()->withEnvironment (['XDEBUG_MODE ' => 'coverage ' ])
182196 );
@@ -316,21 +330,31 @@ function lint_twig(): int
316330 return exit_code ('bin/console lint:twig templates/ ' );
317331}
318332
333+ #[AsTask(name: 'doctrine ' , namespace: 'lint ' , description: 'Validate Doctrine schema ' , aliases: ['lint-doctrine ' ])]
334+ function lint_doctrine (): int
335+ {
336+ title ('lint:doctrine ' );
337+
338+ return exit_code ('@bin/console doctrine:schema:validate ' );
339+ }
340+
319341#[AsTask(name: 'all ' , namespace: 'lint ' , description: 'Run all lints ' , aliases: ['lint ' ])]
320342function lint_all (): int
321343{
322344 title ('lint:all ' );
323345 $ ec1 = stan ();
324346 $ ec2 = lint_php ();
325- $ ec3 = lint_js_css ();
326- $ ec4 = lint_container ();
327- $ ec5 = lint_twig ();
347+ $ ec3 = lint_doctrine ();
348+ $ ec4 = lint_js_css ();
349+ $ ec5 = lint_container ();
350+ $ ec6 = lint_twig ();
328351
329- return success ($ ec1 + $ ec2 + $ ec3 + $ ec4 + $ ec5 );
352+ return success ($ ec1 + $ ec2 + $ ec3 + $ ec4 + $ ec5 + $ ec6 );
330353
331354 // if you want to speed up the process, you can run these commands in parallel
332355 // parallel(
333356 // fn() => lint_php(),
357+ // fn() => lint_doctrine(),
334358 // fn() => lint_container(),
335359 // fn() => lint_twig(),
336360 // );
@@ -341,6 +365,7 @@ function ci(): void
341365{
342366 title ('ci:all ' );
343367 purge ();
368+ loadFixtures ();
344369 io ()->section ('Coverage ' );
345370 coverage ();
346371 io ()->section ('Lints ' );
0 commit comments