DoiLookupTest
extends AjaxHandlerTestCase
in package
Uses
ConfigPluginManagerTrait
DoiLookup test class.
Tags
Table of Contents
- $container : MockContainer
- Mock container
- getTestSingleLookupData() : array<string|int, mixed>
- Data provider for testSingleLookup
- setUp() : void
- Standard setup method.
- testFirstDefaultLookup() : void
- Test a DOI lookup in two handlers, with "first" mode turned on by default.
- testFirstExplicitLookup() : void
- Test a DOI lookup in two handlers, with "first" mode turned on explicitly.
- testFirstExplicitLookupMultipleDOIs() : void
- Test a DOI lookup in two handlers, with "first" mode turned on explicitly, where each handler returns results for a different DOI.
- testMergeLookup() : void
- Test a DOI lookup in two handlers, with "merge" mode turned on.
- testSingleLookup() : void
- Test a single DOI lookup.
- getHandlerResults() : array<string|int, mixed>
- After setupConfig() and setupPluginManager() have been called, run the standard default test.
- getMockAuthManager() : MockObject|Manager
- Get an auth manager with a value set for getUserObject.
- getMockConfigPluginManager() : MockObject|PluginManager
- Get a mock configuration plugin manager with the given configuration "files" available.
- getMockFailingConfigPluginManager() : MockObject|PluginManager
- Get a mock configuration plugin manager that will throw an exception.
- getMockPlugin() : DoiLinkerInterface
- Create a mock plugin.
- getMockUser() : MockObject|UserEntityInterface
- Create mock user object.
- getParamsHelper() : Params
- Build a Params helper for testing.
- setupConfig() : void
- Set up configuration for a test.
- setupPluginManager() : void
- Set up a plugin manager for a test.
Properties
$container
Mock container
protected
MockContainer
$container
Methods
getTestSingleLookupData()
Data provider for testSingleLookup
public
static getTestSingleLookupData() : array<string|int, mixed>
Return values
array<string|int, mixed> —setUp()
Standard setup method.
public
setUp() : void
Return values
void —testFirstDefaultLookup()
Test a DOI lookup in two handlers, with "first" mode turned on by default.
public
testFirstDefaultLookup() : void
Return values
void —testFirstExplicitLookup()
Test a DOI lookup in two handlers, with "first" mode turned on explicitly.
public
testFirstExplicitLookup() : void
Return values
void —testFirstExplicitLookupMultipleDOIs()
Test a DOI lookup in two handlers, with "first" mode turned on explicitly, where each handler returns results for a different DOI.
public
testFirstExplicitLookupMultipleDOIs() : void
Return values
void —testMergeLookup()
Test a DOI lookup in two handlers, with "merge" mode turned on.
public
testMergeLookup() : void
Return values
void —testSingleLookup()
Test a single DOI lookup.
public
testSingleLookup(array<string|int, mixed> $config, bool $newWindow, string $remoteIcon) : void
Parameters
- $config : array<string|int, mixed>
-
Configuration
- $newWindow : bool
-
Expected "new window" setting
- $remoteIcon : string
-
Expected icon value
Tags
Return values
void —getHandlerResults()
After setupConfig() and setupPluginManager() have been called, run the standard default test.
protected
getHandlerResults([array<string|int, mixed> $requested = ['bar'] ]) : array<string|int, mixed>
Parameters
- $requested : array<string|int, mixed> = ['bar']
-
DOI(s) to test request with
Return values
array<string|int, mixed> —getMockAuthManager()
Get an auth manager with a value set for getUserObject.
protected
getMockAuthManager([UserEntityInterface|null $user = null ]) : MockObject|Manager
Parameters
- $user : UserEntityInterface|null = null
-
Return value for getUserObject()
Return values
MockObject|Manager —getMockConfigPluginManager()
Get a mock configuration plugin manager with the given configuration "files" available.
protected
getMockConfigPluginManager(array<string|int, mixed> $configs[, array<string|int, mixed> $default = [] ][, InvocationOrder|null $getExpect = null ][, InvocationOrder|null $hasExpect = null ]) : MockObject|PluginManager
Parameters
- $configs : array<string|int, mixed>
-
An associative array of configurations where key is the file (e.g. 'config') and value an array of configuration sections and directives
- $default : array<string|int, mixed> = []
-
Default configuration to return when no entry is found in $configs
- $getExpect : InvocationOrder|null = null
-
The expected invocation order for the get() method (null for any)
- $hasExpect : InvocationOrder|null = null
-
The expected invocation order for the has() method (null for any)
Return values
MockObject|PluginManager —getMockFailingConfigPluginManager()
Get a mock configuration plugin manager that will throw an exception.
protected
getMockFailingConfigPluginManager(Throwable $exception) : MockObject|PluginManager
Parameters
- $exception : Throwable
-
Exception to throw
Return values
MockObject|PluginManager —getMockPlugin()
Create a mock plugin.
protected
getMockPlugin(mixed $value[, string $times = 'once' ][, string $doi = 'bar' ][, array<string|int, mixed> $expected = ['bar'] ]) : DoiLinkerInterface
Parameters
- $value : mixed
-
Value to return in response to DOI request.
- $times : string = 'once'
-
How many times do we expect this method to be called?
- $doi : string = 'bar'
-
What DOI does this handler return data for?
- $expected : array<string|int, mixed> = ['bar']
-
What is the expected DOI request?
Return values
DoiLinkerInterface —getMockUser()
Create mock user object.
protected
getMockUser() : MockObject|UserEntityInterface
Return values
MockObject|UserEntityInterface —getParamsHelper()
Build a Params helper for testing.
protected
getParamsHelper([array<string|int, mixed> $get = [] ][, array<string|int, mixed> $post = [] ]) : Params
Parameters
- $get : array<string|int, mixed> = []
-
GET parameters
- $post : array<string|int, mixed> = []
-
POST parameters
Return values
Params —setupConfig()
Set up configuration for a test.
protected
setupConfig(array<string|int, mixed> $config) : void
Parameters
- $config : array<string|int, mixed>
-
Configuration to set.
Return values
void —setupPluginManager()
Set up a plugin manager for a test.
protected
setupPluginManager(array<string|int, mixed> $plugins) : void
Parameters
- $plugins : array<string|int, mixed>
-
Plugins to insert into container.