| Fully Qualified Name: | CodeIgniter\Test\Mock\MockEvents |
| Extends: | Events |
Events
| Name | Description | Defined By |
|---|---|---|
| getEventsFile() | MockEvents | |
| getFiles() | Returns the files that were found/loaded during this request. | Events |
| getListeners() | MockEvents | |
| getPerformanceLogs() | Getter for the performance log records. | Events |
| getSimulate() | MockEvents | |
| initialize() | Ensures that we have a events file ready. | Events |
| listeners() | Returns an array of listeners for a single event. They are sorted by priority. | Events |
| on() | Registers an action to happen on an event. The action can be any sort of callable: | Events |
| removeAllListeners() | Removes all listeners. | Events |
| removeListener() | Removes a single listener from an event. | Events |
| setFiles() | Sets the path to the file that routes are read from. | Events |
| simulate() | Turns simulation on or off. When on, events will not be triggered, simply logged. Useful during testing when you don't actually want the tests to run. | Events |
| trigger() | Runs through all subscribed methods running them one at a time, until either: a) All subscribers have finished or b) a method returns false, at which point execution of subscribers stops. | Events |
| unInitialize() | MockEvents |
Returns: void
Returns the files that were found/loaded during this request.
Returns: mixed
Returns: void
Getter for the performance log records.
Returns: array
Returns: void
Ensures that we have a events file ready.
Returns:
Returns an array of listeners for a single event. They are sorted by priority.
If the listener could not be found, returns FALSE, or TRUE if it was removed.
| Parameter Name | Type | Description |
|---|---|---|
| $event_name | ||
| $event_name |
Returns: array
Registers an action to happen on an event. The action can be any sort of callable:
Events::on('create', 'myFunction'); // procedural function Events::on('create', ['myClass', 'myMethod']); // Class::method Events::on('create', [$myInstance, 'myMethod']); // Method on an existing instance Events::on('create', function() }); // Closure
| Parameter Name | Type | Description |
|---|---|---|
| $event_name | ||
| $callback | callable | |
| $priority | int | |
| $event_name |
Returns:
Removes all listeners.
If the event_name is specified, only listeners for that event will be removed, otherwise all listeners for all events are removed.
| Parameter Name | Type | Description |
|---|---|---|
| $event_name | null |
Returns:
Removes a single listener from an event.
If the listener couldn't be found, returns FALSE, else TRUE if it was removed.
| Parameter Name | Type | Description |
|---|---|---|
| $event_name | ||
| $listener | callable | |
| $event_name |
Returns: bool
Sets the path to the file that routes are read from.
| Parameter Name | Type | Description |
|---|---|---|
| $files | array |
Returns:
Turns simulation on or off. When on, events will not be triggered, simply logged. Useful during testing when you don't actually want the tests to run.
| Parameter Name | Type | Description |
|---|---|---|
| $choice | bool |
Returns:
Runs through all subscribed methods running them one at a time, until either: a) All subscribers have finished or b) a method returns false, at which point execution of subscribers stops.
| Parameter Name | Type | Description |
|---|---|---|
| $arguments | ||
| $eventName | ||
| $arguments |
Returns: bool
Returns: void