Setting up a testing environment

Steps on how to setup a testing environment to run the API automated tests

Setting up a testing environment

Run composer clean:install in the elentra-1x-me directory to automate setting up the test environment.

Run composer test:api:clean in the elentra-1x-me directory to set up the test environment, and run the API tests afterwards.

  1. Create test databases

DROP DATABASE IF EXISTS `test_elentra_me`;
DROP DATABASE IF EXISTS `test_elentra_auth` ;
DROP DATABASE IF EXISTS `test_elentra_me_clerkship`;
DROP DATABASE IF EXISTS `test_elentra_cbe`;

CREATE DATABASE IF NOT EXISTS `test_elentra_me`;
CREATE DATABASE IF NOT EXISTS `test_elentra_auth`;
CREATE DATABASE IF NOT EXISTS `test_elentra_me_clerkship`;
CREATE DATABASE IF NOT EXISTS `test_elentra_cbe`;

2. Run the ME setup utility to seed the initial ME data

cd /var/www/vhosts/elentra-1x-me;

php www-root/setup/install.php \
    --entrada-url=http://elentra-1x-me.localhost \
    --entrada-absolute=$(pwd)/www-root \
    --entrada-storage=$(pwd)/www-root/core/storage \
    --database-adapter=mysqli \
    --database-host=mariadb \
    --database-username=root \
    --database-password=password \
    --entrada-database=test_elentra_me \
    --clerkship-database=test_elentra_me_clerkship \
    --auth-database=test_elentra_auth \
    --cbe-database=test_elentra_cbe \
    --admin-username=user1 \
    --admin-password=apple123 \
    --admin-firstname=System \
    --admin-lastname=Administrator \
    --admin-email=admin@example.com

3. Run the migrations

php elentra migrate --up

4. Generate the seed data

php www-root/core/library/vendor/elentrapackages/elentra-1x-api/artisan db:seed

5. Install API composer dependencies

cd /var/www/vhosts/elentra-1x-api
composer install
composer update

Last updated