From 8a7fc19c11c0ff3aa2f78dd1b69d9e77a8a69169 Mon Sep 17 00:00:00 2001 From: sarvesh211999 <sarvesh211999@gmail.com> Date: Sun, 28 Jul 2019 01:50:16 +0530 Subject: [PATCH] added testing documentation --- README.md | 1 + docs/how_to_create_test.md | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 docs/how_to_create_test.md diff --git a/README.md b/README.md index f3ca5fc7..153e3c0e 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ The extension is licensed under [AGPL-3.0](LICENSE.txt). * [Add your own data source for a CiviCRM Entity](docs/add_your_own_datasource.md) * Add your own data source for a CSV File * How to store a data processor in code in your extension +* [Develop PHPUnit TestCase for the extension](docs/how_to_create_test.md) ## Installation diff --git a/docs/how_to_create_test.md b/docs/how_to_create_test.md new file mode 100644 index 00000000..ecb3a95d --- /dev/null +++ b/docs/how_to_create_test.md @@ -0,0 +1,8 @@ +# How to create a PHPUnit Test + +- Create file with appropriate name ending with test. For Example `CreateDataProcessorTest.php` +- Follow the simplest test case file `CreateDataProcessorTest.php` for creating a test case. +- Create a function whose name starting with test. For Example `testCreateDataProcessor`. All the function starting with **test** will be evaluated, so name your utility functions properly. +- If you want to reset the Test Database and install from beginning pass `True` in `apply()` function in `setupHeadless() function`. +- Don't remove `setUp()` and `tearDown()` function from the UnitTest file. + -- GitLab