linkedin
  • Become a Seller

How do you set up PHPUnit unit testing when developing Directus extensions?

Himmat singh . Oct 09, 2024

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:

Oct 09, 2024

Was this helpful? upvote icon 0 downvote icon 0
img

Did not find the question you are looking for?

Get fast answers from real users and our software experts

menlaptop

Have a Question in Mind?

Get answers directly from verified users and our software experts

Software icon representing 20,000+ Software Listed 20,000+ Software Listed

Price tag icon for best price guarantee Best Price Guaranteed

Expert consultation icon Free Expert Consultation

Happy customer icon representing 2 million+ customers 2M+ Happy Customers