Skip to content

Commit 14dd502

Browse files
committed
docs: update description for test file locations
1 parent 4322bd6 commit 14dd502

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

user_guide_src/source/testing/overview.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,22 @@ By default, test files are placed under the **tests** directory in the project r
6969
The Test Class
7070
==============
7171

72-
In order to take advantage of the additional tools provided, your tests must extend ``CIUnitTestCase``. All tests
73-
are expected to be located in the **tests/app** directory by default.
72+
In order to take advantage of the additional tools provided, your tests must extend
73+
``CIUnitTestCase``.
7474

75-
To test a new library, **Foo**, you would create a new file at **tests/app/Libraries/FooTest.php**:
75+
There are no rules for how test files must be placed. However, we recommend that
76+
you establish placement rules in advance so that you can quickly understand where
77+
the test files are located.
78+
79+
In this document, we will place the test files corresponding to the classes in
80+
the **app** directory in the **tests/app** directory. To test a new library,
81+
**app/Libraries/Foo.php**, you would create a new file at
82+
**tests/app/Libraries/FooTest.php**:
7683

7784
.. literalinclude:: overview/001.php
7885

79-
To test one of your models, you might end up with something like this in **tests/app/Models/OneOfMyModelsTest.php**:
86+
To test one of your models, **app/Models/UserMode.php**, you might end up with
87+
something like this in **tests/app/Models/UserModelTest.php**:
8088

8189
.. literalinclude:: overview/002.php
8290

@@ -103,7 +111,7 @@ to help with staging and clean up::
103111
The static methods ``setUpBeforeClass()`` and ``tearDownAfterClass()`` run before and after the entire test case, whereas the protected methods ``setUp()`` and ``tearDown()`` run
104112
between each test.
105113

106-
If you implement any of these special functions make sure you run their
114+
If you implement any of these special functions, make sure you run their
107115
parent as well so extended test cases do not interfere with staging:
108116

109117
.. literalinclude:: overview/003.php

user_guide_src/source/testing/overview/002.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use CodeIgniter\Test\CIUnitTestCase;
66

7-
class OneOfMyModelsTest extends CIUnitTestCase
7+
class UserModelTest extends CIUnitTestCase
88
{
99
public function testFooNotBar()
1010
{

user_guide_src/source/testing/overview/003.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use CodeIgniter\Test\CIUnitTestCase;
66

7-
final class OneOfMyModelsTest extends CIUnitTestCase
7+
final class UserModelTest extends CIUnitTestCase
88
{
99
protected function setUp(): void
1010
{

0 commit comments

Comments
 (0)