Skip to content

Commit 8fe0aca

Browse files
committed
docs: update test/README
1 parent d199123 commit 8fe0aca

3 files changed

Lines changed: 34 additions & 22 deletions

File tree

admin/module/tests/README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,39 @@ It is not intended to be a full description of the test features that you can
66
use to test your module. Those details can be found in the documentation.
77

88
## Resources
9+
910
* [CodeIgniter 4 User Guide on Testing](https://codeigniter4.github.io/userguide/testing/index.html)
10-
* [PHPUnit docs](https://phpunit.readthedocs.io/en/8.5/index.html)
11+
* [PHPUnit docs](https://phpunit.de/documentation.html)
12+
* [Any tutorials on Unit testing in CI4?](https://forum.codeigniter.com/showthread.php?tid=81830)
1113

1214
## Requirements
1315

1416
It is recommended to use the latest version of PHPUnit. At the time of this
15-
writing we are running version 8.5.13. Support for this has been built into the
17+
writing we are running version 9.x. Support for this has been built into the
1618
**composer.json** file that ships with CodeIgniter and can easily be installed
1719
via [Composer](https://getcomposer.org/) if you don't already have it installed globally.
1820

1921
```console
2022
> composer install
2123
```
2224

23-
If running under OS X or Linux, you can create a symbolic link to make running tests a touch nicer.
25+
If running under macOS or Linux, you can create a symbolic link to make running tests a touch nicer.
2426

2527
```console
2628
> ln -s ./vendor/bin/phpunit ./phpunit
2729
```
2830

29-
You also need to install [XDebug](https://xdebug.org/index.php) in order
30-
for code coverage to be calculated successfully.
31+
You also need to install [XDebug](https://xdebug.org/docs/install) in order
32+
for code coverage to be calculated successfully. After installing `XDebug`, you must add `xdebug.mode=coverage` in the **php.ini** file to enable code coverage.
3133

3234
## Setting Up
3335

3436
A number of the tests use a running database.
3537
In order to set up the database edit the details for the `tests` group in
36-
**phpunit.xml**. Make sure that you provide a database engine that is currently running
37-
on your machine. More details on a test database setup are in the
38-
*Docs>>Testing>>Testing Your Database* section of the documentation.
38+
**phpunit.xml**.
39+
Make sure that you provide a database engine that is currently running on your machine.
40+
More details on a test database setup are in the
41+
[Testing Your Database](https://codeigniter4.github.io/userguide/testing/database.html) section of the documentation.
3942

4043
## Running the tests
4144

@@ -45,6 +48,12 @@ The entire test suite can be run by simply typing one command-line command from
4548
> ./phpunit
4649
```
4750

51+
If you are using Windows, use the following command.
52+
53+
```console
54+
> vendor\bin\phpunit
55+
```
56+
4857
You can limit tests to those within a single test directory by specifying the
4958
directory name after phpunit.
5059

@@ -57,7 +66,6 @@ directory name after phpunit.
5766
To generate coverage information, including HTML reports you can view in your browser,
5867
you can use the following command:
5968

60-
> ./phpunit --colors --coverage-text=tests/coverage.txt --coverage-html=tests/coverage/ -d memory_limit=1024m
6169
```console
6270
> ./phpunit --colors --coverage-text=tests/coverage.txt --coverage-html=tests/coverage/ -d memory_limit=1024m
6371
```

admin/starter/tests/README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use to test your application. Those details can be found in the documentation.
99

1010
* [CodeIgniter 4 User Guide on Testing](https://codeigniter4.github.io/userguide/testing/index.html)
1111
* [PHPUnit docs](https://phpunit.de/documentation.html)
12+
* [Any tutorials on Unit testing in CI4?](https://forum.codeigniter.com/showthread.php?tid=81830)
1213

1314
## Requirements
1415

@@ -21,28 +22,24 @@ via [Composer](https://getcomposer.org/) if you don't already have it installed
2122
> composer install
2223
```
2324

24-
If running under OS X or Linux, you can create a symbolic link to make running tests a touch nicer.
25+
If running under macOS or Linux, you can create a symbolic link to make running tests a touch nicer.
2526

2627
```console
2728
> ln -s ./vendor/bin/phpunit ./phpunit
2829
```
2930

30-
You also need to install [XDebug](https://xdebug.org/index.php) in order
31-
for code coverage to be calculated successfully.
31+
You also need to install [XDebug](https://xdebug.org/docs/install) in order
32+
for code coverage to be calculated successfully. After installing `XDebug`, you must add `xdebug.mode=coverage` in the **php.ini** file to enable code coverage.
3233

3334
## Setting Up
3435

3536
A number of the tests use a running database.
3637
In order to set up the database edit the details for the `tests` group in
37-
**app/Config/Database.php** or **phpunit.xml**. Make sure that you provide a database engine
38-
that is currently running on your machine. More details on a test database setup are in the
38+
**app/Config/Database.php** or **phpunit.xml**.
39+
Make sure that you provide a database engine that is currently running on your machine.
40+
More details on a test database setup are in the
3941
[Testing Your Database](https://codeigniter4.github.io/userguide/testing/database.html) section of the documentation.
4042

41-
If you want to run the tests without using live database you can
42-
exclude @DatabaseLive group. Or make a copy of **phpunit.dist.xml** -
43-
call it **phpunit.xml** - and comment out the <testsuite> named "database". This will make
44-
the tests run quite a bit faster.
45-
4643
## Running the tests
4744

4845
The entire test suite can be run by simply typing one command-line command from the main directory.

tests/README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ it takes to set up your system and get it ready to run unit tests.
55
It is not intended to be a full description of the test features that you can
66
use to test your application. Those details can be found in the documentation.
77

8+
## Resources
9+
10+
* [CodeIgniter 4 User Guide on Testing](https://codeigniter4.github.io/userguide/testing/index.html)
11+
* [PHPUnit docs](https://phpunit.de/documentation.html)
12+
* [Any tutorials on Unit testing in CI4?](https://forum.codeigniter.com/showthread.php?tid=81830)
13+
814
## Requirements
915

1016
It is recommended to use the latest version of PHPUnit. At the time of this
@@ -16,7 +22,7 @@ via [Composer](https://getcomposer.org/) if you don't already have it installed
1622
> composer install
1723
```
1824

19-
If running under OS X or Linux, you can create a symbolic link to make running tests a touch nicer.
25+
If running under macOS or Linux, you can create a symbolic link to make running tests a touch nicer.
2026

2127
```console
2228
> ln -s ./vendor/bin/phpunit ./phpunit
@@ -29,8 +35,9 @@ for code coverage to be calculated successfully. After installing `XDebug`, you
2935

3036
A number of the tests use a running database.
3137
In order to set up the database edit the details for the `tests` group in
32-
**app/Config/Database.php** or **phpunit.xml**. Make sure that you provide a database engine
33-
that is currently running on your machine. More details on a test database setup are in the
38+
**app/Config/Database.php** or **phpunit.xml**.
39+
Make sure that you provide a database engine that is currently running on your machine.
40+
More details on a test database setup are in the
3441
[Testing Your Database](https://codeigniter4.github.io/CodeIgniter4/testing/database.html) section of the documentation.
3542

3643
If you want to run the tests without using live database you can

0 commit comments

Comments
 (0)