With Copilot
Acquia Copilot is a conversational AI connected into our product documentation and knowledge base. Ask Copilot about product features, technical details, troubleshooting and how to get started with Acquia products.
Sign in to use Acquia Copilot
Before adding a PHPUnit test to your Code Studio pipeline, you must:
drupal/core-dev and phpunit/phpunit in the composer.json file of your project.phpunit.xml.dist file in the root directory of your project.In your custom module, create a directory for tests/src/Functional/.
For example, docroot/modules/custom/my_module/tests/src/Functional.
Add a PHPUnit test file.
For example, ExampleTest.php.
ExampleTest.php file exists inside the Functional directory that is present in docroot/modules/custom/my_module/tests/src
In the phpunit.xml.dist file, ensure that the path to your custom modules directory exists under a test suite. For example, if your module exists in the docroot/modules/custom/ directory, ensure that the phpunit.xml.dist file contains the following:
<?xml version="1.0"?>
<!-- phpunit.xml.dist -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
<report>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<testsuites>
<testsuite name="Custom modules">
<directory>docroot/modules/custom/</directory>
</testsuite>
</testsuites>
<logging/>
</phpunit>The following variables must be set in your project:
ACQUIA_TASKS_SETUP_DRUPAL must be set to true. For more information, see Adding environment variables.ACQUIA_TASKS_SETUP_DRUPAL_CONFIG_IMPORT exists, it must be set to true.ACQUIA_TASKS_SETUP_DRUPAL_STRATEGY exists, it must be set to install.ACQUIA_TASKS_PHPUNIT exists, it must be set to true.ACQUIA_JOBS_TEST_DRUPAL exists, it must be set to true.If this content did not answer your questions, try searching or contacting our support team for further assistance.
If this content did not answer your questions, try searching or contacting our support team for further assistance.