|
@@ -4,64 +4,74 @@
|
|
|
|
|
|
|
|
Pour regénérer le SQL de la base de données de test, suivez ces étapes :
|
|
Pour regénérer le SQL de la base de données de test, suivez ces étapes :
|
|
|
|
|
|
|
|
-1. Connectez-vous à MySQL dans le docker mariaDb :
|
|
|
|
|
|
|
+1. Modifier les variable d'env dans **ap2i**
|
|
|
|
|
|
|
|
```bash
|
|
```bash
|
|
|
- mysql --user=root --password=mysql660 --host=127.0.0.1 --port=3306
|
|
|
|
|
- DROP DATABASE IF EXISTS opentalent_test; EXIT;
|
|
|
|
|
|
|
+ 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
|
|
|
|
|
+
|
|
|
|
|
+2. Connectez-vous à MySQL dans le docker **mariaDb** :
|
|
|
|
|
+
|
|
|
|
|
+ ```bash
|
|
|
|
|
+ docker exec -it db bash
|
|
|
|
|
+ nano create-test-database.sh
|
|
|
|
|
+ ```
|
|
|
|
|
+
|
|
|
|
|
+ copier ce fichier dans "create-test-database.sh"
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ ```bash
|
|
|
|
|
|
|
|
- mysqldump --user=root --password=mysql660 --host=localhost --port=3306 --default-character-set=utf8 --single-transaction=TRUE --no-data --skip-triggers "opentalent" | sed 's/ AUTO_INCREMENT=[0-9]*//g' > opentalent_test.sql
|
|
|
|
|
|
|
+ DB_USER="root"
|
|
|
|
|
+ DB_PASSWORD="mysql660"
|
|
|
|
|
+ DB_HOST="127.0.0.1"
|
|
|
|
|
+ DB_PORT="3306"
|
|
|
|
|
+ DB_NAME="opentalent"
|
|
|
|
|
+ DB_TEST_NAME="opentalent_test"
|
|
|
|
|
|
|
|
- mysql --user=root --password=mysql660 --host=127.0.0.1 --port=3306
|
|
|
|
|
- CREATE DATABASE opentalent_test;
|
|
|
|
|
- EXIT;
|
|
|
|
|
|
|
+ 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;"
|
|
|
|
|
|
|
|
- mysql --user=root --password=mysql660 --host=127.0.0.1 --port=3306 -D opentalent_test < opentalent_test.sql
|
|
|
|
|
|
|
+ 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."
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
- php bin/console ot:setup:env --host=ci
|
|
|
|
|
- ls -l .env.local
|
|
|
|
|
|
|
+ Ne pas faire attention à l'erreur _ERROR 1305 (42000) at line 8394: FUNCTION opentalent_test.init_var_session does not exist_
|
|
|
|
|
+
|
|
|
|
|
+ Un fichier opentalent_test.sql est alors créé à la racine du projet ap2i
|
|
|
|
|
+ 
|
|
|
|
|
|
|
|
|
|
|
|
|
- Détecter les erreurs dans les tests (phpunit ne les logs pas) :
|
|
|
|
|
- ```bash
|
|
|
|
|
|
|
+3. Détecter les erreurs dans les tests dans **ap2i** (phpunit ne les logs pas) :
|
|
|
|
|
+ ```bash
|
|
|
find tests/Application -name '*.php' -exec php -l {} \;
|
|
find tests/Application -name '*.php' -exec php -l {} \;
|
|
|
```
|
|
```
|
|
|
-2. Dans le docker ap2i :
|
|
|
|
|
- Regénérer les vues et jouer les fixtures
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+4. Regénérer les vues et jouer les fixtures dans **ap2i**
|
|
|
|
|
|
|
|
```bash
|
|
```bash
|
|
|
- bin/console --env=staging doctrine:schema:update
|
|
|
|
|
|
|
+ bin/console doctrine:schema:update
|
|
|
bin/console --env=staging d:f:l
|
|
bin/console --env=staging d:f:l
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
-3. Pour lancer les tests :
|
|
|
|
|
|
|
+3. Pour lancer les tests (dans **ap2i**)
|
|
|
|
|
|
|
|
```bash
|
|
```bash
|
|
|
- php bin/phpunit
|
|
|
|
|
|
|
+ chmod +x run_test.sh
|
|
|
|
|
+ ./application_tests.sh
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
- ou mettre le path relatif :
|
|
|
|
|
|
|
|
|
|
- ```bash
|
|
|
|
|
- php bin/phpunit tests/Application/Access/AdminAccessTest.php
|
|
|
|
|
- php bin/phpunit tests/Application/Billing/ResidenceAreaTest.php
|
|
|
|
|
- php bin/phpunit tests/Application/Cotisation/CotisationTest.php
|
|
|
|
|
- php bin/phpunit tests/Application/Education/CycleTest.php
|
|
|
|
|
- php bin/phpunit tests/Application/Education/EducationTimingTest.php
|
|
|
|
|
- php bin/phpunit tests/Application/Enum/EnumTest.php
|
|
|
|
|
- php bin/phpunit tests/Application/Mobyt/MobytUserStatusTest.php
|
|
|
|
|
- php bin/phpunit tests/Application/Organization/ParametersTest.php
|
|
|
|
|
- php bin/phpunit tests/Application/Organization/SubdomainTest.php
|
|
|
|
|
- php bin/phpunit tests/Application/Person/PersonTest.php
|
|
|
|
|
- php bin/phpunit tests/Application/Profile/AccessProfileTest.php
|
|
|
|
|
- php bin/phpunit tests/Application/Profile/OrganizationProfilesTest.php
|
|
|
|
|
- php bin/phpunit tests/Application/Public/PublicEventsTest.php
|
|
|
|
|
- php bin/phpunit tests/Application/Public/PublicStructuresTest.php
|
|
|
|
|
- php bin/phpunit tests/Application/Utils/GpsCoordinateTest.php
|
|
|
|
|
- php bin/phpunit tests/Application/Utils/SiretTest.php
|
|
|
|
|
-
|
|
|
|
|
- ```
|
|
|
|
|
-// option sms : settings -> id 3600
|
|
|
|
|
-// cotisation -> network Organization -> cmf
|
|
|
|
|
|
|
+ Note : Les tests sont joués de façon isolé
|