uk-controller-api

Production Deploy Status Build and Test Security Rating Maintainability Rating Quality Gate Status Reliability Rating codecov semantic-release Commitizen friendly

The API backend to the UK Controller Plugin, provides the plugin with information such as dependency files, squawk allocations and user authentication.

The API is built on Laravel Framework and uses PHPUnit for tests.

System Requirements

Local Deployment

A development environment using docker-compose comes bundled with the source, to use it simply run docker-compose build followed by docker-compose up.

Connecting To The Development Database

The development database binds to Port 3306 and can be connected to using the password provided in the docker-compose.yml.

Setup Steps

Creating A User

Running Tests

Assuming that you have run the migrations and seeded the database, running the tests is as simple as running the following command:

php artisan test

Testing with Docker

A separate database is available via the docker deployment on the same network to avoid losing the data contained in the migrations.

The same deployment steps outlined above should be carried out, but append --env=testing to run them against the testing database.

Copy the environment file .env.testing.example to .env.testing to allow these values to be used when running the test suite.

The test suite will use the testing environment via the APP_ENV variable set within phpunit.xml (the PHPUnit configuration). In this instance, the phpunit command should be run from within the web container so that the docker network is available:

docker exec -it web /bin/bash

Coding Style

This project uses PSR-12 for its formatting style. You can enforce these standards through most Code Editors, or, alternatively, StyleCI will run on every pull request.

Every pull request is also run through SonarCloud to check for code smells.