Skip to content

Commit 5b2cc5e

Browse files
committed
docs: make method names linkable
1 parent 5ccb503 commit 5b2cc5e

1 file changed

Lines changed: 32 additions & 12 deletions

File tree

user_guide_src/source/testing/controllers.rst

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ to run as the parameter:
3131
Helper Methods
3232
==============
3333

34-
**controller($class)**
34+
controller($class)
35+
------------------
3536

3637
Specifies the class name of the controller to test. The first parameter must be a fully qualified class name
3738
(i.e., include the namespace):
3839

3940
.. literalinclude:: controllers/003.php
4041

41-
**execute(string $method, ...$params)**
42+
execute(string $method, ...$params)
43+
-----------------------------------
4244

4345
Executes the specified method within the controller. The first parameter is the name of the method to run:
4446

@@ -49,15 +51,17 @@ By specifying the second and subsequent parameters, you can pass them to the con
4951
This returns a new helper class that provides a number of routines for checking the response itself. See below
5052
for details.
5153

52-
**withConfig($config)**
54+
withConfig($config)
55+
-------------------
5356

5457
Allows you to pass in a modified version of **Config\App.php** to test with different settings:
5558

5659
.. literalinclude:: controllers/005.php
5760

5861
If you do not provide one, the application's App config file will be used.
5962

60-
**withRequest($request)**
63+
withRequest($request)
64+
---------------------
6165

6266
Allows you to provide an **IncomingRequest** instance tailored to your testing needs:
6367

@@ -66,7 +70,8 @@ Allows you to provide an **IncomingRequest** instance tailored to your testing n
6670
If you do not provide one, a new IncomingRequest instance with the default application values will be passed
6771
into your controller.
6872

69-
**withResponse($response)**
73+
withResponse($response)
74+
-----------------------
7075

7176
Allows you to provide a **Response** instance:
7277

@@ -75,7 +80,8 @@ Allows you to provide a **Response** instance:
7580
If you do not provide one, a new Response instance with the default application values will be passed
7681
into your controller.
7782

78-
**withLogger($logger)**
83+
withLogger($logger)
84+
-------------------
7985

8086
Allows you to provide a **Logger** instance:
8187

@@ -84,7 +90,8 @@ Allows you to provide a **Logger** instance:
8490
If you do not provide one, a new Logger instance with the default configuration values will be passed
8591
into your controller.
8692

87-
**withURI(string $uri)**
93+
withURI(string $uri)
94+
--------------------
8895

8996
Allows you to provide a new URI that simulates the URL the client was visiting when this controller was run.
9097
This is helpful if you need to check URI segments within your controller. The only parameter is a string
@@ -94,7 +101,8 @@ representing a valid URI:
94101

95102
It is a good practice to always provide the URI during testing to avoid surprises.
96103

97-
**withBody($body)**
104+
withBody($body)
105+
---------------
98106

99107
Allows you to provide a custom body for the request. This can be helpful when testing API controllers where
100108
you need to set a JSON value as the body. The only parameter is a string that represents the body of the request:
@@ -187,18 +195,30 @@ Assertions
187195
In addition to the helper methods above ``FilterTestTrait`` also comes with some assertions
188196
to streamline your test methods.
189197

190-
The **assertFilter()** method checks that the given route at position uses the filter (by its alias):
198+
assertFilter()
199+
^^^^^^^^^^^^^^
200+
201+
The ``assertFilter()`` method checks that the given route at position uses the filter (by its alias):
191202

192203
.. literalinclude:: controllers/015.php
193204

194-
The **assertNotFilter()** method checks that the given route at position does not use the filter (by its alias):
205+
assertNotFilter()
206+
^^^^^^^^^^^^^^^^^
207+
208+
The ``assertNotFilter()`` method checks that the given route at position does not use the filter (by its alias):
195209

196210
.. literalinclude:: controllers/016.php
197211

198-
The **assertHasFilters()** method checks that the given route at position has at least one filter set:
212+
assertHasFilters()
213+
^^^^^^^^^^^^^^^^^^
214+
215+
The ``assertHasFilters()`` method checks that the given route at position has at least one filter set:
199216

200217
.. literalinclude:: controllers/017.php
201218

202-
The **assertNotHasFilters()** method checks that the given route at position has no filters set:
219+
assertNotHasFilters()
220+
^^^^^^^^^^^^^^^^^^^^^
221+
222+
The ``assertNotHasFilters()`` method checks that the given route at position has no filters set:
203223

204224
.. literalinclude:: controllers/018.php

0 commit comments

Comments
 (0)