@nx-php/phpunit
The @nx-php/phpunit
package is a plugin for an Nx Workspace that enables you to build PHP packages within a monorepo. With this package, you can easily integrate PHP packages into your existing Nx workspace.
Getting Started
To start using the @nx-php/phpunit
, follow these steps:
- Install the plugin as a development dependency in your Nx workspace:
npm install --save-dev @nx-php/phpunit
- Add a test target for your project.
::: tip
You likely need to build before you test. This example highlights using @nx-php/phpbuild
.
:::
{
"name": "my-org/my-package",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/my-package/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nx-php/phpbuild:phpbuild",
"dependsOn": [
"^build"
],
},
"test": {
"executor": "@nx-php/phpunit:phpunit",
"dependsOn": [
"build"
]
},
},
"tags": []
}
- Run your tests!
::: tip If you've done this correctly, you'll see a build (or many builds) before your test runs! :::
npx nx run your-project:test