@@ -33,6 +33,7 @@ All tests go in the **tests/** directory. There are two generic subfolders for y
3333test case:
3434* For basic tests extend ` CodeIgniter\Test\CIUnitTestCase `
3535* For database tests extend ` CIModuleTests\Support\DatabaseTestCase `
36+ * For session tests extend ` CIModuleTests\Support\SessionTestCase `
3637
3738Tests are individual methods within each file. Method names must start with the word "test":
3839` testUserSync() ` ` testOutputColor() ` ` testFooBar() `
@@ -50,3 +51,31 @@ steps in `setUp()`.
5051
5152Similarly there is a pre-configured test case available with a mock session configured to
5253make testing sessions easy: ** tests/_ support/SessionTestCase.php** .
54+
55+ ## Code Coverage
56+
57+ ** CIModuleTests** comes preconfigured to run code coverage as part of the testing. You will
58+ need to have a code coverage driver installed to use this feature, such as
59+ [ Xdebug] ( https://xdebug.org ) . ** CIModuleTests** assumes your source code is in ** src/** ;
60+ if your code is somewhere else then modify the following line in ** phpunit.xml.dist** :
61+ ```
62+ <directory suffix=".php">./src</directory>
63+ ```
64+ Other common modifications would be removing the attributes from the whitelist element:
65+ ```
66+ <whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="true">
67+ ```
68+ ... and adjusting the output location and format of the coverage reports:
69+ ```
70+ <logging>
71+ <log type="coverage-clover" target="build/logs/clover.xml"/>
72+ <log type="coverage-html" target="build/logs/html"/>
73+ <log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/>
74+ </logging>
75+ ```
76+
77+ ## Updating
78+
79+ As this repo is updated with bugfixes and improvements you will want to update the code
80+ merged into your modules. Because tests need to be top-level and should not include their
81+ own repository info you will need to handle updates manually.
0 commit comments