Elentra API
  • Introduction
  • Developers
    • Getting Started
    • Quickstart Guide
      • Set up Repositories
      • Validate the setup
      • Exploring the API
      • Creating a new Module
      • Setup Routing
      • Introduction to Postman
      • Create a Controller
      • Using Eloquent Models
      • Input Validation
      • API Resource Authorization
  • Elentra API Standards
    • HTTP Methods & Status Codes
    • Routing & Parameters
      • Example Routing Patterns with HTTP Method
        • /courses/{course}/contacts
        • /courses/{course}/contacts?type={contact_type}
        • /courses/{course}/contacts/{contact}
        • /courses/{course}/syllabus
      • Common Mistakes
        • [GET] /admissions/file-review/file/rubric-score/{cycle_id}/{pool_id}/{subpool_id}
        • [DELETE] /notices/1,2,3
        • [GET] /cbe/curriculum/framework/{framework_id}/hierarchy-by-depth
        • [GET] /admissions/file-review/file/rubric-score/delete/{id}
        • [GET] /portfolio/entries/{entry_id}/get-file
        • [POST] /cbe/curriculum/updateframework
  • Automated Testing
    • Getting Started
      • Setting up a testing environment
      • Running Automated Tests
    • Seed Data
      • Folder Structure
      • Creating Seed Data
    • Functional Tests
      • Creating a Functional Test File
      • Testing HTTP Verbs
        • Creating an HTTP Test
        • GET Requests
        • POST / PUT / DELETE Requests
        • GraphQL Requests
      • Asserting API Response
      • Annotations
    • Code Style Linting
Powered by GitBook
On this page
  1. Automated Testing
  2. Getting Started

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
PreviousGetting StartedNextRunning Automated Tests

Last updated 2 years ago