GeneratorTest
extends TestCase
in package
Uses
FixtureTrait
Sitemap Generator Test Class
Tags
Table of Contents
- $container : MockContainer
- Mock container
- buildIndexProvider() : array<string|int, mixed>
- Data provider for testBuildIndex().
- setUp() : void
- Standard setup method.
- testBuildIndex() : void
- Test building the sitemap index.
- testEmptyWarnings() : void
- Test that the warnings array is initialized correctly.
- getFixture() : string
- Load a fixture file.
- getFixtureDir() : string
- Get the base directory containing fixtures.
- getFixturePath() : string
- Resolve fixture path.
- getGenerator() : Generator
- Get a generator for testing purposes.
- getJsonFixture() : array<string|int, mixed>
- Load a JSON fixture from file (using associative array return type).
- setAbsoluteUrlIndexExpectations() : void
- Configure a mock object for the "absolute URL" buildIndex test.
- setEmptyConfigIndexExpectations() : void
- Configure a mock object for the "empty configuration" buildIndex test.
- setMultipleIndexExpectations() : void
- Configure a mock object for the "multiple index files" buildIndex test.
- setRelativeFileIndexExpectations() : void
- Configure a mock object for the "relative file" buildIndex test.
Properties
$container
Mock container
protected
MockContainer
$container
= null
Methods
buildIndexProvider()
Data provider for testBuildIndex().
public
static buildIndexProvider() : array<string|int, mixed>
Return values
array<string|int, mixed> —setUp()
Standard setup method.
public
setUp() : void
Return values
void —testBuildIndex()
Test building the sitemap index.
public
testBuildIndex(array<string|int, mixed> $config, callable $expectationMethod) : void
Parameters
- $config : array<string|int, mixed>
-
Configuration settings
- $expectationMethod : callable
-
Name of method to set up expectations for mock index object
Tags
Return values
void —testEmptyWarnings()
Test that the warnings array is initialized correctly.
public
testEmptyWarnings() : 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
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 —getGenerator()
Get a generator for testing purposes.
protected
getGenerator([array<string|int, mixed> $config = [] ][, array<string|int, mixed> $objects = [] ][, array<string|int, mixed> $locales = ['en', 'de'] ][, string $baseUrl = 'http://foo' ]) : Generator
Parameters
- $config : array<string|int, mixed> = []
-
Sitemap configuration options
- $objects : array<string|int, mixed> = []
-
Dependency objects to override
- $locales : array<string|int, mixed> = ['en', 'de']
-
Locales to activate
- $baseUrl : string = 'http://foo'
-
Base URL of site
Return values
Generator —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> —setAbsoluteUrlIndexExpectations()
Configure a mock object for the "absolute URL" buildIndex test.
protected
setAbsoluteUrlIndexExpectations(MockObject|SitemapIndex $mockIndex) : void
Parameters
- $mockIndex : MockObject|SitemapIndex
-
Mock to configure
Return values
void —setEmptyConfigIndexExpectations()
Configure a mock object for the "empty configuration" buildIndex test.
protected
setEmptyConfigIndexExpectations(MockObject|SitemapIndex $mockIndex) : void
Parameters
- $mockIndex : MockObject|SitemapIndex
-
Mock to configure
Return values
void —setMultipleIndexExpectations()
Configure a mock object for the "multiple index files" buildIndex test.
protected
setMultipleIndexExpectations(MockObject|SitemapIndex $mockIndex) : void
Parameters
- $mockIndex : MockObject|SitemapIndex
-
Mock to configure
Return values
void —setRelativeFileIndexExpectations()
Configure a mock object for the "relative file" buildIndex test.
protected
setRelativeFileIndexExpectations(MockObject|SitemapIndex $mockIndex) : void
Parameters
- $mockIndex : MockObject|SitemapIndex
-
Mock to configure