Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Developer Documentation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Documentation
Docs
Developer Documentation
Commits
986bdef6
Commit
986bdef6
authored
7 years ago
by
totten
Browse files
Options
Downloads
Patches
Plain Diff
phpunit.md - Copy-edits
parent
ecb6bb9e
No related branches found
Branches containing commit
No related tags found
1 merge request
!415
Reorganize "Testing" pages
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/testing/phpunit.md
+6
-5
6 additions, 5 deletions
docs/testing/phpunit.md
with
6 additions
and
5 deletions
docs/testing/phpunit.md
+
6
−
5
View file @
986bdef6
...
...
@@ -14,8 +14,10 @@ PHPUnit provides a command-line tool. In [buildkit](/tools/buildkit.md), this t
## Suites
PHPUnit tests are grouped together into
*suites*
. For example, the
`CRM`
suite includes the tests
`CRM_Core_RegionTest`
,
`CRM_Import_Datasource_CsvTest`
, and many others. Each suite has its own coding conventions. For example, all tests in the
`CRM`
suite extend the
base class
`CiviUnitTestCase`
and execute on the headless database.
`CRM_Import_Datasource_CsvTest`
, and many others.
Each suite has its own coding conventions. For example, all tests in the
`CRM`
suite extend the base class
`CiviUnitTestCase`
and execute on the
headless database. They require a special environment variable (
`CIVICRM_UF`
).
You'll find suites in many places, such as
`civicrm-core`
,
`civicrm-drupal`
, and various extensions. In
`civicrm-core`
, the main suites are:
...
...
@@ -36,11 +38,10 @@ $ cd /path/to/my/project
$
phpunit4 ./tests/MyTest.php
```
Note the command involves a few elements, such as the base-path of the project, the name of the PHPUnit binary, and the relative path of the test.
Note
how
the command involves a few elements, such as the base-path of the project, the name of the PHPUnit binary, and the relative path of the test.
Let's apply this to a more realistic example. Suppose we used
`civibuild`
to create a Drupal 7 site with a copy of
`civicrm-core`
in the typical
folder,
`sites/all/modules/civicrm`
. Test files are stored under
`./tests/phpunit`
. To run a typical test like
`CRM_Core_RegionTest`
, you might
execute:
folder,
`sites/all/modules/civicrm`
. To run a typical test file like
`tests/phpunit/CRM/Core/RegionTest.php`
, you might execute:
```
bash
$
cd
~/buildkit/build/dmaster/sites/all/modules/civicrm
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment