diff --git a/composer.json b/composer.json index 92f6a3f10a7c92a3ac31aee5e5f771a3cf76ea6a..6162f447b26ad20e9317b6699ebdef2c0d29ca54 100644 --- a/composer.json +++ b/composer.json @@ -112,9 +112,10 @@ "@auto-scripts" ], "ci": [ - "@tests", "@phpcs", - "@phpstan" + "@phpstan", + "@reload-db-test", + "@tests" ], "tests": "php ./vendor/bin/phpunit", "phpcs": "php ./vendor/bin/phpcs src/ tests/", @@ -127,7 +128,13 @@ ], "phpstan-general": "php -d memory_limit=4G vendor/bin/phpstan analyse -c phpstan.neon", "phpstan-tests": "php -d memory_limit=4G vendor/bin/phpstan analyse -c phpstan-tests.neon", - "php-cs-fixer": "tools/php-cs-fixer/vendor/bin/php-cs-fixer fix src/ tests/" + "php-cs-fixer": "tools/php-cs-fixer/vendor/bin/php-cs-fixer fix src/ tests/", + "reload-db-test": [ + "@php bin/console doctrine:database:drop --if-exists --force --no-interaction --env=test", + "@php bin/console doctrine:database:create --if-not-exists --no-interaction --env=test", + "@php bin/console doctrine:migration:migrate --all-or-nothing --no-interaction --env=test", + "@php bin/console doctrine:fixture:load --no-interaction --env=test" + ] }, "conflict": { "symfony/symfony": "*" diff --git a/tools/git-hooks/pre-commit b/tools/git-hooks/pre-commit index e4148de69ef45023c8bb42c91996d353501c0947..b81d2ef388656c0e67cf7f77f412070e3e0a429a 100755 --- a/tools/git-hooks/pre-commit +++ b/tools/git-hooks/pre-commit @@ -29,11 +29,7 @@ else fi echo -e "\n ${BOLD} Starting prepare database for tests... \n ${NORMAL}" -$docker php bin/console doctrine:database:drop --if-exists --force --no-interaction --env=test && \ -$docker php bin/console doctrine:database:create --if-not-exists --no-interaction --env=test && \ -$docker php bin/console doctrine:migration:migrate --all-or-nothing --no-interaction --env=test && \ -#$docker php bin/console doctrine:schema:validate --env=test && \ -$docker php bin/console doctrine:fixture:load --no-interaction --env=test +$composer reload-db-test if [ $? != 0 ]; then echo -e "\n ${REDBOLD} Database preparation for tests failed \n ${NORMAL}" @@ -51,15 +47,4 @@ else echo -e "\n ${GREENBOLD} Unit and functional tests passed successfully! ${NORMAL} \n" fi - -#echo -e "\n ${BOLD} Starting ESLint... \n ${NORMAL}" -#$npm run lint -#if [ $? != 0 ]; then -# echo -e "\n ${REDBOLD} ESLint verification failed \n ${NORMAL}" -# exit 1; -#else -# echo -e "\n ${GREENBOLD} Your code passed JS linter successfully! \n -# \n Committing your changes now... \n ${NORMAL}" -#fi - echo -e "\n${GREENBOLD}Committing your changes now... \n ${NORMAL}"