VuFind API Documentation

OpenUrlTest extends TestCase
in package
Uses FixtureTrait, ViewTrait

OpenUrl Test Class

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

author

André Lahmann lahmann@ub.uni-leipzig.de

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Wiki

Table of Contents

$rulesConfig  : array<string|int, mixed>
Configuration array providing basic settings for testing OpenUrlRules
testCheckContextDefaults()  : void
Test checkContext() default behavior.
testCheckContextNoUrl()  : void
Test checkContext() with no URL set (everything should be false!)
testCheckContextWithOverrides()  : void
Test checkContext() behavior with configuration overrides.
testCheckExcludedRecordsRulesFalse()  : void
Test checkExcludedRecordRules() with rule not applying (isActive() will return TRUE!!)
testCheckExcludedRecordsRulesFalseDueToWildcardFailure()  : void
Test checkExcludedRecordRules() with no matching rule (isActive() will return FALSE!!). Specifically we're testing the case where a method has a generic wildcard match in the rules but returns an empty value.
testCheckExcludedRecordsRulesTrue()  : void
Test checkExcludedRecordRules() with matching rule (isActive() will return FALSE!!)
testCheckSupportedRecordsRulesFalse()  : void
Test checkSupportedRecordRules() with no matching rule (isActive() will return FALSE!!)
testCheckSupportedRecordsRulesTrue()  : void
Test checkSupportedRecordRules() with matching rule (isActive() will return TRUE!!)
testCheckSupportedRecordsRulesWithWildcardStillFalse()  : void
Test checkSupportedRecordRules() with no matching rule (isActive() will return FALSE!!) This test is specifically designed to test wildcards -- we want to be sure that ['CrazyFormat'] will NOT match ['Article', '*'].
testRecordDriverClassInRules()  : void
Test checkSupportedRecordRules() to see if it accounts for record driver class.
getFixture()  : string
Load a fixture file.
getFixtureDir()  : string
Get the base directory containing fixtures.
getFixturePath()  : string
Resolve fixture path.
getJsonFixture()  : array<string|int, mixed>
Load a JSON fixture from file (using associative array return type).
getMockContext()  : Context
Get mock context helper.
getMockDriver()  : SolrDefault
Get mock driver that returns an openURL.
getOpenUrl()  : OpenURL
Get the object to test
getPathForTheme()  : string
Get the directory for a given theme.
getPhpRenderer()  : PhpRenderer
Get a working renderer.
getSearchMemoryViewHelper()  : SearchMemory
Get mock SearchMemory view helper

Properties

$rulesConfig

Configuration array providing basic settings for testing OpenUrlRules

protected array<string|int, mixed> $rulesConfig = ['url' => 'http://foo/bar', 'show_in_results' => true]

Methods

testCheckContextDefaults()

Test checkContext() default behavior.

public testCheckContextDefaults() : void
Return values
void

testCheckContextNoUrl()

Test checkContext() with no URL set (everything should be false!)

public testCheckContextNoUrl() : void
Return values
void

testCheckContextWithOverrides()

Test checkContext() behavior with configuration overrides.

public testCheckContextWithOverrides() : void
Return values
void

testCheckExcludedRecordsRulesFalse()

Test checkExcludedRecordRules() with rule not applying (isActive() will return TRUE!!)

public testCheckExcludedRecordsRulesFalse() : void
Return values
void

testCheckExcludedRecordsRulesFalseDueToWildcardFailure()

Test checkExcludedRecordRules() with no matching rule (isActive() will return FALSE!!). Specifically we're testing the case where a method has a generic wildcard match in the rules but returns an empty value.

public testCheckExcludedRecordsRulesFalseDueToWildcardFailure() : void
Return values
void

testCheckExcludedRecordsRulesTrue()

Test checkExcludedRecordRules() with matching rule (isActive() will return FALSE!!)

public testCheckExcludedRecordsRulesTrue() : void
Return values
void

testCheckSupportedRecordsRulesFalse()

