VuFind API Documentation

RecordDataFormatterTest extends TestCase
in package
Uses ConfigPluginManagerTrait, FixtureTrait, ViewTrait, PathResolverTrait

RecordDataFormatter Test Class

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

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

link

Wiki

Table of Contents

getFormattingData()  : array<string|int, mixed>
Data Provider for testFormatting().
getFormattingDataWithGlobalOptions()  : array<string|int, mixed>
Data Provider for testFormattingWithGlobalOptions().
getGlobalTestConfig()  : array<string|int, mixed>
Get global options for testFormattingWithGlobalOptions.
testFormatting()  : void
Test formatting.
testFormattingWithGlobalOptions()  : void
Test formatting with global options.
addPathResolverToContainer()  : void
Add PathResolverFactory to a mock container
findResult()  : mixed
Find a result in the results array.
getDriver()  : SolrDefault
Get a record driver with fake data.
getFixture()  : string
Load a fixture file.
getFixtureDir()  : string
Get the base directory containing fixtures.
getFixturePath()  : string
Resolve fixture path.
getFormatter()  : RecordDataFormatter
Build a formatter, including necessary mock view w/ helpers.
getInvokedSpecs()  : array<string|int, mixed>
Invokes a RecordDataFormatter with a driver and returns getData results.
getInvokedSpecsWithGlobalOptions()  : array<string|int, mixed>
Invokes a RecordDataFormatter with global options and with a driver and returns getData results.
getJsonFixture()  : array<string|int, mixed>
Load a JSON fixture from file (using associative array return type).
getLabels()  : array<string|int, mixed>
Extract labels from a results array.
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.
getMockRecordRouter()  : MockObject|Router
Get a mock record router.
getOldSpecs()  : array<string|int, mixed>
Calls RecordDataFormatter::getData with a driver as parameter and returns the results.
getOldSpecsWithGlobalOptions()  : array<string|int, mixed>
Calls RecordDataFormatter::getData with global options with a driver as parameter and returns the results.
getPathForTheme()  : string
Get the directory for a given theme.
getPathResolver()  : PathResolver
Get a config file path resolver
getPhpRenderer()  : PhpRenderer
Get a working renderer.
getSearchMemoryViewHelper()  : SearchMemory
Get mock SearchMemory view helper
getViewHelpers()  : array<string|int, mixed>
Get view helpers needed by test.

Methods

getFormattingData()

Data Provider for testFormatting().

public static getFormattingData() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFormattingDataWithGlobalOptions()

Data Provider for testFormattingWithGlobalOptions().

public static getFormattingDataWithGlobalOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getGlobalTestConfig()

Get global options for testFormattingWithGlobalOptions.

public getGlobalTestConfig() : array<string|int, mixed>
Return values
array<string|int, mixed>

testFormatting()

Test formatting.

public testFormatting(string $function) : void
Parameters
$function : string

Function to test the formatting with.

Tags
dataProvider

getFormattingData

Return values
void

testFormattingWithGlobalOptions()

Test formatting with global options.

public testFormattingWithGlobalOptions(string $function) : void
Parameters
$function : string

Function to test the formatting with.

Tags
dataProvider

getFormattingDataWithGlobalOptions

Return values
void

addPathResolverToContainer()

Add PathResolverFactory to a mock container

protected addPathResolverToContainer(MockContainer $container) : void
Parameters
$container : MockContainer

Mock Container

Return values
void

findResult()

Find a result in the results array.

protected findResult(string $needle, array<string|int, mixed> $haystack) : mixed
Parameters
$needle : string

Result to look up.

$haystack : array<string|int, mixed>

Result set.

Return values
mixed

getDriver()

Get a record driver with fake data.

protected getDriver([array<string|int, mixed> $overrides = [] ]) : SolrDefault
Parameters
$overrides : array<string|int, mixed> = []

Fixture fields to override.

Return values
SolrDefault

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

getFormatter()

Build a formatter, including necessary mock view w/ helpers.

protected getFormatter([array<string|int, mixed> $additionalConfig = [] ]) : RecordDataFormatter
Parameters
$additionalConfig : array<string|int, mixed> = []

Additional RecordDataFormatter config

Return values
RecordDataFormatter

getInvokedSpecs()

Invokes a RecordDataFormatter with a driver and returns getData results.

protected getInvokedSpecs(SolrDefault $driver, array<string|int, mixed> $spec[, array<string|int, mixed> $globalOptions = [] ]) : array<string|int, mixed>
Parameters
$driver : SolrDefault

Driver to invoke with.

$spec : array<string|int, mixed>

Specifications to test with.

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

Optional global options.

Return values
array<string|int, mixed>

Results from RecordDataFormatter::getData

getInvokedSpecsWithGlobalOptions()

Invokes a RecordDataFormatter with global options and with a driver and returns getData results.

protected getInvokedSpecsWithGlobalOptions(SolrDefault $driver, array<string|int, mixed> $spec) : array<string|int, mixed>
Parameters
$driver : SolrDefault

Driver to invoke with.

$spec : array<string|int, mixed>

Specifications to test with.

Return values
array<string|int, mixed>

Results from RecordDataFormatter::getData

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>

getLabels()

Extract labels from a results array.

protected getLabels(array<string|int, mixed> $results) : array<string|int, mixed>
Parameters
$results : array<string|int, mixed>

Results to process.

Return values
array<string|int, mixed>

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

getOldSpecs()

Calls RecordDataFormatter::getData with a driver as parameter and returns the results.

protected getOldSpecs(SolrDefault $driver, array<string|int, mixed> $spec[, array<string|int, mixed> $globalOptions = [] ]) : array<string|int, mixed>
Parameters
$driver : SolrDefault

Driver to call with.

$spec : array<string|int, mixed>

Specifications to test with.

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

Optional global options.

Return values
array<string|int, mixed>

Results from RecordDataFormatter::getData

getOldSpecsWithGlobalOptions()

Calls RecordDataFormatter::getData with global options with a driver as parameter and returns the results.

protected getOldSpecsWithGlobalOptions(SolrDefault $driver, array<string|int, mixed> $spec) : array<string|int, mixed>
Parameters
$driver : SolrDefault

Driver to call with.

$spec : array<string|int, mixed>

Specifications to test with.

Return values
array<string|int, mixed>

Results from RecordDataFormatter::getData

getPathForTheme()

Get the directory for a given theme.

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

Theme directory name

Return values
string

getPathResolver()

Get a config file path resolver

protected getPathResolver([string|null $baseDirectory = null ]) : PathResolver
Parameters
$baseDirectory : string|null = null

Optional directory to override APPLICATION_PATH

Return values
PathResolver

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

getViewHelpers()

Get view helpers needed by test.

protected getViewHelpers(ContainerInterface $container) : array<string|int, mixed>
Parameters
$container : ContainerInterface

Mock service container

Return values
array<string|int, mixed>

Search results