Skip to content
Snippets Groups Projects
Commit 2fdd9619 authored by Camille Simiand's avatar Camille Simiand
Browse files

Add a composer script to prepare test database and call it from

pre-commit hook in ci
parent 6ffa0a7a
Branches
Tags
1 merge request!41tuleap-135-have-a-reload-db-test-script
Pipeline #694 passed
......@@ -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": "*"
......
......@@ -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}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment