GravityKit\GravityView\Request\MockRequest
A mock for testing.
Since:
2.03.0.0(Migrated to GravityKit\GravityView\Request namespace.)
Source: src/Request/MockRequest.php:17
Details
- Kind:
class - Namespace:
GravityKit\GravityView\Request - Extends:
Request
Properties
| Property | Type | Description |
|---|---|---|
$returns | array | The return values. |
Methods
| Method | Description |
|---|---|
is_view() | The current $post is a View, no? |
is_entry() | Checks whether this is a single entry request |
is_edit_entry() | Checks whether this an edit entry request. |
is_search() | Checks whether this an entry search request. |
get_arguments() | Returns the arguments this request carries. |
__call() | Returns the configured value for the called method. |
Method Reference
is_view()
public function is_view( $return_view=true )
The current $post is a View, no?
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$return_view | bool | true | Whether to return a View object or boolean. |
Returns
- \GV\View |
bool— If the global $post is a View, returns the View or true, depending on $return_view. If not a View, returns false.
Since: 2.0
Source: src/Request/MockRequest.php:34
is_entry()
public function is_entry( $form_id=0 )
Checks whether this is a single entry request
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form_id | int | 0 | The form ID, since slugs can be non-unique. Default: 0. |
Returns
\GV\GF_Entry|false— The entry requested or false.
Since: 2.0
Source: src/Request/MockRequest.php:43
is_edit_entry()
public function is_edit_entry( $form_id=0 )
Checks whether this an edit entry request.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form_id | int | 0 | The form ID, since slugs can be non-unique. Default: 0. |
Returns
- \GV\Entry |
false— The entry requested or false.
Since: 2.0
Source: src/Request/MockRequest.php:52
is_search()
public function is_search( $view=null )
Checks whether this an entry search request.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$view | \GravityKit\GravityView\View\View | int | null | null | The View (or its ID) to scope the answer to, if known. |
Returns
boolean— True if this is a search request.
Since: 2.0
Source: src/Request/MockRequest.php:61
get_arguments()
public function get_arguments(): array
Returns the arguments this request carries.
A mock stands in for a request that is not being routed, such as a View rendered by shortcode. Unless arguments were given to it, the ones the visitor actually sent still apply.
Returns
array<string,— mixed> The arguments.
Since: $ver$
Source: src/Request/MockRequest.php:73
__call()
public function __call( $function, $args )
Returns the configured value for the called method.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$function | string | The method name. | |
$args | array | The call arguments. |
Returns
mixed— The configured value.
Since: 2.0
Source: src/Request/MockRequest.php:89