RecordTest
extends TestCase
in package
Uses
FixtureTrait, WithConsecutiveTrait
Record view helper Test Class
Tags
Table of Contents
- $testTheme : string
- Theme to use for testing purposes.
- getLinkProvider() : array<string|int, mixed>
- Data provider for testGetLink()
- testGetCheckbox() : void
- Test getCheckbox.
- testGetCollectionMetadata() : void
- Test getCollectionMetadata.
- testGetExport() : void
- Test getExport.
- testGetFormatClass() : void
- Test getFormatClass.
- testGetFormatList() : void
- Test getFormatList.
- testGetLink() : void
- Test getLink.
- testGetLinkDetailsEmpty() : void
- Test getLinkDetails with an empty list
- testGetLinkDetailsFailure() : void
- Test getLinkDetails with invalid details
- testGetLinkDetailsSuccess() : void
- Test getLinkDetails with valid details
- testGetLinkDetailsWithDuplicateURLs() : void
- Test getLinkDetails with duplicate URLs
- testGetListEntry() : void
- Test getListEntry.
- testGetPreviewIds() : void
- Test getPreviewIds.
- testGetPreviews() : void
- Test getPreviews.
- testGetQrCodeFailures() : void
- Test various ways of making getQrCode() fail.
- testGetQrCodeSuccess() : void
- Test successful getQrCode() call.
- testGetSearchResult() : void
- Test getSearchResult.
- testGetTab() : void
- Test getTab.
- testGetThumbnailDynamic() : void
- Test getThumbnail() - dynamic thumbnail case
- testGetThumbnailHardCoded() : void
- Test getThumbnail() - hardcoded thumbnail case
- testGetThumbnailNone() : void
- Test getThumbnail() - no thumbnail case
- testGetToolbar() : void
- Test getToolbar.
- testGetUrlList() : void
- Test getUrlList
- testMissingTemplate() : void
- Test attempting to display a template that does not exist.
- testMissingTemplateWithoutException() : void
- Test attempting to display a template that does not exist without throwing an exception.
- testTemplateInheritance() : void
- Test template inheritance.
- expectConsecutiveCalls() : InvocationStubber
- Expect consecutive calls to a mock.
- getCoverLoader() : Loader
- Get a loader object to test.
- 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() : MockObject|Context
- Get a mock context object
- getMockResolver() : MockObject|ResolverInterface
- Get a mock resolver object
- getMockSearchTabs() : MockObject|SearchTabs
- Get a mock search tabs view helper
- getMockServerUrl() : MockObject|ServerUrl
- Get a mock server URL helper
- getMockUrl() : MockObject|Url
- Get a mock URL helper
- getRecord() : Record
- Get a Record object ready for testing.
- getThemeDir() : string
- Get the theme directory.
- loadRecordFixture() : object
- Load a fixture file.
- setSuccessTemplate() : void
- Set up expectations for a template
Properties
$testTheme
Theme to use for testing purposes.
protected
string
$testTheme
= 'bootstrap3'
Methods
getLinkProvider()
Data provider for testGetLink()
public
static getLinkProvider() : array<string|int, mixed>
Return values
array<string|int, mixed> —testGetCheckbox()
Test getCheckbox.
public
testGetCheckbox() : void
Return values
void —testGetCollectionMetadata()
Test getCollectionMetadata.
public
testGetCollectionMetadata() : void
Return values
void —testGetExport()
Test getExport.
public
testGetExport() : void
Return values
void —testGetFormatClass()
Test getFormatClass.
public
testGetFormatClass() : void
Return values
void —testGetFormatList()
Test getFormatList.
public
testGetFormatList() : void
Return values
void —testGetLink()
Test getLink.
public
testGetLink(string $linkUrl, string $expectedSeparator, string $hiddenFilter, string $expected) : void
Parameters
- $linkUrl : string
-
Base link returned by link template
- $expectedSeparator : string
-
Separator expected by getCurrentHiddenFilterParams
- $hiddenFilter : string
-
Return value from getCurrentHiddenFilterParams
- $expected : string
-
Expected final result
Tags
Return values
void —testGetLinkDetailsEmpty()
Test getLinkDetails with an empty list
public
testGetLinkDetailsEmpty() : void
Return values
void —testGetLinkDetailsFailure()
Test getLinkDetails with invalid details
public
testGetLinkDetailsFailure() : void
Return values
void —testGetLinkDetailsSuccess()
Test getLinkDetails with valid details
public
testGetLinkDetailsSuccess() : void
Return values
void —testGetLinkDetailsWithDuplicateURLs()
Test getLinkDetails with duplicate URLs
public
testGetLinkDetailsWithDuplicateURLs() : void
Return values
void —testGetListEntry()
Test getListEntry.
public
testGetListEntry() : void
Return values
void —testGetPreviewIds()
Test getPreviewIds.
public
testGetPreviewIds() : void
Return values
void —testGetPreviews()
Test getPreviews.
public
testGetPreviews() : void
Return values
void —testGetQrCodeFailures()
Test various ways of making getQrCode() fail.
public
testGetQrCodeFailures() : void
Return values
void —testGetQrCodeSuccess()
Test successful getQrCode() call.
public
testGetQrCodeSuccess() : void
Return values
void —testGetSearchResult()
Test getSearchResult.
public
testGetSearchResult() : void
Return values
void —testGetTab()
Test getTab.
public
testGetTab() : void
Return values
void —testGetThumbnailDynamic()
Test getThumbnail() - dynamic thumbnail case
public
testGetThumbnailDynamic() : void
Return values
void —testGetThumbnailHardCoded()
Test getThumbnail() - hardcoded thumbnail case
public
testGetThumbnailHardCoded() : void
Return values
void —testGetThumbnailNone()
Test getThumbnail() - no thumbnail case
public
testGetThumbnailNone() : void
Return values
void —testGetToolbar()
Test getToolbar.
public
testGetToolbar() : void
Return values
void —testGetUrlList()
Test getUrlList
public
testGetUrlList() : void
Return values
void —testMissingTemplate()
Test attempting to display a template that does not exist.
public
testMissingTemplate() : void
Return values
void —testMissingTemplateWithoutException()
Test attempting to display a template that does not exist without throwing an exception.
public
testMissingTemplateWithoutException() : void
Return values
void —testTemplateInheritance()
Test template inheritance.
public
testTemplateInheritance() : void
Return values
void —expectConsecutiveCalls()
Expect consecutive calls to a mock.
protected
expectConsecutiveCalls(MockObject $mock, string $method, array<string|int, mixed> $expectedCalls[, mixed $returnValues = null ]) : InvocationStubber
Parameters
- $mock : MockObject
-
Mock object
- $method : string
-
Method expecting calls
- $expectedCalls : array<string|int, mixed>
-
Expected input parameters
- $returnValues : mixed = null
-
Return values to mock (either an array indexed parallel to $expectedCalls to return different values, or a single value to always return the same thing)
Return values
InvocationStubber —getCoverLoader()
Get a loader object to test.
protected
getCoverLoader([array<string|int, mixed> $config = [] ][, PluginManager $manager = null ][, ThemeInfo $theme = null ][, HttpService $httpService = null ][, array<string|int, mixed>|bool $mock = false ]) : Loader
Parameters
- $config : array<string|int, mixed> = []
-
Configuration
- $manager : PluginManager = null
-
Plugin manager (null to create mock)
- $theme : ThemeInfo = null
-
Theme info object (null to create default)
- $httpService : HttpService = null
-
HTTP client factory
- $mock : array<string|int, mixed>|bool = false
-
Array of functions to mock, or false for real object
Return values
Loader —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
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
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> —getMockContext()
Get a mock context object
protected
getMockContext() : MockObject|Context
Return values
MockObject|Context —getMockResolver()
Get a mock resolver object
protected
getMockResolver() : MockObject|ResolverInterface
Return values
MockObject|ResolverInterface —getMockSearchTabs()
Get a mock search tabs view helper
protected
getMockSearchTabs([bool $setDefaultExpectations = true ]) : MockObject|SearchTabs
Parameters
- $setDefaultExpectations : bool = true
-
Should we set up default expectations?
Return values
MockObject|SearchTabs —getMockServerUrl()
Get a mock server URL helper
protected
getMockServerUrl() : MockObject|ServerUrl
Return values
MockObject|ServerUrl —getMockUrl()
Get a mock URL helper
protected
getMockUrl(string $expectedRoute) : MockObject|Url
Parameters
- $expectedRoute : string
-
Route expected by mock helper
Return values
MockObject|Url —getRecord()
Get a Record object ready for testing.
protected
getRecord(AbstractBase $driver[, array<string|int, mixed>|Config $config = [] ][, Context $context = null ][, bool|string $url = false ][, bool $serverurl = false ][, bool $setSearchTabExpectations = true ]) : Record
Parameters
- $driver : AbstractBase
-
Record driver
- $config : array<string|int, mixed>|Config = []
-
Configuration
- $context : Context = null
-
Context helper
- $url : bool|string = false
-
Should we add a URL helper? False if no, expected route if yes.
- $serverurl : bool = false
-
Should we add a ServerURL helper?
- $setSearchTabExpectations : bool = true
-
Should we set default search tab expectations?
Return values
Record —getThemeDir()
Get the theme directory.
protected
getThemeDir() : string
Return values
string —loadRecordFixture()
Load a fixture file.
protected
loadRecordFixture(string $file) : object
Parameters
- $file : string
-
File to load from fixture directory.
Return values
object —setSuccessTemplate()
Set up expectations for a template
protected
setSuccessTemplate(Record $record, string $tpl[, string $response = 'success' ][, object|null $matcher = null ]) : void
Parameters
- $record : Record
-
Record helper
- $tpl : string
-
Template to expect
- $response : string = 'success'
-
Response to send
- $matcher : object|null = null
-
Matcher for frequency of calls (default = once)