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. Functional Tests

Creating a Functional Test File

Creating a Test File

All functional tests for the API are located under the test/Functional directory. The functional tests directory contains PHP files with the same name as a controller with the suffix “Test”; these are the Test Case files.

Example

The event controller is located at:

- app
  - Modules
    - Events
      - Http
        - Controllers
          - EventsController.php

Therefore the Test Case file for the Events Controller will be located at:

- tests
  - Functional
    - Events
      - Http
        - EventsControllerTest.php

Do not include the Controllers directory within the folder structure of the Test class.

Ensure that the module name in the test/Functional directory matches the exact case of the module in the app/Modules directory.

Example:

Controller’s Name:

EventsController.php

Test Case Name:

EventsControllerTest.php
PreviousFunctional TestsNextTesting HTTP Verbs

Last updated 2 years ago