PHP
Last updated
Last updated
To create a new assignment in PHP, click into one of your courses, and then click Add assignment
.
Choose PHP
from the drop-down list of available backend languages and set the the rest of your assignment's parameters (deadline, etc.).
Once the assignment is created, a new folder will be created in the private GitHub
/GitLab
template repository for the course in which you are added this assignment. This folder will contain a standard PHP
project structure:
If you would like to add tests that are automatically run by AssignmentOS against each student's solution to your assignment, you can add these as test classes in the tests/
directory.
All unit test class filenames must end with Test.php
and the test classes with filenames that end with HiddenTest.php
will not be visible to the student.
If you want to add files that your hidden unit tests use and hence are also not visible to the student, the names of these files must begin with hidden
(case-insensitive), e.g., hiddenFoo.json
, hiddenFoo.csv
, HiddenFoo.php
, etc.
Your assignment must use/be compatible with PHP
version 8.0 and all dependencies that your coding assignment requires need to be added to the composer.json
file.
All unit tests must use be located in the tests/
directory and use the PHPUnit
(version 9.3.0) testing framework.
GitHub Action & GitLab CI/CD
AssignmentOS uses either GitHub Actions
or GitLab CI/CD
(depending on whether you use with GitHub or GitLab) to run automated unit tests.
We provide the following GitHub Action & GitLab CI/CD file for PHP assignments. Note that this file is added dynamically to the repo of each student taking your assignment, so please do not include it in your template repo. This file also cannot be changed.
An example PHP
assignment that uses automated test suite scoring can be seen here:
https://github.com/AssignmentOS-HQ/PHP-AssignmentOS-Fibonacci.
GitHub Action .yml file | GitLab CI/CD .yml file |
---|---|
Coming soon!