NotifyCommandTest
extends TestCase
in package
ScheduledSearch/Notify command test.
Tags
Table of Contents
- $container : MockContainer
- Container for building mocks.
- setup() : void
- Setup method
- testNoNotifications() : void
- Test behavior when no notifications are waiting to be sent.
- testNotificationsWithNewSearchResults() : void
- Test behavior when notifications are waiting to be sent and new search results exist.
- testNotificationsWithNoNewSearchResults() : void
- Test behavior when notifications are waiting to be sent but no search results exist.
- testNotificationsWithNoSearchResults() : void
- Test behavior when notifications are waiting to be sent but no search results exist.
- testNotificationsWithUnsupportedBackend() : void
- Test behavior when notifications are waiting to be sent but an illegal backend is involved.
- testNotificationWithIllegalFrequency() : void
- Test behavior when notifications are waiting to be sent but there is no matching frequency configuration.
- testNotificationWithRecentExecution() : void
- Test behavior when notifications have already been sent recently.
- getCommand() : NotifyCommand
- Get a notify command for testing.
- getMockNotifications() : array<string|int, mixed>
- Create a list of fake notification objects.
- getMockResultsManager() : MockObject|PluginManager
- Create a mock results manager.
- getMockSearch() : MockObject|Minified
- Get a minified search object
- getMockSearchResults() : MockObject|Results
- Get mock search results.
- getMockSearchResultsSet() : array<string|int, mixed>
- Get mock search results.
- getMockSearchService() : MockObject|SearchServiceInterface
- Create a mock search table that returns a list of fake notification objects.
- getMockUserObject() : MockObject|UserEntityInterface
- Get a mock row representing a user.
Properties
$container
Container for building mocks.
protected
MockContainer
$container
Methods
setup()
Setup method
public
setup() : void
Return values
void —testNoNotifications()
Test behavior when no notifications are waiting to be sent.
public
testNoNotifications() : void
Return values
void —testNotificationsWithNewSearchResults()
Test behavior when notifications are waiting to be sent and new search results exist.
public
testNotificationsWithNewSearchResults() : void
Return values
void —testNotificationsWithNoNewSearchResults()
Test behavior when notifications are waiting to be sent but no search results exist.
public
testNotificationsWithNoNewSearchResults() : void
Return values
void —testNotificationsWithNoSearchResults()
Test behavior when notifications are waiting to be sent but no search results exist.
public
testNotificationsWithNoSearchResults() : void
Return values
void —testNotificationsWithUnsupportedBackend()
Test behavior when notifications are waiting to be sent but an illegal backend is involved.
public
testNotificationsWithUnsupportedBackend() : void
Return values
void —testNotificationWithIllegalFrequency()
Test behavior when notifications are waiting to be sent but there is no matching frequency configuration.
public
testNotificationWithIllegalFrequency() : void
Return values
void —testNotificationWithRecentExecution()
Test behavior when notifications have already been sent recently.
public
testNotificationWithRecentExecution() : void
Return values
void —getCommand()
Get a notify command for testing.
protected
getCommand([array<string|int, mixed> $options = [] ]) : NotifyCommand
Parameters
- $options : array<string|int, mixed> = []
-
Options to override
Return values
NotifyCommand —getMockNotifications()
Create a list of fake notification objects.
protected
getMockNotifications([array<string|int, mixed> $overrides = [] ][, callable|null $optionsCallback = null ][, callable|null $paramsCallback = null ][, callable|null $resultsCallback = null ]) : array<string|int, mixed>
Parameters
- $overrides : array<string|int, mixed> = []
-
Fields to override in the notification row.
- $optionsCallback : callable|null = null
-
Callback to set expectations on options object
- $paramsCallback : callable|null = null
-
Callback to set expectations on params object
- $resultsCallback : callable|null = null
-
Callback to set expectations on results object
Return values
array<string|int, mixed> —getMockResultsManager()
Create a mock results manager.
protected
getMockResultsManager() : MockObject|PluginManager
Return values
MockObject|PluginManager —getMockSearch()
Get a minified search object
protected
getMockSearch([callable|null $optionsCallback = null ][, callable|null $paramsCallback = null ][, callable|null $resultsCallback = null ]) : MockObject|Minified
Parameters
- $optionsCallback : callable|null = null
-
Callback to set expectations on options object
- $paramsCallback : callable|null = null
-
Callback to set expectations on params object
- $resultsCallback : callable|null = null
-
Callback to set expectations on results object
Return values
MockObject|Minified —getMockSearchResults()
Get mock search results.
protected
getMockSearchResults([callable|null $optionsCallback = null ][, callable|null $paramsCallback = null ][, callable|null $resultsCallback = null ]) : MockObject|Results
Parameters
- $optionsCallback : callable|null = null
-
Callback to set expectations on options object
- $paramsCallback : callable|null = null
-
Callback to set expectations on params object
- $resultsCallback : callable|null = null
-
Callback to set expectations on results object
Return values
MockObject|Results —getMockSearchResultsSet()
Get mock search results.
protected
getMockSearchResultsSet([AbstractBase $record = null ]) : array<string|int, mixed>
Parameters
- $record : AbstractBase = null
-
Record to return
Return values
array<string|int, mixed> —getMockSearchService()
Create a mock search table that returns a list of fake notification objects.
protected
getMockSearchService([array<string|int, mixed> $overrides = [] ][, callable|null $optionsCallback = null ][, callable|null $paramsCallback = null ][, callable|null $resultsCallback = null ]) : MockObject|SearchServiceInterface
Parameters
- $overrides : array<string|int, mixed> = []
-
Fields to override in the notification row.
- $optionsCallback : callable|null = null
-
Callback to set expectations on options object
- $paramsCallback : callable|null = null
-
Callback to set expectations on params object
- $resultsCallback : callable|null = null
-
Callback to set expectations on results object
Return values
MockObject|SearchServiceInterface —getMockUserObject()
Get a mock row representing a user.
protected
getMockUserObject([string $userId = 2 ]) : MockObject|UserEntityInterface
Parameters
- $userId : string = 2
-
User ID to be returned by mock.