You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: user_guide_src/source/testing/overview.rst
+17-3Lines changed: 17 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,8 +101,9 @@ parent as well so extended test cases do not interfere with staging:
101
101
102
102
.. literalinclude:: overview/003.php
103
103
104
-
In addition to these methods, ``CIUnitTestCase`` also comes with a convenience property for
105
-
parameter-free methods you want run during set up and tear down:
104
+
In addition to these methods, ``CIUnitTestCase`` also comes with a convenience property
105
+
``$setUpMethods`` and ``$tearDownMethods`` for
106
+
parameter-free methods you want to run during set up and tear down:
106
107
107
108
.. literalinclude:: overview/004.php
108
109
@@ -111,12 +112,25 @@ that or provide their own:
111
112
112
113
.. literalinclude:: overview/005.php
113
114
115
+
.. note:: When you override ``$setUpMethods`` properties, do not remove the following items that are set in the parent class by default unless you know they are truly unnecessary.
116
+
117
+
.. code-block:: php
118
+
119
+
protected $setUpMethods = [
120
+
'resetFactories',
121
+
'mockCache',
122
+
'mockEmail',
123
+
'mockSession',
124
+
];
125
+
114
126
Traits
115
127
------
116
128
117
129
A common way to enhance your tests is by using traits to consolidate staging across different
118
130
test cases. ``CIUnitTestCase`` will detect any class traits and look for staging methods
119
-
to run named for the trait itself. For example, if you needed to add authentication to some
131
+
to run named for the trait itself.
132
+
133
+
For example, if you needed to add authentication to some
120
134
of your test cases you could create an authentication trait with a set up method to fake a
0 commit comments