Skip to content
This repository was archived by the owner on May 18, 2024. It is now read-only.

Commit 44a53a4

Browse files
committed
Doc tweaks
1 parent 887039f commit 44a53a4

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

docs/COVERAGE.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Code Coverage
22

3-
>> Code coverage is a term used in software testing to describe how much program source
4-
>> code is covered by a testing plan. -[TechnoPedia](https://www.techopedia.com/definition/22535/code-coverage)
3+
> Code coverage is a term used in software testing to describe how much program source
4+
> code is covered by a testing plan. -[TechnoPedia](https://www.techopedia.com/definition/22535/code-coverage)
55
66
## Overview
77

@@ -24,13 +24,13 @@ Common practice is to create a local copy of this file as **phpunit.xml** and ad
2424
sensitive or environment info (like database connections). Prevent **phpunit.xml** from
2525
being tracked in your repo by adding it to **.gitignore**.
2626

27-
>> PHPUnit will always use **phpunit.xml** before **phpunit.xml.dist**, if it is found.
27+
> PHPUnit will always use **phpunit.xml** before **phpunit.xml.dist**, if it is found.
2828
2929
### Exclusions
3030

3131
In addition to the code source mentioned above, PHPUnit can be configured to exclude files
3232
that are not relevant to testing or would otherwise cause the coverage calculations to fail.
33-
**ci4-module-tests** provides a few files common to CodeIgniter 4 but you may need to add
33+
**ci4-module-tests** starts with a few files common to CodeIgniter 4 but you may need to add
3434
your own:
3535
```
3636
<exclude>
@@ -41,7 +41,9 @@ your own:
4141

4242
### Logging
4343

44-
Another common change is adjusting the output location and format of the coverage reports:
44+
Output is available in a variety of formats (see the [Logging Section](https://phpunit.readthedocs.io/en/8.3/logging.html)
45+
of the PHPUnit Guide). You can adjust the default location and format of the reports by
46+
modifying the `<logging>` tag:
4547
```
4648
<logging>
4749
<log type="coverage-html" target="build/logs/html"/>
@@ -54,8 +56,6 @@ Another common change is adjusting the output location and format of the coverag
5456
</logging>
5557
```
5658

57-
To read more on logging and options see the
58-
[Loggin Section](https://phpunit.readthedocs.io/en/8.3/logging.html) of the PHPUnit Guide.
59-
6059
For more information on using the PHPUnit XML file generally see the
61-
[Configuration Section](https://phpunit.readthedocs.io/en/8.3/configuration.html) of the guide.
60+
[Configuration Section](https://phpunit.readthedocs.io/en/8.3/configuration.html)
61+
of the guide.

docs/CREATING.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
## Test Cases
99

1010
Every test needs a *test case*, or class that your tests extend. CodeIgniter 4
11-
provides a few you may use directly:
11+
provides a few that you may use directly:
1212
* `CodeIgniter\Test\CIUnitTestCase` - for basic tests with no other service needs
1313
* `CodeIgniter\Test\CIDatabaseTestCase` - for tests that need database access
1414

@@ -22,22 +22,25 @@ common to your test suites.
2222
## Tests
2323

2424
All tests go in the **tests/** directory. **ci-module-tests** provides two generic
25-
subfolders for you **unit** and **database** but feel free to make your own. Each test file
26-
is a class that extends a **Test Case** (see above) and contains methods for each individual
27-
test. These method names must start with the word "test" and should have descriptive names
25+
subfolders for you, **unit** and **database** - but feel free to make your own. Each test file
26+
is a class that extends a **Test Case** (see above) and contains methods for the individual
27+
tests. These method names must start with the word "test" and should have descriptive names
2828
for precisely what they are testing: `testUserCanModifyFile()` `testOutputColorMatchesInput()`
2929
`testIsLoggedInFailsWithInvalidUser()`
3030

31+
Writing tests is an art, and there are many resources available to help learn how. Review
32+
the links above and always pay attention to your [Code Coverage](docs/COVERAGE.md).
33+
3134
### Database Tests
3235

33-
**ci-module-tests** provides a examples for migrating, seeding, and testing against a mock
36+
**ci-module-tests** provides examples for migrating, seeding, and testing against a mock
3437
or live<sup>1</sup> database. The example files can be modified or replaced with your own:
3538
* **tests/_support/Database/Migrations/create_test_tables.php**
3639
* **tests/_support/Database/Seeds/ExampleSeeder.php**
3740
* **tests/_support/Models/ExampleModel.php**
3841

3942
Be sure to modify the test case (or create your own) to point to your seed and migrations
40-
and include any additional steps in `setUp()`:
43+
and include any additional steps to be run before tests in the `setUp()` method:
4144
* **tests/_support/DatabaseTestCase.php**
4245

4346
<sup>1</sup> Note: If you are using database tests that require a live database connection you will need
@@ -47,6 +50,7 @@ repo by adding it to **.gitignore**.
4750

4851
### Session Tests
4952

50-
Similar to the database test case, **ci-module-tests** provides a test case pre-configured
51-
with the mock session class to make testing sessions easy:
53+
Similar to database testing, **ci-module-tests** provides a test case pre-configured
54+
with the [mock session class](https://codeigniter4.github.io/userguide/testing/overview.html#mocking-services)
55+
to make testing sessions easier:
5256
* **tests/_support/SessionTestCase.php**

0 commit comments

Comments
 (0)