1 Answers
A:
To setup PHPUnit unit testing when developing Directus extensions, follow the steps given below:
Open the Directus extension's root directory.
Install PHPUnit via Composer:
In your extension folder, create a directory called ‘tests’ for storing your test files
Create a
phpunit.xml
) configuration file in your extension’s root directory. Example configuration:
In the ‘tests’ directory, create test classes for your extension. Here's an example
ExampleTest.php
:
In the terminal, run the following command from your extension's root directory:
Directus CMS
Monospace IncDisclaimer
Techjockey’s software industry experts offer advice for educational and informational purposes only. A category or product query or issue posted, created, or compiled by Techjockey is not meant to replace your independent judgment.
20,000+ Software Listed
Best
Price Guaranteed
Free Expert
Consultation
2M+
Happy Customers