@@ -33,6 +33,7 @@ All tests go in the **tests/** directory. There are two generic subfolders for y
33
33
test case:
34
34
* For basic tests extend ` CodeIgniter\Test\CIUnitTestCase `
35
35
* For database tests extend ` CIModuleTests\Support\DatabaseTestCase `
36
+ * For session tests extend ` CIModuleTests\Support\SessionTestCase `
36
37
37
38
Tests are individual methods within each file. Method names must start with the word "test":
38
39
` testUserSync() ` ` testOutputColor() ` ` testFooBar() `
@@ -50,3 +51,31 @@ steps in `setUp()`.
50
51
51
52
Similarly there is a pre-configured test case available with a mock session configured to
52
53
make 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