|
|
10 månader sedan | |
|---|---|---|
| .. | ||
| Factory | 10 månader sedan | |
| OrganizationFixtures.php | 1 år sedan | |
| PersonFixtures.php | 1 år sedan | |
| image-1.png | 1 år sedan | |
| readme.md | 1 år sedan | |
Pour regénérer le SQL de la base de données de test, suivez ces étapes :
php bin/console ot:setup:env --host=ci
ls -l .env.local
Vérifiez que vous avez bien le contenu de /env/.env.staging dans .env.local
docker exec -it db bash
nano create-test-database.sh
copier ce fichier dans "create-test-database.sh"
DB_USER="root"
DB_PASSWORD="mysql660"
DB_HOST="127.0.0.1"
DB_PORT="3306"
DB_NAME="opentalent"
DB_TEST_NAME="opentalent_test"
echo "Dropping test database if it exists..."
mysql --user=$DB_USER --password=$DB_PASSWORD --host=$DB_HOST --port=$DB_PORT -e "DROP DATABASE IF EXISTS $DB_TEST_NAME;"
echo "Dumping schema from the main database..."
mysqldump --user=$DB_USER --password=$DB_PASSWORD --host=$DB_HOST --port=$DB_PORT --default-character-set=utf8 --single-transaction=TRUE --no-data --skip-triggers "$DB_NAME" | sed 's/ AUTO_INCREMENT=[0-9]*//g' > opentalent_test.sql
echo "Creating test database..."
mysql --user=$DB_USER --password=$DB_PASSWORD --host=$DB_HOST --port=$DB_PORT -e "CREATE DATABASE $DB_TEST_NAME;"
echo "Importing schema into the test database..."
mysql --user=$DB_USER --password=$DB_PASSWORD --host=$DB_HOST --port=$DB_PORT -D $DB_TEST_NAME < opentalent_test.sql
echo "Database setup completed."
Ne pas faire attention à l'erreur _ERROR 1305 (42000) at line 8394: FUNCTION opentalent_test.init_varsession does not exist
Un fichier opentalent_test.sql est alors créé à la racine du projet ap2i

Détecter les erreurs dans les tests dans ap2i (phpunit ne les logs pas) :
find tests/Application -name '*.php' -exec php -l {} \;
bin/console doctrine:schema:update
bin/console --env=staging d:f:l
Pour lancer les tests (dans ap2i)
chmod +x run_test.sh
./application_tests.sh
Note : Les tests sont joués de façon isolé