HumHub Documentation (unofficial)

Snapshot
in package
uses Asserts

AbstractYes

Table of Contents

Properties

$dataSet  : mixed
$extension  : mixed
$fileName  : mixed
$refresh  : mixed
$saveAsJson  : mixed
$showDiff  : mixed

Methods

assert()  : mixed
Performs assertion for data sets
setSnapshotFileExtension()  : void
Set the snapshot file extension.
shouldRefreshSnapshot()  : mixed
Force update snapshot data.
shouldSaveAsJson()  : mixed
json_encode/json_decode the snapshot data on storing/reading.
shouldShowDiffOnFail()  : mixed
Show detailed diff if snapshot test fails
assertData()  : mixed
Performs assertion on saved data set against current dataset.
assertFileNotExists()  : mixed
Asserts that a file does not exist.
assertGreaterOrEquals()  : mixed
Asserts that a value is greater than or equal to another value.
assertIsEmpty()  : mixed
Asserts that a variable is empty.
assertLessOrEquals()  : mixed
Asserts that a value is smaller than or equal to another value.
assertNot()  : mixed
assertNotRegExp()  : mixed
Asserts that a string does not match a given regular expression.
assertRegExp()  : mixed
Asserts that a string matches a given regular expression.
assertThatItsNot()  : mixed
Evaluates a PHPUnit\Framework\Constraint matcher object.
fetchData()  : mixed
Should return data from current test run
getFileName()  : string
If no filename is defined, generates one from class name
load()  : mixed
Loads data set from file.
save()  : mixed
Saves data set to file
printDebug()  : mixed

Properties

$extension

protected mixed $extension = 'json'

$saveAsJson

protected mixed $saveAsJson = true

$showDiff

protected mixed $showDiff = false

Methods

assert()

Performs assertion for data sets

public assert() : mixed

setSnapshotFileExtension()

Set the snapshot file extension.

public setSnapshotFileExtension([string $fileExtension = 'json' ]) : void

By default it will be stored as .json.

The file extension will not perform any formatting in the data, it is only used as the snapshot file extension.

Parameters
$fileExtension : string = 'json'

shouldRefreshSnapshot()

Force update snapshot data.

public shouldRefreshSnapshot([bool $refresh = true ]) : mixed
Parameters
$refresh : bool = true

shouldSaveAsJson()

json_encode/json_decode the snapshot data on storing/reading.

public shouldSaveAsJson([bool $saveAsJson = true ]) : mixed
Parameters
$saveAsJson : bool = true

shouldShowDiffOnFail()

Show detailed diff if snapshot test fails

public shouldShowDiffOnFail([bool $showDiff = true ]) : mixed
Parameters
$showDiff : bool = true

assertData()

Performs assertion on saved data set against current dataset.

protected assertData(mixed $data) : mixed

Can be overridden to implement custom assertion

Parameters
$data : mixed

assertFileNotExists()

Asserts that a file does not exist.

protected assertFileNotExists(string $filename[, string $message = '' ]) : mixed
Parameters
$filename : string
$message : string = ''

assertGreaterOrEquals()

Asserts that a value is greater than or equal to another value.

protected assertGreaterOrEquals(mixed $expected, mixed $actual[, string $message = '' ]) : mixed
Parameters
$expected : mixed
$actual : mixed
$message : string = ''

assertIsEmpty()

Asserts that a variable is empty.

protected assertIsEmpty(mixed $actual[, string $message = '' ]) : mixed
Parameters
$actual : mixed
$message : string = ''

assertLessOrEquals()

Asserts that a value is smaller than or equal to another value.

protected assertLessOrEquals(mixed $expected, mixed $actual[, string $message = '' ]) : mixed
Parameters
$expected : mixed
$actual : mixed
$message : string = ''

assertNot()

protected assertNot(mixed $arguments) : mixed
Parameters
$arguments : mixed

assertNotRegExp()

Asserts that a string does not match a given regular expression.

protected assertNotRegExp(string $pattern, string $string[, string $message = '' ]) : mixed
Parameters
$pattern : string
$string : string
$message : string = ''

assertRegExp()

Asserts that a string matches a given regular expression.

protected assertRegExp(string $pattern, string $string[, string $message = '' ]) : mixed
Parameters
$pattern : string
$string : string
$message : string = ''

assertThatItsNot()

Evaluates a PHPUnit\Framework\Constraint matcher object.

protected assertThatItsNot(mixed $value, Constraint $constraint[, string $message = '' ]) : mixed
Parameters
$value : mixed
$constraint : Constraint
$message : string = ''

fetchData()

Should return data from current test run

protected abstract fetchData() : mixed

getFileName()

If no filename is defined, generates one from class name

protected getFileName() : string
Return values
string

load()

Loads data set from file.

protected load() : mixed

save()

Saves data set to file

protected save() : mixed

printDebug()

private printDebug(mixed $message) : mixed
Parameters
$message : mixed

        
On this page

Search results