Test checkSupportedRecordRules() with no matching rule (isActive() will return FALSE!!)

public testCheckSupportedRecordsRulesFalse() : void
Return values
void

testCheckSupportedRecordsRulesTrue()

Test checkSupportedRecordRules() with matching rule (isActive() will return TRUE!!)

public testCheckSupportedRecordsRulesTrue() : void
Return values
void

testCheckSupportedRecordsRulesWithWildcardStillFalse()

Test checkSupportedRecordRules() with no matching rule (isActive() will return FALSE!!) This test is specifically designed to test wildcards -- we want to be sure that ['CrazyFormat'] will NOT match ['Article', '*'].

public testCheckSupportedRecordsRulesWithWildcardStillFalse() : void
Return values
void

testRecordDriverClassInRules()

Test checkSupportedRecordRules() to see if it accounts for record driver class.

public testRecordDriverClassInRules() : void
Return values
void

getFixture()

Load a fixture file.

protected getFixture(string $filename[, string $module = 'VuFind' ]) : string
Parameters
$filename : string

Filename relative to fixture directory.

$module : string = 'VuFind'

Module containing fixture.

Tags
throws
RuntimeException
Return values
string

getFixtureDir()

Get the base directory containing fixtures.

protected getFixtureDir([string $module = 'VuFind' ]) : string
Parameters
$module : string = 'VuFind'

Module containing fixture.

Return values
string

getFixturePath()

Resolve fixture path.

protected getFixturePath(string $filename[, string $module = 'VuFind' ]) : string
Parameters
$filename : string

Filename relative to fixture directory.

$module : string = 'VuFind'

Module containing fixture.

Tags
throws
RuntimeException
Return values
string

getJsonFixture()

Load a JSON fixture from file (using associative array return type).

protected getJsonFixture(string $filename[, string $module = 'VuFind' ]) : array<string|int, mixed>
Parameters
$filename : string

Filename relative to fixture directory.

$module : string = 'VuFind'

Module containing fixture.

Return values
array<string|int, mixed>

getMockDriver()

Get mock driver that returns an openURL.

protected getMockDriver([string $openUrl = 'fake-data' ][, string $class = VuFindRecordDriverSolrDefault::class ][, array<string|int, mixed> $formats = ['ElectronicArticle', 'Article'] ][, string $issn = '1234-5678' ]) : SolrDefault
Parameters
$openUrl : string = 'fake-data'

OpenURL to return

$class : string = VuFindRecordDriverSolrDefault::class

Class to mock

$formats : array<string|int, mixed> = ['ElectronicArticle', 'Article']

Formats to return from getFormats

$issn : string = '1234-5678'

ISSN to return from getCleanISSN

Return values
SolrDefault

getOpenUrl()

Get the object to test

protected getOpenUrl([array<string|int, mixed> $rules = null ][, array<string|int, mixed> $config = [] ][, object $mockContext = null ]) : OpenURL
Parameters
$rules : array<string|int, mixed> = null

JSON-decoded array containing rules (optional)

$config : array<string|int, mixed> = []

Configuration settings (optional)

$mockContext : object = null

Mock context helper (optional)

Return values
OpenURL

getPathForTheme()

Get the directory for a given theme.

protected getPathForTheme(string $theme) : string
Parameters
$theme : string

Theme directory name

Return values
string

getPhpRenderer()

Get a working renderer.

protected getPhpRenderer([array<string|int, mixed> $plugins = [] ][, string $theme = 'bootstrap3' ]) : PhpRenderer
Parameters
$plugins : array<string|int, mixed> = []

Custom VuFind plug-ins to register

$theme : string = 'bootstrap3'

Theme directory to load from

Return values
PhpRenderer

getSearchMemoryViewHelper()

Get mock SearchMemory view helper

protected getSearchMemoryViewHelper([Memory|null $memory = null ]) : SearchMemory
Parameters
$memory : Memory|null = null

Optional search memory

Return values
SearchMemory

Search results