Class TestCase
Cake TestCase class
Property Summary
-
$_configure protected
arrayConfigure values to restore at end of test.
-
$_tableLocator protected
Cake\ORM\Locator\LocatorInterface|nullTable locator instance
-
$autoFixtures public
boolBy default, all fixtures attached to this class will be truncated and reloaded after each test. Set this to false to handle manually
-
$backupGlobals protected
?bool -
$backupGlobalsBlacklist protected
string[] -
$backupStaticAttributes protected
?bool -
$backupStaticAttributesBlacklist protected
array<string, array<int, string>> -
$dropTables public
boolControl table create/drops on each test method.
-
$fixtureManager public
Cake\TestSuite\Fixture\FixtureManager|nullThe class responsible for managing the creation, loading and removing of fixtures
-
$fixtures protected
string[]Fixtures used by this test case.
-
$preserveGlobalState protected
bool -
$runTestInSeparateProcess protected
?bool
Method Summary
-
__construct() public
-
_assertAttributes() protected
Check the attributes as part of an assertTags() check.
-
_getTableClassName() protected
Gets the class name for the table.
-
_normalizePath() protected
Normalize a path for comparison.
-
addToAssertionCount() public
-
addWarning() public
-
any() public static
Returns a matcher that matches when the method is executed zero or more times.
-
anything() public static
-
arrayHasKey() public static
-
assertArrayHasKey() public static
Asserts that an array has a specified key.
-
assertArrayNotHasKey() public static
Asserts that an array does not have a specified key.
-
assertArraySubset() public static deprecated
Asserts that an array has a specified subset.
-
assertAttributeContains() public static deprecated
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains a needle.
-
assertAttributeContainsOnly() public static deprecated
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains only values of a given type.
-
assertAttributeCount() public static deprecated
Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.
-
assertAttributeEmpty() public static deprecated
Asserts that a static attribute of a class or an attribute of an object is empty.
-
assertAttributeEquals() public static deprecated
Asserts that a variable is equal to an attribute of an object.
-
assertAttributeGreaterThan() public static deprecated
Asserts that an attribute is greater than another value.
-
assertAttributeGreaterThanOrEqual() public static deprecated
Asserts that an attribute is greater than or equal to another value.
-
assertAttributeInstanceOf() public static deprecated
Asserts that an attribute is of a given type.
-
assertAttributeInternalType() public static deprecated
Asserts that an attribute is of a given type.
-
assertAttributeLessThan() public static deprecated
Asserts that an attribute is smaller than another value.
-
assertAttributeLessThanOrEqual() public static deprecated
Asserts that an attribute is smaller than or equal to another value.
-
assertAttributeNotContains() public static deprecated
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object does not contain a needle.
-
assertAttributeNotContainsOnly() public static deprecated
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object does not contain only values of a given type.
-
assertAttributeNotCount() public static deprecated
Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.
-
assertAttributeNotEmpty() public static deprecated
Asserts that a static attribute of a class or an attribute of an object is not empty.
-
assertAttributeNotEquals() public static deprecated
Asserts that a variable is not equal to an attribute of an object.
-
assertAttributeNotInstanceOf() public static deprecated
Asserts that an attribute is of a given type.
-
assertAttributeNotInternalType() public static deprecated
Asserts that an attribute is of a given type.
-
assertAttributeNotSame() public static deprecated
Asserts that a variable and an attribute of an object do not have the same type and value.
-
assertAttributeSame() public static deprecated
Asserts that a variable and an attribute of an object have the same type and value.
-
assertClassHasAttribute() public static
Asserts that a class has a specified attribute.
-
assertClassHasStaticAttribute() public static
Asserts that a class has a specified static attribute.
-
assertClassNotHasAttribute() public static
Asserts that a class does not have a specified attribute.
-
assertClassNotHasStaticAttribute() public static
Asserts that a class does not have a specified static attribute.
-
assertContains() public static
Asserts that a haystack contains a needle.
-
assertContainsEquals() public static
-
assertContainsOnly() public static
Asserts that a haystack contains only values of a given type.
-
assertContainsOnlyInstancesOf() public static
Asserts that a haystack contains only instances of a given class name.
-
assertCount() public static
Asserts the number of elements of an array, Countable or Traversable.
-
assertDirectoryExists() public static
Asserts that a directory exists.
-
assertDirectoryIsReadable() public static
Asserts that a directory exists and is readable.
-
assertDirectoryIsWritable() public static
Asserts that a directory exists and is writable.
-
assertDirectoryNotExists() public static
Asserts that a directory does not exist.
-
assertDirectoryNotIsReadable() public static
Asserts that a directory exists and is not readable.
-
assertDirectoryNotIsWritable() public static
Asserts that a directory exists and is not writable.
-
assertEmpty() public static
Asserts that a variable is empty.
-
assertEqualXMLStructure() public static
Asserts that a hierarchy of DOMElements matches.
-
assertEquals() public static
Asserts that two variables are equal.
-
assertEqualsCanonicalizing() public static
Asserts that two variables are equal (canonicalizing).
-
assertEqualsIgnoringCase() public static
Asserts that two variables are equal (ignoring case).
-
assertEqualsWithDelta() public static
Asserts that two variables are equal (with delta).
-
assertEventFired() public
Asserts that a global event was fired. You must track events in your event manager for this assertion to work
-
assertEventFiredWith() public
Asserts an event was fired with data
-
assertFalse() public static
Asserts that a condition is false.
-
assertFileEquals() public static
Asserts that the contents of one file is equal to the contents of another file.
-
assertFileEqualsCanonicalizing() public static
Asserts that the contents of one file is equal to the contents of another file (canonicalizing).
-
assertFileEqualsIgnoringCase() public static
Asserts that the contents of one file is equal to the contents of another file (ignoring case).
-
assertFileExists() public static
Asserts that a file exists.
-
assertFileIsReadable() public static
Asserts that a file exists and is readable.
-
assertFileIsWritable() public static
Asserts that a file exists and is writable.
-
assertFileNotEquals() public static
Asserts that the contents of one file is not equal to the contents of another file.
-
assertFileNotEqualsCanonicalizing() public static
Asserts that the contents of one file is not equal to the contents of another file (canonicalizing).
-
assertFileNotEqualsIgnoringCase() public static
Asserts that the contents of one file is not equal to the contents of another file (ignoring case).
-
assertFileNotExists() public static
Asserts that a file does not exist.
-
assertFileNotIsReadable() public static
Asserts that a file exists and is not readable.
-
assertFileNotIsWritable() public static
Asserts that a file exists and is not writable.
-
assertFinite() public static
Asserts that a variable is finite.
-
assertGreaterThan() public static
Asserts that a value is greater than another value.
-
assertGreaterThanOrEqual() public static
Asserts that a value is greater than or equal to another value.
-
assertHtml() public
Asserts HTML tags.
-
assertInfinite() public static
Asserts that a variable is infinite.
-
assertInstanceOf() public static
Asserts that a variable is of a given type.
-
assertInternalType() public static deprecated
Asserts that a variable is of a given type.
-
assertIsArray() public static
Asserts that a variable is of type array.
-
assertIsBool() public static
Asserts that a variable is of type bool.
-
assertIsCallable() public static
Asserts that a variable is of type callable.
-
assertIsFloat() public static
Asserts that a variable is of type float.
-
assertIsInt() public static
Asserts that a variable is of type int.
-
assertIsIterable() public static
Asserts that a variable is of type iterable.
-
assertIsNotArray() public static
Asserts that a variable is not of type array.
-
assertIsNotBool() public static
Asserts that a variable is not of type bool.
-
assertIsNotCallable() public static
Asserts that a variable is not of type callable.
-
assertIsNotFloat() public static
Asserts that a variable is not of type float.
-
assertIsNotInt() public static
Asserts that a variable is not of type int.
-
assertIsNotIterable() public static
Asserts that a variable is not of type iterable.
-
assertIsNotNumeric() public static
Asserts that a variable is not of type numeric.
-
assertIsNotObject() public static
Asserts that a variable is not of type object.
-
assertIsNotResource() public static
Asserts that a variable is not of type resource.
-
assertIsNotScalar() public static
Asserts that a variable is not of type scalar.
-
assertIsNotString() public static
Asserts that a variable is not of type string.
-
assertIsNumeric() public static
Asserts that a variable is of type numeric.
-
assertIsObject() public static
Asserts that a variable is of type object.
-
assertIsReadable() public static
Asserts that a file/dir is readable.
-
assertIsResource() public static
Asserts that a variable is of type resource.
-
assertIsScalar() public static
Asserts that a variable is of type scalar.
-
assertIsString() public static
Asserts that a variable is of type string.
-
assertIsWritable() public static
Asserts that a file/dir exists and is writable.
-
assertJson() public static
Asserts that a string is a valid JSON string.
-
assertJsonFileEqualsJsonFile() public static
Asserts that two JSON files are equal.
-
assertJsonFileNotEqualsJsonFile() public static
Asserts that two JSON files are not equal.
-
assertJsonStringEqualsJsonFile() public static
Asserts that the generated JSON encoded object and the content of the given file are equal.
-
assertJsonStringEqualsJsonString() public static
Asserts that two given JSON encoded objects or arrays are equal.
-
assertJsonStringNotEqualsJsonFile() public static
Asserts that the generated JSON encoded object and the content of the given file are not equal.
-
assertJsonStringNotEqualsJsonString() public static
Asserts that two given JSON encoded objects or arrays are not equal.
-
assertLessThan() public static
Asserts that a value is smaller than another value.
-
assertLessThanOrEqual() public static
Asserts that a value is smaller than or equal to another value.
-
assertNan() public static
Asserts that a variable is nan.
-
assertNotContains() public static
Asserts that a haystack does not contain a needle.
-
assertNotContainsEquals() public static
-
assertNotContainsOnly() public static
Asserts that a haystack does not contain only values of a given type.
-
assertNotCount() public static
Asserts the number of elements of an array, Countable or Traversable.
-
assertNotEmpty() public static
Asserts that a variable is not empty.
-
assertNotEquals() public static
Asserts that two variables are not equal.
-
assertNotEqualsCanonicalizing() public static
Asserts that two variables are not equal (canonicalizing).
-
assertNotEqualsIgnoringCase() public static
Asserts that two variables are not equal (ignoring case).
-
assertNotEqualsWithDelta() public static
Asserts that two variables are not equal (with delta).
-
assertNotFalse() public static
Asserts that a condition is not false.
-
assertNotInstanceOf() public static
Asserts that a variable is not of a given type.
-
assertNotInternalType() public static deprecated
Asserts that a variable is not of a given type.
-
assertNotIsReadable() public static
Asserts that a file/dir exists and is not readable.
-
assertNotIsWritable() public static
Asserts that a file/dir exists and is not writable.
-
assertNotNull() public static
Asserts that a variable is not null.
-
assertNotRegExp() public static
Asserts that a string does not match a given regular expression.
-
assertNotSame() public static
Asserts that two variables do not have the same type and value. Used on objects, it asserts that two variables do not reference the same object.
-
assertNotSameSize() public static
Assert that the size of two arrays (or
CountableorTraversableobjects) is not the same. -
assertNotTrue() public static
Asserts that a condition is not true.
-
assertNotWithinRange() protected static
Compatibility function to test if a value is not between an acceptable range.
-
assertNull() public static
Asserts that a variable is null.
-
assertObjectHasAttribute() public static
Asserts that an object has a specified attribute.
-
assertObjectNotHasAttribute() public static
Asserts that an object does not have a specified attribute.
-
assertPathEquals() protected static
Compatibility function to test paths.
-
assertPostConditions() protected
Performs assertions shared by all tests of a test case.
-
assertPreConditions() protected
Performs assertions shared by all tests of a test case.
-
assertRegExp() public static
Asserts that a string matches a given regular expression.
-
assertSame() public static
Asserts that two variables have the same type and value. Used on objects, it asserts that two variables reference the same object.
-
assertSameSize() public static
Assert that the size of two arrays (or
CountableorTraversableobjects) is the same. -
assertStringContainsString() public static
-
assertStringContainsStringIgnoringCase() public static
-
assertStringEndsNotWith() public static
Asserts that a string ends not with a given suffix.
-
assertStringEndsWith() public static
Asserts that a string ends with a given suffix.
-
assertStringEqualsFile() public static
Asserts that the contents of a string is equal to the contents of a file.
-
assertStringEqualsFileCanonicalizing() public static
Asserts that the contents of a string is equal to the contents of a file (canonicalizing).
-
assertStringEqualsFileIgnoringCase() public static
Asserts that the contents of a string is equal to the contents of a file (ignoring case).
-
assertStringMatchesFormat() public static
Asserts that a string matches a given format string.
-
assertStringMatchesFormatFile() public static
Asserts that a string matches a given format file.
-
assertStringNotContainsString() public static
-
assertStringNotContainsStringIgnoringCase() public static
-
assertStringNotEqualsFile() public static
Asserts that the contents of a string is not equal to the contents of a file.
-
assertStringNotEqualsFileCanonicalizing() public static
Asserts that the contents of a string is not equal to the contents of a file (canonicalizing).
-
assertStringNotEqualsFileIgnoringCase() public static
Asserts that the contents of a string is not equal to the contents of a file (ignoring case).
-
assertStringNotMatchesFormat() public static
Asserts that a string does not match a given format string.
-
assertStringNotMatchesFormatFile() public static
Asserts that a string does not match a given format string.
-
assertStringStartsNotWith() public static
Asserts that a string starts not with a given prefix.
-
assertStringStartsWith() public static
Asserts that a string starts with a given prefix.
-
assertTextContains() public
Assert that a string contains another string, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
-
assertTextEndsNotWith() public
Asserts that a string ends not with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
-
assertTextEndsWith() public
Asserts that a string ends with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
-
assertTextEquals() public
Assert text equality, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
-
assertTextNotContains() public
Assert that a text doesn't contain another text, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
-
assertTextNotEquals() public
Assert text equality, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
-
assertTextStartsNotWith() public
Asserts that a string starts not with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
-
assertTextStartsWith() public
Asserts that a string starts with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
-
assertThat() public static
Evaluates a PHPUnit\Framework\Constraint matcher object.
-
assertTrue() public static
Asserts that a condition is true.
-
assertWithinRange() protected static
Compatibility function to test if a value is between an acceptable range.
-
assertXmlFileEqualsXmlFile() public static
Asserts that two XML files are equal.
-
assertXmlFileNotEqualsXmlFile() public static
Asserts that two XML files are not equal.
-
assertXmlStringEqualsXmlFile() public static
Asserts that two XML documents are equal.
-
assertXmlStringEqualsXmlString() public static
Asserts that two XML documents are equal.
-
assertXmlStringNotEqualsXmlFile() public static
Asserts that two XML documents are not equal.
-
assertXmlStringNotEqualsXmlString() public static
Asserts that two XML documents are not equal.
-
at() public static
Returns a matcher that matches when the method is executed at the given index.
-
atLeast() public static
Returns a matcher that matches when the method is executed at least N times.
-
atLeastOnce() public static
Returns a matcher that matches when the method is executed at least once.
-
atMost() public static
Returns a matcher that matches when the method is executed at most N times.
-
attribute() public static deprecated
-
attributeEqualTo() public static deprecated
-
callback() public static
-
classHasAttribute() public static
-
classHasStaticAttribute() public static
-
clearPlugins() public
Clear all plugins from the global plugin collection.
-
contains() public static deprecated
-
containsEqual() public static
-
containsIdentical() public static
-
containsOnly() public static
-
containsOnlyInstancesOf() public static
-
count() public
-
countOf() public static
-
createConfiguredMock() protected
Returns a configured mock object for the specified class.
-
createMock() protected
Returns a mock object for the specified class.
-
createPartialMock() protected
Returns a partial mock object for the specified class.
-
createResult() protected
Creates a default TestResult object.
-
createStub() protected
Makes configurable stub for the specified class.
-
createTestProxy() protected
Returns a test proxy for the specified class.
-
dataDescription() public
-
dataName() public
-
deprecated() public
Helper method for check deprecation methods
-
directoryExists() public static
-
doesNotPerformAssertions() public
-
doubledTypes() public
-
equalTo() public static
-
exactly() public static
Returns a matcher that matches when the method is executed exactly $count times.
-
expectDeprecation() public
-
expectDeprecationMessage() public
-
expectDeprecationMessageMatches() public
-
expectError() public
-
expectErrorMessage() public
-
expectErrorMessageMatches() public
-
expectException() public
-
expectExceptionCode() public
-
expectExceptionMessage() public
-
expectExceptionMessageMatches() public
-
expectExceptionMessageRegExp() public deprecated
-
expectExceptionObject() public
Sets up an expectation for an exception to be raised by the code under test. Information for expected exception class, expected exception message, and expected exception code are retrieved from a given Exception object.
-
expectNotToPerformAssertions() public
-
expectNotice() public
-
expectNoticeMessage() public
-
expectNoticeMessageMatches() public
-
expectOutputRegex() public
-
expectOutputString() public
-
expectWarning() public
-
expectWarningMessage() public
-
expectWarningMessageMatches() public
-
fail() public static
Fails a test with the given message.
-
fileExists() public static
-
getActualOutput() public
-
getActualOutputForAssertion() public
-
getAnnotations() public
-
getCount() public static
Return the current assertion count.
-
getDataSetAsString() public
-
getDependencies() public
-
getDependencyInput() public
-
getExpectedException() public
-
getExpectedExceptionCode() public
-
getExpectedExceptionMessage() public
-
getExpectedExceptionMessageRegExp() public
-
getFixtures() public
Gets fixtures.
-
getGroups() public
-
getMockBuilder() public
Returns a builder object to create mock objects using a fluent interface.
-
getMockClass() protected
Mocks the specified class and returns the name of the mocked class.
-
getMockForAbstractClass() protected
Returns a mock object for the specified abstract class with all abstract methods of the class mocked. Concrete methods are not mocked by default. To mock concrete methods, use the 7th parameter ($mockedMethods).
-
getMockForModel() public
Mock a model, maintain fixtures and table association
-
getMockForTrait() protected
Returns a mock object for the specified trait with all abstract methods of the trait mocked. Concrete methods to mock can be specified with the
$mockedMethodsparameter. -
getMockFromWsdl() protected
Returns a mock object based on the given WSDL file.
-
getName() public
-
getNumAssertions() public
Returns the number of assertions performed by this test.
-
getObjectAttribute() public static deprecated
Returns the value of an object's attribute. This also works for attributes that are declared protected or private.
-
getObjectForTrait() protected
Returns an object for the specified trait.
-
getProvidedData() public
Gets the data set of a TestCase.
-
getResult() public
-
getSize() public
Returns the size of the test.
-
getStaticAttribute() public static deprecated
Returns the value of a static attribute. This also works for attributes that are declared protected or private.
-
getStatus() public
-
getStatusMessage() public
-
getTableLocator() public
Gets the table locator.
-
getTestResultObject() public
-
greaterThan() public static
-
greaterThanOrEqual() public static
-
hasDependencies() public
-
hasExpectationOnOutput() public
-
hasFailed() public
-
hasOutput() public
-
hasSize() public
-
identicalTo() public static
-
iniSet() protected
This method is a wrapper for the ini_set() function that automatically resets the modified php.ini setting to its original value after the test is run.
-
isEmpty() public static
-
isFalse() public static
-
isFinite() public static
-
isInIsolation() public
-
isInfinite() public static
-
isInstanceOf() public static
-
isJson() public static
-
isLarge() public
-
isMedium() public
-
isNan() public static
-
isNull() public static
-
isReadable() public static
-
isSmall() public
-
isTrue() public static
-
isType() public static
-
isWritable() public static
-
lessThan() public static
-
lessThanOrEqual() public static
-
loadFixtures() public
Chooses which fixtures to load for a given test
-
loadPlugins() public
Load plugins into a simulated application.
-
loadRoutes() public
Load routes for the application.
-
logicalAnd() public static
-
logicalNot() public static
-
logicalOr() public static
-
logicalXor() public static
-
markAsRisky() public
-
markTestIncomplete() public static
Mark the test as incomplete.
-
markTestSkipped() public static
Mark the test as skipped.
-
matches() public static
-
matchesRegularExpression() public static
-
never() public static
Returns a matcher that matches when the method is never executed.
-
objectHasAttribute() public static
-
onConsecutiveCalls() public static
-
onNotSuccessfulTest() protected
This method is called when a test method did not execute successfully.
-
once() public static
Returns a matcher that matches when the method is executed exactly once.
-
prophesize() protected
-
readAttribute() public static deprecated
Returns the value of an attribute of a class or an object. This also works for attributes that are declared protected or private.
-
registerComparator() public
-
registerMockObject() public
-
removePlugins() public
Remove plugins from the global plugin collection.
-
resetCount() public static
Reset the assertion counter.
-
returnArgument() public static
-
returnCallback() public static
-
returnSelf() public static
Returns the current object.
-
returnValue() public static
-
returnValueMap() public static
-
run() public
Runs the test case and collects the results in a TestResult object. If no TestResult object is passed a new one will be created.
-
runBare() public
-
runTest() protected
Override to run the test and assert its state.
-
setAppNamespace() public static
Set the app namespace
-
setBackupGlobals() public
-
setBackupStaticAttributes() public
-
setBeStrictAboutChangesToGlobalState() public
-
setDependencies() public
-
setDependencyInput() public
-
setGroups() public
-
setInIsolation() public
-
setLocale() protected
This method is a wrapper for the setlocale() function that automatically resets the locale to its original value after the test is run.
-
setName() public
-
setOutputCallback() public
-
setPreserveGlobalState() public
-
setRegisterMockObjectsFromTestArgumentsRecursively() public
-
setResult() public
-
setRunClassInSeparateProcess() public
-
setRunTestInSeparateProcess() public
-
setTableLocator() public
Sets the table locator.
-
setTestResultObject() public
-
setUp() public
Setup the test case, backup the static object values so they can be restored. Specifically backs up the contents of Configure and paths in App if they have not already been backed up.
-
setUpBeforeClass() public static
This method is called before the first test of this test class is run.
-
setUseErrorHandler() public deprecated
-
skipIf() public
Overrides SimpleTestCase::skipIf to provide a boolean return value
-
skipUnless() protected
Compatibility function for skipping.
-
stringContains() public static
-
stringEndsWith() public static
-
stringStartsWith() public static
-
tearDown() public
teardown any static object changes and restore them.
-
tearDownAfterClass() public static
This method is called after the last test of this test class is run.
-
throwException() public static
-
toString() public
Returns a string representation of the test case.
-
usesDataProvider() public
-
withErrorReporting() public
Helper method for tests that needs to use error_reporting()
Method Detail
__construct() ¶ public
__construct(string $name = null, array $data = [], string $dataName = '')
Parameters
-
string$name optional -
array$data optional -
string$dataName optional
_assertAttributes() ¶ protected
_assertAttributes(array $assertions, string $string, bool $fullDebug = false, array|string $regex = ''): string|false
Check the attributes as part of an assertTags() check.
Parameters
-
array$assertions Assertions to run.
-
string$string The HTML string to check.
-
bool$fullDebug optional Whether or not more verbose output should be used.
-
array|string$regex optional Full regexp from
assertHtml
Returns
string|false_getTableClassName() ¶ protected
_getTableClassName(string $alias, array $options): string
Gets the class name for the table.
Parameters
-
string$alias The model to get a mock for.
-
array$options The config data for the mock's constructor.
Returns
stringThrows
Cake\ORM\Exception\MissingTableClassException_normalizePath() ¶ protected
_normalizePath(string $path): string
Normalize a path for comparison.
Parameters
-
string$path Path separated by "/" slash.
Returns
stringaddToAssertionCount() ¶ public
addToAssertionCount(int $count): void
Parameters
-
int$count
Returns
voidany() ¶ public static
any(): AnyInvokedCountMatcher
Returns a matcher that matches when the method is executed zero or more times.
Returns
AnyInvokedCountMatcherarrayHasKey() ¶ public static
arrayHasKey(int|string $key): ArrayHasKey
Parameters
-
int|string$key
Returns
ArrayHasKeyassertArrayHasKey() ¶ public static
assertArrayHasKey(int|string $key, array|ArrayAccess $array, string $message = ''): void
Asserts that an array has a specified key.
Parameters
-
int|string$key -
array|ArrayAccess$array -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertArrayNotHasKey() ¶ public static
assertArrayNotHasKey(int|string $key, array|ArrayAccess $array, string $message = ''): void
Asserts that an array does not have a specified key.
Parameters
-
int|string$key -
array|ArrayAccess$array -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertArraySubset() ¶ public static
assertArraySubset(array|ArrayAccess $subset, array|ArrayAccess $array, bool $checkForObjectIdentity = false, string $message = ''): void
Asserts that an array has a specified subset.
Parameters
-
array|ArrayAccess$subset -
array|ArrayAccess$array -
bool$checkForObjectIdentity optional -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeContains() ¶ public static
assertAttributeContains(mixed $needle, string $haystackAttributeName, object|string $haystackClassOrObject, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains a needle.
Parameters
-
$needle -
string$haystackAttributeName -
object|string$haystackClassOrObject -
string$message optional -
bool$ignoreCase optional -
bool$checkForObjectIdentity optional -
bool$checkForNonObjectIdentity optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeContainsOnly() ¶ public static
assertAttributeContainsOnly(string $type, string $haystackAttributeName, object|string $haystackClassOrObject, ?bool $isNativeType = null, string $message = ''): void
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains only values of a given type.
Parameters
-
string$type -
string$haystackAttributeName -
object|string$haystackClassOrObject -
?bool$isNativeType optional -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeCount() ¶ public static
assertAttributeCount(int $expectedCount, string $haystackAttributeName, object|string $haystackClassOrObject, string $message = ''): void
Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.
Parameters
-
int$expectedCount -
string$haystackAttributeName -
object|string$haystackClassOrObject -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeEmpty() ¶ public static
assertAttributeEmpty(string $haystackAttributeName, object|string $haystackClassOrObject, string $message = ''): void
Asserts that a static attribute of a class or an attribute of an object is empty.
Parameters
-
string$haystackAttributeName -
object|string$haystackClassOrObject -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeEquals() ¶ public static
assertAttributeEquals(mixed $expected, string $actualAttributeName, object|string $actualClassOrObject, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void
Asserts that a variable is equal to an attribute of an object.
Parameters
-
$expected -
string$actualAttributeName -
object|string$actualClassOrObject -
string$message optional -
float$delta optional -
int$maxDepth optional -
bool$canonicalize optional -
bool$ignoreCase optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeGreaterThan() ¶ public static
assertAttributeGreaterThan(mixed $expected, string $actualAttributeName, object|string $actualClassOrObject, string $message = ''): void
Asserts that an attribute is greater than another value.
Parameters
-
$expected -
string$actualAttributeName -
object|string$actualClassOrObject -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeGreaterThanOrEqual() ¶ public static
assertAttributeGreaterThanOrEqual(mixed $expected, string $actualAttributeName, object|string $actualClassOrObject, string $message = ''): void
Asserts that an attribute is greater than or equal to another value.
Parameters
-
$expected -
string$actualAttributeName -
object|string$actualClassOrObject -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeInstanceOf() ¶ public static
assertAttributeInstanceOf(string $expected, string $attributeName, object|string $classOrObject, string $message = ''): void
Asserts that an attribute is of a given type.
Parameters
-
string$expected -
string$attributeName -
object|string$classOrObject -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeInternalType() ¶ public static
assertAttributeInternalType(string $expected, string $attributeName, object|string $classOrObject, string $message = ''): void
Asserts that an attribute is of a given type.
Parameters
-
string$expected -
string$attributeName -
object|string$classOrObject -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeLessThan() ¶ public static
assertAttributeLessThan(mixed $expected, string $actualAttributeName, object|string $actualClassOrObject, string $message = ''): void
Asserts that an attribute is smaller than another value.
Parameters
-
$expected -
string$actualAttributeName -
object|string$actualClassOrObject -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeLessThanOrEqual() ¶ public static
assertAttributeLessThanOrEqual(mixed $expected, string $actualAttributeName, object|string $actualClassOrObject, string $message = ''): void
Asserts that an attribute is smaller than or equal to another value.
Parameters
-
$expected -
string$actualAttributeName -
object|string$actualClassOrObject -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeNotContains() ¶ public static
assertAttributeNotContains(mixed $needle, string $haystackAttributeName, object|string $haystackClassOrObject, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object does not contain a needle.
Parameters
-
$needle -
string$haystackAttributeName -
object|string$haystackClassOrObject -
string$message optional -
bool$ignoreCase optional -
bool$checkForObjectIdentity optional -
bool$checkForNonObjectIdentity optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeNotContainsOnly() ¶ public static
assertAttributeNotContainsOnly(string $type, string $haystackAttributeName, object|string $haystackClassOrObject, ?bool $isNativeType = null, string $message = ''): void
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object does not contain only values of a given type.
Parameters
-
string$type -
string$haystackAttributeName -
object|string$haystackClassOrObject -
?bool$isNativeType optional -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeNotCount() ¶ public static
assertAttributeNotCount(int $expectedCount, string $haystackAttributeName, object|string $haystackClassOrObject, string $message = ''): void
Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.
Parameters
-
int$expectedCount -
string$haystackAttributeName -
object|string$haystackClassOrObject -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeNotEmpty() ¶ public static
assertAttributeNotEmpty(string $haystackAttributeName, object|string $haystackClassOrObject, string $message = ''): void
Asserts that a static attribute of a class or an attribute of an object is not empty.
Parameters
-
string$haystackAttributeName -
object|string$haystackClassOrObject -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeNotEquals() ¶ public static
assertAttributeNotEquals(mixed $expected, string $actualAttributeName, object|string $actualClassOrObject, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void
Asserts that a variable is not equal to an attribute of an object.
Parameters
-
$expected -
string$actualAttributeName -
object|string$actualClassOrObject -
string$message optional -
float$delta optional -
int$maxDepth optional -
bool$canonicalize optional -
bool$ignoreCase optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeNotInstanceOf() ¶ public static
assertAttributeNotInstanceOf(string $expected, string $attributeName, object|string $classOrObject, string $message = ''): void
Asserts that an attribute is of a given type.
Parameters
-
string$expected -
string$attributeName -
object|string$classOrObject -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeNotInternalType() ¶ public static
assertAttributeNotInternalType(string $expected, string $attributeName, object|string $classOrObject, string $message = ''): void
Asserts that an attribute is of a given type.
Parameters
-
string$expected -
string$attributeName -
object|string$classOrObject -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeNotSame() ¶ public static
assertAttributeNotSame(mixed $expected, string $actualAttributeName, object|string $actualClassOrObject, string $message = ''): void
Asserts that a variable and an attribute of an object do not have the same type and value.
Parameters
-
$expected -
string$actualAttributeName -
object|string$actualClassOrObject -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertAttributeSame() ¶ public static
assertAttributeSame(mixed $expected, string $actualAttributeName, object|string $actualClassOrObject, string $message = ''): void
Asserts that a variable and an attribute of an object have the same type and value.
Parameters
-
$expected -
string$actualAttributeName -
object|string$actualClassOrObject -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertClassHasAttribute() ¶ public static
assertClassHasAttribute(string $attributeName, string $className, string $message = ''): void
Asserts that a class has a specified attribute.
Parameters
-
string$attributeName -
string$className -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertClassHasStaticAttribute() ¶ public static
assertClassHasStaticAttribute(string $attributeName, string $className, string $message = ''): void
Asserts that a class has a specified static attribute.
Parameters
-
string$attributeName -
string$className -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertClassNotHasAttribute() ¶ public static
assertClassNotHasAttribute(string $attributeName, string $className, string $message = ''): void
Asserts that a class does not have a specified attribute.
Parameters
-
string$attributeName -
string$className -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertClassNotHasStaticAttribute() ¶ public static
assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = ''): void
Asserts that a class does not have a specified static attribute.
Parameters
-
string$attributeName -
string$className -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertContains() ¶ public static
assertContains(mixed $needle, mixed $haystack, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void
Asserts that a haystack contains a needle.
Parameters
-
$needle -
$haystack -
string$message optional -
bool$ignoreCase optional -
bool$checkForObjectIdentity optional -
bool$checkForNonObjectIdentity optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertContainsEquals() ¶ public static
assertContainsEquals(mixed $needle, iterable $haystack, string $message = ''): void
Parameters
-
$needle -
iterable$haystack -
string$message optional
Returns
voidassertContainsOnly() ¶ public static
assertContainsOnly(string $type, iterable $haystack, ?bool $isNativeType = null, string $message = ''): void
Asserts that a haystack contains only values of a given type.
Parameters
-
string$type -
iterable$haystack -
?bool$isNativeType optional -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertContainsOnlyInstancesOf() ¶ public static
assertContainsOnlyInstancesOf(string $className, iterable $haystack, string $message = ''): void
Asserts that a haystack contains only instances of a given class name.
Parameters
-
string$className -
iterable$haystack -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertCount() ¶ public static
assertCount(int $expectedCount, Countable|iterable $haystack, string $message = ''): void
Asserts the number of elements of an array, Countable or Traversable.
Parameters
-
int$expectedCount -
Countable|iterable$haystack -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertDirectoryExists() ¶ public static
assertDirectoryExists(string $directory, string $message = ''): void
Asserts that a directory exists.
Parameters
-
string$directory -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertDirectoryIsReadable() ¶ public static
assertDirectoryIsReadable(string $directory, string $message = ''): void
Asserts that a directory exists and is readable.
Parameters
-
string$directory -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertDirectoryIsWritable() ¶ public static
assertDirectoryIsWritable(string $directory, string $message = ''): void
Asserts that a directory exists and is writable.
Parameters
-
string$directory -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertDirectoryNotExists() ¶ public static
assertDirectoryNotExists(string $directory, string $message = ''): void
Asserts that a directory does not exist.
Parameters
-
string$directory -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertDirectoryNotIsReadable() ¶ public static
assertDirectoryNotIsReadable(string $directory, string $message = ''): void
Asserts that a directory exists and is not readable.
Parameters
-
string$directory -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertDirectoryNotIsWritable() ¶ public static
assertDirectoryNotIsWritable(string $directory, string $message = ''): void
Asserts that a directory exists and is not writable.
Parameters
-
string$directory -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertEmpty() ¶ public static
assertEmpty(mixed $actual, string $message = ''): void
Asserts that a variable is empty.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertEqualXMLStructure() ¶ public static
assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement, bool $checkAttributes = false, string $message = ''): void
Asserts that a hierarchy of DOMElements matches.
Parameters
-
DOMElement$expectedElement -
DOMElement$actualElement -
bool$checkAttributes optional -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionAssertionFailedErrorExpectationFailedExceptionassertEquals() ¶ public static
assertEquals(mixed $expected, mixed $actual, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void
Asserts that two variables are equal.
Parameters
-
$expected -
$actual -
string$message optional -
float$delta optional -
int$maxDepth optional -
bool$canonicalize optional -
bool$ignoreCase optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertEqualsCanonicalizing() ¶ public static
assertEqualsCanonicalizing(mixed $expected, mixed $actual, string $message = ''): void
Asserts that two variables are equal (canonicalizing).
Parameters
-
$expected -
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertEqualsIgnoringCase() ¶ public static
assertEqualsIgnoringCase(mixed $expected, mixed $actual, string $message = ''): void
Asserts that two variables are equal (ignoring case).
Parameters
-
$expected -
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertEqualsWithDelta() ¶ public static
assertEqualsWithDelta(mixed $expected, mixed $actual, float $delta, string $message = ''): void
Asserts that two variables are equal (with delta).
Parameters
-
$expected -
$actual -
float$delta -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertEventFired() ¶ public
assertEventFired(string $name, Cake\Event\EventManager|null $eventManager = null, string $message = ''): void
Asserts that a global event was fired. You must track events in your event manager for this assertion to work
Parameters
-
string$name Event name
-
Cake\Event\EventManager|null$eventManager optional Event manager to check, defaults to global event manager
-
string$message optional Assertion failure message
Returns
voidassertEventFiredWith() ¶ public
assertEventFiredWith(string $name, string $dataKey, mixed $dataValue, Cake\Event\EventManager|null $eventManager = null, string $message = ''): void
Asserts an event was fired with data
If a third argument is passed, that value is used to compare with the value in $dataKey
Parameters
-
string$name Event name
-
string$dataKey Data key
-
mixed$dataValue Data value
-
Cake\Event\EventManager|null$eventManager optional Event manager to check, defaults to global event manager
-
string$message optional Assertion failure message
Returns
voidassertFalse() ¶ public static
assertFalse(mixed $condition, string $message = ''): void
Asserts that a condition is false.
Parameters
-
$condition -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertFileEquals() ¶ public static
assertFileEquals(string $expected, string $actual, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void
Asserts that the contents of one file is equal to the contents of another file.
Parameters
-
string$expected -
string$actual -
string$message optional -
bool$canonicalize optional -
bool$ignoreCase optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertFileEqualsCanonicalizing() ¶ public static
assertFileEqualsCanonicalizing(string $expected, string $actual, string $message = ''): void
Asserts that the contents of one file is equal to the contents of another file (canonicalizing).
Parameters
-
string$expected -
string$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertFileEqualsIgnoringCase() ¶ public static
assertFileEqualsIgnoringCase(string $expected, string $actual, string $message = ''): void
Asserts that the contents of one file is equal to the contents of another file (ignoring case).
Parameters
-
string$expected -
string$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertFileExists() ¶ public static
assertFileExists(string $filename, string $message = ''): void
Asserts that a file exists.
Parameters
-
string$filename -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertFileIsReadable() ¶ public static
assertFileIsReadable(string $file, string $message = ''): void
Asserts that a file exists and is readable.
Parameters
-
string$file -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertFileIsWritable() ¶ public static
assertFileIsWritable(string $file, string $message = ''): void
Asserts that a file exists and is writable.
Parameters
-
string$file -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertFileNotEquals() ¶ public static
assertFileNotEquals(string $expected, string $actual, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void
Asserts that the contents of one file is not equal to the contents of another file.
Parameters
-
string$expected -
string$actual -
string$message optional -
bool$canonicalize optional -
bool$ignoreCase optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertFileNotEqualsCanonicalizing() ¶ public static
assertFileNotEqualsCanonicalizing(string $expected, string $actual, string $message = ''): void
Asserts that the contents of one file is not equal to the contents of another file (canonicalizing).
Parameters
-
string$expected -
string$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertFileNotEqualsIgnoringCase() ¶ public static
assertFileNotEqualsIgnoringCase(string $expected, string $actual, string $message = ''): void
Asserts that the contents of one file is not equal to the contents of another file (ignoring case).
Parameters
-
string$expected -
string$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertFileNotExists() ¶ public static
assertFileNotExists(string $filename, string $message = ''): void
Asserts that a file does not exist.
Parameters
-
string$filename -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertFileNotIsReadable() ¶ public static
assertFileNotIsReadable(string $file, string $message = ''): void
Asserts that a file exists and is not readable.
Parameters
-
string$file -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertFileNotIsWritable() ¶ public static
assertFileNotIsWritable(string $file, string $message = ''): void
Asserts that a file exists and is not writable.
Parameters
-
string$file -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertFinite() ¶ public static
assertFinite(mixed $actual, string $message = ''): void
Asserts that a variable is finite.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertGreaterThan() ¶ public static
assertGreaterThan(mixed $expected, mixed $actual, string $message = ''): void
Asserts that a value is greater than another value.
Parameters
-
$expected -
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertGreaterThanOrEqual() ¶ public static
assertGreaterThanOrEqual(mixed $expected, mixed $actual, string $message = ''): void
Asserts that a value is greater than or equal to another value.
Parameters
-
$expected -
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertHtml() ¶ public
assertHtml(array $expected, string $string, bool $fullDebug = false): bool
Asserts HTML tags.
Takes an array $expected and generates a regex from it to match the provided $string. Samples for $expected:
Checks for an input tag with a name attribute (contains any non-empty value) and an id attribute that contains 'my-input':
['input' => ['name', 'id' => 'my-input']]
Checks for two p elements with some text in them:
[
['p' => true],
'textA',
'/p',
['p' => true],
'textB',
'/p'
]
You can also specify a pattern expression as part of the attribute values, or the tag being defined, if you prepend the value with preg: and enclose it with slashes, like so:
[
['input' => ['name', 'id' => 'preg:/FieldName\d+/']],
'preg:/My\s+field/'
]
Important: This function is very forgiving about whitespace and also accepts any permutation of attribute order. It will also allow whitespace between specified tags.
Parameters
-
array$expected An array, see above
-
string$string An HTML/XHTML/XML string
-
bool$fullDebug optional Whether or not more verbose output should be used.
Returns
boolassertInfinite() ¶ public static
assertInfinite(mixed $actual, string $message = ''): void
Asserts that a variable is infinite.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertInstanceOf() ¶ public static
assertInstanceOf(string $expected, mixed $actual, string $message = ''): void
Asserts that a variable is of a given type.
Parameters
-
string$expected -
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertInternalType() ¶ public static
assertInternalType(string $expected, mixed $actual, string $message = ''): void
Asserts that a variable is of a given type.
Parameters
-
string$expected -
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsArray() ¶ public static
assertIsArray(mixed $actual, string $message = ''): void
Asserts that a variable is of type array.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsBool() ¶ public static
assertIsBool(mixed $actual, string $message = ''): void
Asserts that a variable is of type bool.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsCallable() ¶ public static
assertIsCallable(mixed $actual, string $message = ''): void
Asserts that a variable is of type callable.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsFloat() ¶ public static
assertIsFloat(mixed $actual, string $message = ''): void
Asserts that a variable is of type float.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsInt() ¶ public static
assertIsInt(mixed $actual, string $message = ''): void
Asserts that a variable is of type int.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsIterable() ¶ public static
assertIsIterable(mixed $actual, string $message = ''): void
Asserts that a variable is of type iterable.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsNotArray() ¶ public static
assertIsNotArray(mixed $actual, string $message = ''): void
Asserts that a variable is not of type array.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsNotBool() ¶ public static
assertIsNotBool(mixed $actual, string $message = ''): void
Asserts that a variable is not of type bool.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsNotCallable() ¶ public static
assertIsNotCallable(mixed $actual, string $message = ''): void
Asserts that a variable is not of type callable.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsNotFloat() ¶ public static
assertIsNotFloat(mixed $actual, string $message = ''): void
Asserts that a variable is not of type float.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsNotInt() ¶ public static
assertIsNotInt(mixed $actual, string $message = ''): void
Asserts that a variable is not of type int.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsNotIterable() ¶ public static
assertIsNotIterable(mixed $actual, string $message = ''): void
Asserts that a variable is not of type iterable.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsNotNumeric() ¶ public static
assertIsNotNumeric(mixed $actual, string $message = ''): void
Asserts that a variable is not of type numeric.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsNotObject() ¶ public static
assertIsNotObject(mixed $actual, string $message = ''): void
Asserts that a variable is not of type object.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsNotResource() ¶ public static
assertIsNotResource(mixed $actual, string $message = ''): void
Asserts that a variable is not of type resource.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsNotScalar() ¶ public static
assertIsNotScalar(mixed $actual, string $message = ''): void
Asserts that a variable is not of type scalar.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsNotString() ¶ public static
assertIsNotString(mixed $actual, string $message = ''): void
Asserts that a variable is not of type string.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsNumeric() ¶ public static
assertIsNumeric(mixed $actual, string $message = ''): void
Asserts that a variable is of type numeric.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsObject() ¶ public static
assertIsObject(mixed $actual, string $message = ''): void
Asserts that a variable is of type object.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsReadable() ¶ public static
assertIsReadable(string $filename, string $message = ''): void
Asserts that a file/dir is readable.
Parameters
-
string$filename -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsResource() ¶ public static
assertIsResource(mixed $actual, string $message = ''): void
Asserts that a variable is of type resource.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsScalar() ¶ public static
assertIsScalar(mixed $actual, string $message = ''): void
Asserts that a variable is of type scalar.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsString() ¶ public static
assertIsString(mixed $actual, string $message = ''): void
Asserts that a variable is of type string.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertIsWritable() ¶ public static
assertIsWritable(string $filename, string $message = ''): void
Asserts that a file/dir exists and is writable.
Parameters
-
string$filename -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertJson() ¶ public static
assertJson(string $actualJson, string $message = ''): void
Asserts that a string is a valid JSON string.
Parameters
-
string$actualJson -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertJsonFileEqualsJsonFile() ¶ public static
assertJsonFileEqualsJsonFile(string $expectedFile, string $actualFile, string $message = ''): void
Asserts that two JSON files are equal.
Parameters
-
string$expectedFile -
string$actualFile -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertJsonFileNotEqualsJsonFile() ¶ public static
assertJsonFileNotEqualsJsonFile(string $expectedFile, string $actualFile, string $message = ''): void
Asserts that two JSON files are not equal.
Parameters
-
string$expectedFile -
string$actualFile -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertJsonStringEqualsJsonFile() ¶ public static
assertJsonStringEqualsJsonFile(string $expectedFile, string $actualJson, string $message = ''): void
Asserts that the generated JSON encoded object and the content of the given file are equal.
Parameters
-
string$expectedFile -
string$actualJson -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertJsonStringEqualsJsonString() ¶ public static
assertJsonStringEqualsJsonString(string $expectedJson, string $actualJson, string $message = ''): void
Asserts that two given JSON encoded objects or arrays are equal.
Parameters
-
string$expectedJson -
string$actualJson -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertJsonStringNotEqualsJsonFile() ¶ public static
assertJsonStringNotEqualsJsonFile(string $expectedFile, string $actualJson, string $message = ''): void
Asserts that the generated JSON encoded object and the content of the given file are not equal.
Parameters
-
string$expectedFile -
string$actualJson -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertJsonStringNotEqualsJsonString() ¶ public static
assertJsonStringNotEqualsJsonString(string $expectedJson, string $actualJson, string $message = ''): void
Asserts that two given JSON encoded objects or arrays are not equal.
Parameters
-
string$expectedJson -
string$actualJson -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertLessThan() ¶ public static
assertLessThan(mixed $expected, mixed $actual, string $message = ''): void
Asserts that a value is smaller than another value.
Parameters
-
$expected -
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertLessThanOrEqual() ¶ public static
assertLessThanOrEqual(mixed $expected, mixed $actual, string $message = ''): void
Asserts that a value is smaller than or equal to another value.
Parameters
-
$expected -
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertNan() ¶ public static
assertNan(mixed $actual, string $message = ''): void
Asserts that a variable is nan.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertNotContains() ¶ public static
assertNotContains(mixed $needle, mixed $haystack, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void
Asserts that a haystack does not contain a needle.
Parameters
-
$needle -
$haystack -
string$message optional -
bool$ignoreCase optional -
bool$checkForObjectIdentity optional -
bool$checkForNonObjectIdentity optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertNotContainsEquals() ¶ public static
assertNotContainsEquals(mixed $needle, iterable $haystack, string $message = ''): void
Parameters
-
$needle -
iterable$haystack -
string$message optional
Returns
voidassertNotContainsOnly() ¶ public static
assertNotContainsOnly(string $type, iterable $haystack, ?bool $isNativeType = null, string $message = ''): void
Asserts that a haystack does not contain only values of a given type.
Parameters
-
string$type -
iterable$haystack -
?bool$isNativeType optional -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertNotCount() ¶ public static
assertNotCount(int $expectedCount, Countable|iterable $haystack, string $message = ''): void
Asserts the number of elements of an array, Countable or Traversable.
Parameters
-
int$expectedCount -
Countable|iterable$haystack -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertNotEmpty() ¶ public static
assertNotEmpty(mixed $actual, string $message = ''): void
Asserts that a variable is not empty.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertNotEquals() ¶ public static
assertNotEquals(mixed $expected, mixed $actual, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void
Asserts that two variables are not equal.
Parameters
-
$expected -
$actual -
string$message optional -
float$delta optional -
int$maxDepth optional -
bool$canonicalize optional -
bool$ignoreCase optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertNotEqualsCanonicalizing() ¶ public static
assertNotEqualsCanonicalizing(mixed $expected, mixed $actual, string $message = ''): void
Asserts that two variables are not equal (canonicalizing).
Parameters
-
$expected -
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertNotEqualsIgnoringCase() ¶ public static
assertNotEqualsIgnoringCase(mixed $expected, mixed $actual, string $message = ''): void
Asserts that two variables are not equal (ignoring case).
Parameters
-
$expected -
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertNotEqualsWithDelta() ¶ public static
assertNotEqualsWithDelta(mixed $expected, mixed $actual, float $delta, string $message = ''): void
Asserts that two variables are not equal (with delta).
Parameters
-
$expected -
$actual -
float$delta -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertNotFalse() ¶ public static
assertNotFalse(mixed $condition, string $message = ''): void
Asserts that a condition is not false.
Parameters
-
$condition -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertNotInstanceOf() ¶ public static
assertNotInstanceOf(string $expected, mixed $actual, string $message = ''): void
Asserts that a variable is not of a given type.
Parameters
-
string$expected -
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertNotInternalType() ¶ public static
assertNotInternalType(string $expected, mixed $actual, string $message = ''): void
Asserts that a variable is not of a given type.
Parameters
-
string$expected -
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertNotIsReadable() ¶ public static
assertNotIsReadable(string $filename, string $message = ''): void
Asserts that a file/dir exists and is not readable.
Parameters
-
string$filename -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertNotIsWritable() ¶ public static
assertNotIsWritable(string $filename, string $message = ''): void
Asserts that a file/dir exists and is not writable.
Parameters
-
string$filename -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertNotNull() ¶ public static
assertNotNull(mixed $actual, string $message = ''): void
Asserts that a variable is not null.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertNotRegExp() ¶ public static
assertNotRegExp(string $pattern, string $string, string $message = ''): void
Asserts that a string does not match a given regular expression.
Parameters
-
string$pattern -
string$string -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertNotSame() ¶ public static
assertNotSame(mixed $expected, mixed $actual, string $message = ''): void
Asserts that two variables do not have the same type and value. Used on objects, it asserts that two variables do not reference the same object.
Parameters
-
$expected -
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertNotSameSize() ¶ public static
assertNotSameSize(Countable|iterable $expected, Countable|iterable $actual, string $message = ''): void
Assert that the size of two arrays (or Countable or Traversable objects)
is not the same.
Parameters
-
Countable|iterable$expected -
Countable|iterable$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertNotTrue() ¶ public static
assertNotTrue(mixed $condition, string $message = ''): void
Asserts that a condition is not true.
Parameters
-
$condition -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertNotWithinRange() ¶ protected static
assertNotWithinRange(float $expected, float $result, float $margin, string $message = ''): void
Compatibility function to test if a value is not between an acceptable range.
Parameters
-
float$expected -
float$result -
float$margin the rage of acceptation
-
string$message optional the text to display if the assertion is not correct
Returns
voidassertNull() ¶ public static
assertNull(mixed $actual, string $message = ''): void
Asserts that a variable is null.
Parameters
-
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertObjectHasAttribute() ¶ public static
assertObjectHasAttribute(string $attributeName, object $object, string $message = ''): void
Asserts that an object has a specified attribute.
Parameters
-
string$attributeName -
object$object -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertObjectNotHasAttribute() ¶ public static
assertObjectNotHasAttribute(string $attributeName, object $object, string $message = ''): void
Asserts that an object does not have a specified attribute.
Parameters
-
string$attributeName -
object$object -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertPathEquals() ¶ protected static
assertPathEquals(string $expected, string $result, string $message = ''): void
Compatibility function to test paths.
Parameters
-
string$expected -
string$result -
string$message optional the text to display if the assertion is not correct
Returns
voidassertPostConditions() ¶ protected
assertPostConditions(): void
Performs assertions shared by all tests of a test case.
This method is called between test and tearDown().
Returns
voidassertPreConditions() ¶ protected
assertPreConditions(): void
Performs assertions shared by all tests of a test case.
This method is called between setUp() and test.
Returns
voidassertRegExp() ¶ public static
assertRegExp(string $pattern, string $string, string $message = ''): void
Asserts that a string matches a given regular expression.
Parameters
-
string$pattern -
string$string -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertSame() ¶ public static
assertSame(mixed $expected, mixed $actual, string $message = ''): void
Asserts that two variables have the same type and value. Used on objects, it asserts that two variables reference the same object.
Parameters
-
$expected -
$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertSameSize() ¶ public static
assertSameSize(Countable|iterable $expected, Countable|iterable $actual, string $message = ''): void
Assert that the size of two arrays (or Countable or Traversable objects)
is the same.
Parameters
-
Countable|iterable$expected -
Countable|iterable$actual -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertStringContainsString() ¶ public static
assertStringContainsString(string $needle, string $haystack, string $message = ''): void
Parameters
-
string$needle -
string$haystack -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertStringContainsStringIgnoringCase() ¶ public static
assertStringContainsStringIgnoringCase(string $needle, string $haystack, string $message = ''): void
Parameters
-
string$needle -
string$haystack -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertStringEndsNotWith() ¶ public static
assertStringEndsNotWith(string $suffix, string $string, string $message = ''): void
Asserts that a string ends not with a given suffix.
Parameters
-
string$suffix -
string$string -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertStringEndsWith() ¶ public static
assertStringEndsWith(string $suffix, string $string, string $message = ''): void
Asserts that a string ends with a given suffix.
Parameters
-
string$suffix -
string$string -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertStringEqualsFile() ¶ public static
assertStringEqualsFile(string $expectedFile, string $actualString, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void
Asserts that the contents of a string is equal to the contents of a file.
Parameters
-
string$expectedFile -
string$actualString -
string$message optional -
bool$canonicalize optional -
bool$ignoreCase optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertStringEqualsFileCanonicalizing() ¶ public static
assertStringEqualsFileCanonicalizing(string $expectedFile, string $actualString, string $message = ''): void
Asserts that the contents of a string is equal to the contents of a file (canonicalizing).
Parameters
-
string$expectedFile -
string$actualString -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertStringEqualsFileIgnoringCase() ¶ public static
assertStringEqualsFileIgnoringCase(string $expectedFile, string $actualString, string $message = ''): void
Asserts that the contents of a string is equal to the contents of a file (ignoring case).
Parameters
-
string$expectedFile -
string$actualString -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertStringMatchesFormat() ¶ public static
assertStringMatchesFormat(string $format, string $string, string $message = ''): void
Asserts that a string matches a given format string.
Parameters
-
string$format -
string$string -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertStringMatchesFormatFile() ¶ public static
assertStringMatchesFormatFile(string $formatFile, string $string, string $message = ''): void
Asserts that a string matches a given format file.
Parameters
-
string$formatFile -
string$string -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertStringNotContainsString() ¶ public static
assertStringNotContainsString(string $needle, string $haystack, string $message = ''): void
Parameters
-
string$needle -
string$haystack -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertStringNotContainsStringIgnoringCase() ¶ public static
assertStringNotContainsStringIgnoringCase(string $needle, string $haystack, string $message = ''): void
Parameters
-
string$needle -
string$haystack -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertStringNotEqualsFile() ¶ public static
assertStringNotEqualsFile(string $expectedFile, string $actualString, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void
Asserts that the contents of a string is not equal to the contents of a file.
Parameters
-
string$expectedFile -
string$actualString -
string$message optional -
bool$canonicalize optional -
bool$ignoreCase optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertStringNotEqualsFileCanonicalizing() ¶ public static
assertStringNotEqualsFileCanonicalizing(string $expectedFile, string $actualString, string $message = ''): void
Asserts that the contents of a string is not equal to the contents of a file (canonicalizing).
Parameters
-
string$expectedFile -
string$actualString -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertStringNotEqualsFileIgnoringCase() ¶ public static
assertStringNotEqualsFileIgnoringCase(string $expectedFile, string $actualString, string $message = ''): void
Asserts that the contents of a string is not equal to the contents of a file (ignoring case).
Parameters
-
string$expectedFile -
string$actualString -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertStringNotMatchesFormat() ¶ public static
assertStringNotMatchesFormat(string $format, string $string, string $message = ''): void
Asserts that a string does not match a given format string.
Parameters
-
string$format -
string$string -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertStringNotMatchesFormatFile() ¶ public static
assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message = ''): void
Asserts that a string does not match a given format string.
Parameters
-
string$formatFile -
string$string -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertStringStartsNotWith() ¶ public static
assertStringStartsNotWith(string $prefix, string $string, string $message = ''): void
Asserts that a string starts not with a given prefix.
Parameters
-
string$prefix -
string$string -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertStringStartsWith() ¶ public static
assertStringStartsWith(string $prefix, string $string, string $message = ''): void
Asserts that a string starts with a given prefix.
Parameters
-
string$prefix -
string$string -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertTextContains() ¶ public
assertTextContains(string $needle, string $haystack, string $message = '', bool $ignoreCase = false): void
Assert that a string contains another string, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
Parameters
-
string$needle The string to search for.
-
string$haystack The string to search through.
-
string$message optional The message to display on failure.
-
bool$ignoreCase optional Whether or not the search should be case-sensitive.
Returns
voidassertTextEndsNotWith() ¶ public
assertTextEndsNotWith(string $suffix, string $string, string $message = ''): void
Asserts that a string ends not with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
Parameters
-
string$suffix The suffix to not find.
-
string$string The string to search.
-
string$message optional The message to use for failure.
Returns
voidassertTextEndsWith() ¶ public
assertTextEndsWith(string $suffix, string $string, string $message = ''): void
Asserts that a string ends with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
Parameters
-
string$suffix The suffix to find.
-
string$string The string to search.
-
string$message optional The message to use for failure.
Returns
voidassertTextEquals() ¶ public
assertTextEquals(string $expected, string $result, string $message = ''): void
Assert text equality, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
Parameters
-
string$expected The expected value.
-
string$result The actual value.
-
string$message optional The message to use for failure.
Returns
voidassertTextNotContains() ¶ public
assertTextNotContains(string $needle, string $haystack, string $message = '', bool $ignoreCase = false): void
Assert that a text doesn't contain another text, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
Parameters
-
string$needle The string to search for.
-
string$haystack The string to search through.
-
string$message optional The message to display on failure.
-
bool$ignoreCase optional Whether or not the search should be case-sensitive.
Returns
voidassertTextNotEquals() ¶ public
assertTextNotEquals(string $expected, string $result, string $message = ''): void
Assert text equality, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
Parameters
-
string$expected The expected value.
-
string$result The actual value.
-
string$message optional The message to use for failure.
Returns
voidassertTextStartsNotWith() ¶ public
assertTextStartsNotWith(string $prefix, string $string, string $message = ''): void
Asserts that a string starts not with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
Parameters
-
string$prefix The prefix to not find.
-
string$string The string to search.
-
string$message optional The message to use for failure.
Returns
voidassertTextStartsWith() ¶ public
assertTextStartsWith(string $prefix, string $string, string $message = ''): void
Asserts that a string starts with a given prefix, ignoring differences in newlines. Helpful for doing cross platform tests of blocks of text.
Parameters
-
string$prefix The prefix to check for.
-
string$string The string to search in.
-
string$message optional The message to use for failure.
Returns
voidassertThat() ¶ public static
assertThat(mixed $value, Constraint $constraint, string $message = ''): void
Evaluates a PHPUnit\Framework\Constraint matcher object.
Parameters
-
$value -
Constraint$constraint -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertTrue() ¶ public static
assertTrue(mixed $condition, string $message = ''): void
Asserts that a condition is true.
Parameters
-
$condition -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExpectationFailedExceptionassertWithinRange() ¶ protected static
assertWithinRange(float $expected, float $result, float $margin, string $message = ''): void
Compatibility function to test if a value is between an acceptable range.
Parameters
-
float$expected -
float$result -
float$margin the rage of acceptation
-
string$message optional the text to display if the assertion is not correct
Returns
voidassertXmlFileEqualsXmlFile() ¶ public static
assertXmlFileEqualsXmlFile(string $expectedFile, string $actualFile, string $message = ''): void
Asserts that two XML files are equal.
Parameters
-
string$expectedFile -
string$actualFile -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertXmlFileNotEqualsXmlFile() ¶ public static
assertXmlFileNotEqualsXmlFile(string $expectedFile, string $actualFile, string $message = ''): void
Asserts that two XML files are not equal.
Parameters
-
string$expectedFile -
string$actualFile -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertXmlStringEqualsXmlFile() ¶ public static
assertXmlStringEqualsXmlFile(string $expectedFile, DOMDocument|string $actualXml, string $message = ''): void
Asserts that two XML documents are equal.
Parameters
-
string$expectedFile -
DOMDocument|string$actualXml -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertXmlStringEqualsXmlString() ¶ public static
assertXmlStringEqualsXmlString(DOMDocument|string $expectedXml, DOMDocument|string $actualXml, string $message = ''): void
Asserts that two XML documents are equal.
Parameters
-
DOMDocument|string$expectedXml -
DOMDocument|string$actualXml -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertXmlStringNotEqualsXmlFile() ¶ public static
assertXmlStringNotEqualsXmlFile(string $expectedFile, DOMDocument|string $actualXml, string $message = ''): void
Asserts that two XML documents are not equal.
Parameters
-
string$expectedFile -
DOMDocument|string$actualXml -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionassertXmlStringNotEqualsXmlString() ¶ public static
assertXmlStringNotEqualsXmlString(DOMDocument|string $expectedXml, DOMDocument|string $actualXml, string $message = ''): void
Asserts that two XML documents are not equal.
Parameters
-
DOMDocument|string$expectedXml -
DOMDocument|string$actualXml -
string$message optional
Returns
voidThrows
SebastianBergmann\RecursionContext\InvalidArgumentExceptionExceptionExpectationFailedExceptionat() ¶ public static
at(int $index): InvokedAtIndexMatcher
Returns a matcher that matches when the method is executed at the given index.
Parameters
-
int$index
Returns
InvokedAtIndexMatcheratLeast() ¶ public static
atLeast(int $requiredInvocations): InvokedAtLeastCountMatcher
Returns a matcher that matches when the method is executed at least N times.
Parameters
-
int$requiredInvocations
Returns
InvokedAtLeastCountMatcheratLeastOnce() ¶ public static
atLeastOnce(): InvokedAtLeastOnceMatcher
Returns a matcher that matches when the method is executed at least once.
Returns
InvokedAtLeastOnceMatcheratMost() ¶ public static
atMost(int $allowedInvocations): InvokedAtMostCountMatcher
Returns a matcher that matches when the method is executed at most N times.
Parameters
-
int$allowedInvocations
Returns
InvokedAtMostCountMatcherattribute() ¶ public static
attribute(Constraint $constraint, string $attributeName): Attribute
Parameters
-
Constraint$constraint -
string$attributeName
Returns
AttributeattributeEqualTo() ¶ public static
attributeEqualTo(string $attributeName, mixed $value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): Attribute
Parameters
-
string$attributeName -
$value -
float$delta optional -
int$maxDepth optional -
bool$canonicalize optional -
bool$ignoreCase optional
Returns
Attributecallback() ¶ public static
callback(callable $callback): Callback
Parameters
-
callable$callback
Returns
CallbackclassHasAttribute() ¶ public static
classHasAttribute(string $attributeName): ClassHasAttribute
Parameters
-
string$attributeName
Returns
ClassHasAttributeclassHasStaticAttribute() ¶ public static
classHasStaticAttribute(string $attributeName): ClassHasStaticAttribute
Parameters
-
string$attributeName
Returns
ClassHasStaticAttributeclearPlugins() ¶ public
clearPlugins(): void
Clear all plugins from the global plugin collection.
Useful in test case teardown methods.
Returns
voidcontains() ¶ public static
contains(mixed $value, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): TraversableContains
Parameters
-
$value -
bool$checkForObjectIdentity optional -
bool$checkForNonObjectIdentity optional
Returns
TraversableContainscontainsEqual() ¶ public static
containsEqual(mixed $value): TraversableContainsEqual
Parameters
-
$value
Returns
TraversableContainsEqualcontainsIdentical() ¶ public static
containsIdentical(mixed $value): TraversableContainsIdentical
Parameters
-
$value
Returns
TraversableContainsIdenticalcontainsOnly() ¶ public static
containsOnly(string $type): TraversableContainsOnly
Parameters
-
string$type
Returns
TraversableContainsOnlycontainsOnlyInstancesOf() ¶ public static
containsOnlyInstancesOf(string $className): TraversableContainsOnly
Parameters
-
string$className
Returns
TraversableContainsOnlycreateConfiguredMock() ¶ protected
createConfiguredMock(string|string[] $originalClassName, array $configuration): MockObject
Returns a configured mock object for the specified class.
Parameters
-
string|string[]$originalClassName -
array$configuration
Returns
MockObjectcreateMock() ¶ protected
createMock(string|string[] $originalClassName): MockObject
Returns a mock object for the specified class.
Parameters
-
string|string[]$originalClassName
Returns
MockObjectcreatePartialMock() ¶ protected
createPartialMock(string|string[] $originalClassName, string[] $methods): MockObject
Returns a partial mock object for the specified class.
Parameters
-
string|string[]$originalClassName -
string[]$methods
Returns
MockObjectcreateResult() ¶ protected
createResult(): TestResult
Creates a default TestResult object.
Returns
TestResultcreateStub() ¶ protected
createStub(string $originalClassName): Stub
Makes configurable stub for the specified class.
Parameters
-
string$originalClassName
Returns
StubcreateTestProxy() ¶ protected
createTestProxy(string $originalClassName, array $constructorArguments = []): MockObject
Returns a test proxy for the specified class.
Parameters
-
string$originalClassName -
array$constructorArguments optional
Returns
MockObjectdeprecated() ¶ public
deprecated(callable $callable): void
Helper method for check deprecation methods
Parameters
-
callable$callable callable function that will receive asserts
Returns
voidequalTo() ¶ public static
equalTo(mixed $value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): IsEqual
Parameters
-
$value -
float$delta optional -
int$maxDepth optional -
bool$canonicalize optional -
bool$ignoreCase optional
Returns
IsEqualexactly() ¶ public static
exactly(int $count): InvokedCountMatcher
Returns a matcher that matches when the method is executed exactly $count times.
Parameters
-
int$count
Returns
InvokedCountMatcherexpectDeprecationMessage() ¶ public
expectDeprecationMessage(string $message): void
Parameters
-
string$message
Returns
voidexpectDeprecationMessageMatches() ¶ public
expectDeprecationMessageMatches(string $regularExpression): void
Parameters
-
string$regularExpression
Returns
voidexpectErrorMessage() ¶ public
expectErrorMessage(string $message): void
Parameters
-
string$message
Returns
voidexpectErrorMessageMatches() ¶ public
expectErrorMessageMatches(string $regularExpression): void
Parameters
-
string$regularExpression
Returns
voidexpectException() ¶ public
expectException(string $exception): void
Parameters
-
string$exception
Returns
voidexpectExceptionCode() ¶ public
expectExceptionCode(int|string $code): void
Parameters
-
int|string$code
Returns
voidexpectExceptionMessage() ¶ public
expectExceptionMessage(string $message): void
Parameters
-
string$message
Returns
voidexpectExceptionMessageMatches() ¶ public
expectExceptionMessageMatches(string $regularExpression): void
Parameters
-
string$regularExpression
Returns
voidexpectExceptionMessageRegExp() ¶ public
expectExceptionMessageRegExp(string $regularExpression): void
Parameters
-
string$regularExpression
Returns
voidexpectExceptionObject() ¶ public
expectExceptionObject(Exception $exception): void
Sets up an expectation for an exception to be raised by the code under test. Information for expected exception class, expected exception message, and expected exception code are retrieved from a given Exception object.
Parameters
-
Exception$exception
Returns
voidexpectNoticeMessage() ¶ public
expectNoticeMessage(string $message): void
Parameters
-
string$message
Returns
voidexpectNoticeMessageMatches() ¶ public
expectNoticeMessageMatches(string $regularExpression): void
Parameters
-
string$regularExpression
Returns
voidexpectOutputRegex() ¶ public
expectOutputRegex(string $expectedRegex): void
Parameters
-
string$expectedRegex
Returns
voidexpectOutputString() ¶ public
expectOutputString(string $expectedString): void
Parameters
-
string$expectedString
Returns
voidexpectWarningMessage() ¶ public
expectWarningMessage(string $message): void
Parameters
-
string$message
Returns
voidexpectWarningMessageMatches() ¶ public
expectWarningMessageMatches(string $regularExpression): void
Parameters
-
string$regularExpression
Returns
voidfail() ¶ public static
fail(string $message = ''): void
Fails a test with the given message.
Parameters
-
string$message optional
Returns
voidThrows
AssertionFailedErrorgetDataSetAsString() ¶ public
getDataSetAsString(bool $includeData = true): string
Parameters
-
bool$includeData optional
Returns
stringgetExpectedExceptionCode() ¶ public
getExpectedExceptionCode(): null|int|string
Returns
null|int|stringgetExpectedExceptionMessageRegExp() ¶ public
getExpectedExceptionMessageRegExp(): ?string
Returns
?stringgetMockBuilder() ¶ public
getMockBuilder(string|string[] $className): MockBuilder
Returns a builder object to create mock objects using a fluent interface.
Parameters
-
string|string[]$className
Returns
MockBuildergetMockClass() ¶ protected
getMockClass(string $originalClassName, array $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = false, bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = false): string
Mocks the specified class and returns the name of the mocked class.
Parameters
-
string$originalClassName -
array$methods optional -
array$arguments optional -
string$mockClassName optional -
bool$callOriginalConstructor optional -
bool$callOriginalClone optional -
bool$callAutoload optional -
bool$cloneArguments optional
Returns
stringgetMockForAbstractClass() ¶ protected
getMockForAbstractClass(string $originalClassName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, array $mockedMethods = [], bool $cloneArguments = false): MockObject
Returns a mock object for the specified abstract class with all abstract methods of the class mocked. Concrete methods are not mocked by default. To mock concrete methods, use the 7th parameter ($mockedMethods).
Parameters
-
string$originalClassName -
array$arguments optional -
string$mockClassName optional -
bool$callOriginalConstructor optional -
bool$callOriginalClone optional -
bool$callAutoload optional -
array$mockedMethods optional -
bool$cloneArguments optional
Returns
MockObjectgetMockForModel() ¶ public
getMockForModel(string $alias, string[] $methods = [], array $options = []): Cake\ORM\Table|PHPUnit\Framework\MockObject\MockObject
Mock a model, maintain fixtures and table association
Parameters
-
string$alias The model to get a mock for.
-
string[]$methods optional The list of methods to mock
-
array$options optional The config data for the mock's constructor.
Returns
Cake\ORM\Table|PHPUnit\Framework\MockObject\MockObjectThrows
Cake\ORM\Exception\MissingTableClassExceptiongetMockForTrait() ¶ protected
getMockForTrait(string $traitName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, array $mockedMethods = [], bool $cloneArguments = false): MockObject
Returns a mock object for the specified trait with all abstract methods
of the trait mocked. Concrete methods to mock can be specified with the
$mockedMethods parameter.
Parameters
-
string$traitName -
array$arguments optional -
string$mockClassName optional -
bool$callOriginalConstructor optional -
bool$callOriginalClone optional -
bool$callAutoload optional -
array$mockedMethods optional -
bool$cloneArguments optional
Returns
MockObjectgetMockFromWsdl() ¶ protected
getMockFromWsdl(string $wsdlFile, string $originalClassName = '', string $mockClassName = '', array $methods = [], bool $callOriginalConstructor = true, array $options = []): MockObject
Returns a mock object based on the given WSDL file.
Parameters
-
string$wsdlFile -
string$originalClassName optional -
string$mockClassName optional -
array$methods optional -
bool$callOriginalConstructor optional -
array$options optional An array of options passed to SOAPClient::_construct
Returns
MockObjectgetName() ¶ public
getName(bool $withDataSet = true): string
Parameters
-
bool$withDataSet optional
Returns
stringThrows
InvalidArgumentExceptiongetNumAssertions() ¶ public
getNumAssertions(): int
Returns the number of assertions performed by this test.
Returns
intgetObjectAttribute() ¶ public static
getObjectAttribute(object $object, string $attributeName)
Returns the value of an object's attribute. This also works for attributes that are declared protected or private.
Parameters
-
object$object -
string$attributeName
Throws
ExceptiongetObjectForTrait() ¶ protected
getObjectForTrait(string $traitName, array $arguments = [], string $traitClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true): object
Returns an object for the specified trait.
Parameters
-
string$traitName -
array$arguments optional -
string$traitClassName optional -
bool$callOriginalConstructor optional -
bool$callOriginalClone optional -
bool$callAutoload optional
Returns
objectgetSize() ¶ public
getSize(): int
Returns the size of the test.
Returns
intThrows
InvalidArgumentExceptiongetStaticAttribute() ¶ public static
getStaticAttribute(string $className, string $attributeName)
Returns the value of a static attribute. This also works for attributes that are declared protected or private.
Parameters
-
string$className -
string$attributeName
Throws
ExceptiongetTableLocator() ¶ public
getTableLocator(): Cake\ORM\Locator\LocatorInterface
Gets the table locator.
Returns
Cake\ORM\Locator\LocatorInterfacegreaterThan() ¶ public static
greaterThan(mixed $value): GreaterThan
Parameters
-
$value
Returns
GreaterThangreaterThanOrEqual() ¶ public static
greaterThanOrEqual(mixed $value): LogicalOr
Parameters
-
$value
Returns
LogicalOridenticalTo() ¶ public static
identicalTo(mixed $value): IsIdentical
Parameters
-
$value
Returns
IsIdenticaliniSet() ¶ protected
iniSet(string $varName, string $newValue): void
This method is a wrapper for the ini_set() function that automatically resets the modified php.ini setting to its original value after the test is run.
Parameters
-
string$varName -
string$newValue
Returns
voidThrows
ExceptionisInstanceOf() ¶ public static
isInstanceOf(string $className): IsInstanceOf
Parameters
-
string$className
Returns
IsInstanceOflessThanOrEqual() ¶ public static
lessThanOrEqual(mixed $value): LogicalOr
Parameters
-
$value
Returns
LogicalOrloadFixtures() ¶ public
loadFixtures(): void
Chooses which fixtures to load for a given test
Each parameter is a model name that corresponds to a fixture, i.e. 'Posts', 'Authors', etc. Passing no parameters will cause all fixtures on the test case to load.
Returns
voidThrows
RuntimeExceptionwhen no fixture manager is available.
See Also
loadPlugins() ¶ public
loadPlugins(array $plugins = []): Cake\Http\BaseApplication
Load plugins into a simulated application.
Useful to test how plugins being loaded/not loaded interact with other elements in CakePHP or applications.
Parameters
-
array$plugins optional List of Plugins to load.
Returns
Cake\Http\BaseApplicationloadRoutes() ¶ public
loadRoutes(array|null $appArgs = null): void
Load routes for the application.
If no application class can be found an exception will be raised.
Routes for plugins will not be loaded. Use loadPlugins() or use
Cake\TestSuite\IntegrationTestCaseTrait to better simulate all routes
and plugins being loaded.
Parameters
-
array|null$appArgs optional Constuctor parameters for the application class.
Returns
voidlogicalNot() ¶ public static
logicalNot(Constraint $constraint): LogicalNot
Parameters
-
Constraint$constraint
Returns
LogicalNotmarkTestIncomplete() ¶ public static
markTestIncomplete(string $message = ''): void
Mark the test as incomplete.
Parameters
-
string$message optional
Returns
voidThrows
IncompleteTestErrormarkTestSkipped() ¶ public static
markTestSkipped(string $message = ''): void
Mark the test as skipped.
Parameters
-
string$message optional
Returns
voidThrows
SkippedTestErrorSyntheticSkippedErrormatches() ¶ public static
matches(string $string): StringMatchesFormatDescription
Parameters
-
string$string
Returns
StringMatchesFormatDescriptionmatchesRegularExpression() ¶ public static
matchesRegularExpression(string $pattern): RegularExpression
Parameters
-
string$pattern
Returns
RegularExpressionnever() ¶ public static
never(): InvokedCountMatcher
Returns a matcher that matches when the method is never executed.
Returns
InvokedCountMatcherobjectHasAttribute() ¶ public static
objectHasAttribute(mixed $attributeName): ObjectHasAttribute
Parameters
-
$attributeName
Returns
ObjectHasAttributeonConsecutiveCalls() ¶ public static
onConsecutiveCalls(mixed ...$args): ConsecutiveCallsStub
Parameters
-
...$args
Returns
ConsecutiveCallsStubonNotSuccessfulTest() ¶ protected
onNotSuccessfulTest(Throwable $t): void
This method is called when a test method did not execute successfully.
Parameters
-
Throwable$t
Returns
voidThrows
Throwableonce() ¶ public static
once(): InvokedCountMatcher
Returns a matcher that matches when the method is executed exactly once.
Returns
InvokedCountMatcherprophesize() ¶ protected
prophesize(?string $classOrInterface = null): ObjectProphecy
Parameters
-
?string$classOrInterface optional
Returns
ObjectProphecyThrows
ClassNotFoundExceptionDoubleExceptionInterfaceNotFoundExceptionreadAttribute() ¶ public static
readAttribute(object|string $classOrObject, string $attributeName)
Returns the value of an attribute of a class or an object. This also works for attributes that are declared protected or private.
Parameters
-
object|string$classOrObject -
string$attributeName
Throws
ExceptionregisterComparator() ¶ public
registerComparator(Comparator $comparator): void
Parameters
-
Comparator$comparator
Returns
voidregisterMockObject() ¶ public
registerMockObject(MockObject $mockObject): void
Parameters
-
MockObject$mockObject
Returns
voidremovePlugins() ¶ public
removePlugins(string[] $names = []): void
Remove plugins from the global plugin collection.
Useful in test case teardown methods.
Parameters
-
string[]$names optional A list of plugins you want to remove.
Returns
voidreturnArgument() ¶ public static
returnArgument(int $argumentIndex): ReturnArgumentStub
Parameters
-
int$argumentIndex
Returns
ReturnArgumentStubreturnCallback() ¶ public static
returnCallback(mixed $callback): ReturnCallbackStub
Parameters
-
$callback
Returns
ReturnCallbackStubreturnSelf() ¶ public static
returnSelf(): ReturnSelfStub
Returns the current object.
This method is useful when mocking a fluent interface.
Returns
ReturnSelfStubreturnValue() ¶ public static
returnValue(mixed $value): ReturnStub
Parameters
-
$value
Returns
ReturnStubreturnValueMap() ¶ public static
returnValueMap(array $valueMap): ReturnValueMapStub
Parameters
-
array$valueMap
Returns
ReturnValueMapStubrun() ¶ public
run(?TestResult $result = null): TestResult
Runs the test case and collects the results in a TestResult object. If no TestResult object is passed a new one will be created.
Parameters
-
?TestResult$result optional
Returns
TestResultThrows
SebastianBergmann\CodeCoverage\InvalidArgumentExceptionCodeCoverageExceptionCoveredCodeNotExecutedExceptionInvalidArgumentExceptionMissingCoversAnnotationExceptionRuntimeExceptionUnintentionallyCoveredCodeExceptionUtilExceptionrunTest() ¶ protected
runTest()
Override to run the test and assert its state.
Throws
SebastianBergmann\ObjectEnumerator\InvalidArgumentExceptionAssertionFailedErrorExceptionExpectationFailedExceptionThrowablesetAppNamespace() ¶ public static
setAppNamespace(string $appNamespace = 'TestApp'): void
Set the app namespace
Parameters
-
string$appNamespace optional The app namespace, defaults to "TestApp".
Returns
voidsetBackupGlobals() ¶ public
setBackupGlobals(?bool $backupGlobals): void
Parameters
-
?bool$backupGlobals
Returns
voidsetBackupStaticAttributes() ¶ public
setBackupStaticAttributes(?bool $backupStaticAttributes): void
Parameters
-
?bool$backupStaticAttributes
Returns
voidsetBeStrictAboutChangesToGlobalState() ¶ public
setBeStrictAboutChangesToGlobalState(?bool $beStrictAboutChangesToGlobalState): void
Parameters
-
?bool$beStrictAboutChangesToGlobalState
Returns
voidsetDependencies() ¶ public
setDependencies(string[] $dependencies): void
Parameters
-
string[]$dependencies
Returns
voidsetDependencyInput() ¶ public
setDependencyInput(array $dependencyInput): void
Parameters
-
array$dependencyInput
Returns
voidsetInIsolation() ¶ public
setInIsolation(bool $inIsolation): void
Parameters
-
bool$inIsolation
Returns
voidsetLocale() ¶ protected
setLocale(mixed ...$args): void
This method is a wrapper for the setlocale() function that automatically resets the locale to its original value after the test is run.
Parameters
-
...$args
Returns
voidThrows
ExceptionsetOutputCallback() ¶ public
setOutputCallback(callable $callback): void
Parameters
-
callable$callback
Returns
voidsetPreserveGlobalState() ¶ public
setPreserveGlobalState(bool $preserveGlobalState): void
Parameters
-
bool$preserveGlobalState
Returns
voidsetRegisterMockObjectsFromTestArgumentsRecursively() ¶ public
setRegisterMockObjectsFromTestArgumentsRecursively(bool $flag): void
Parameters
-
bool$flag
Returns
voidsetRunClassInSeparateProcess() ¶ public
setRunClassInSeparateProcess(bool $runClassInSeparateProcess): void
Parameters
-
bool$runClassInSeparateProcess
Returns
voidsetRunTestInSeparateProcess() ¶ public
setRunTestInSeparateProcess(bool $runTestInSeparateProcess): void
Parameters
-
bool$runTestInSeparateProcess
Returns
voidsetTableLocator() ¶ public
setTableLocator(Cake\ORM\Locator\LocatorInterface $tableLocator): $this
Sets the table locator.
Parameters
-
Cake\ORM\Locator\LocatorInterface$tableLocator LocatorInterface instance.
Returns
$thissetTestResultObject() ¶ public
setTestResultObject(TestResult $result): void
Parameters
-
TestResult$result
Returns
voidsetUp() ¶ public
setUp(): void
Setup the test case, backup the static object values so they can be restored. Specifically backs up the contents of Configure and paths in App if they have not already been backed up.
Returns
voidsetUpBeforeClass() ¶ public static
setUpBeforeClass(): void
This method is called before the first test of this test class is run.
Returns
voidsetUseErrorHandler() ¶ public
setUseErrorHandler(bool $useErrorHandler): void
Parameters
-
bool$useErrorHandler
Returns
voidskipIf() ¶ public
skipIf(bool $shouldSkip, string $message = ''): bool
Overrides SimpleTestCase::skipIf to provide a boolean return value
Parameters
-
bool$shouldSkip Whether or not the test should be skipped.
-
string$message optional The message to display.
Returns
boolskipUnless() ¶ protected
skipUnless(bool $condition, string $message = ''): bool
Compatibility function for skipping.
Parameters
-
bool$condition Condition to trigger skipping
-
string$message optional Message for skip
Returns
boolstringContains() ¶ public static
stringContains(string $string, bool $case = true): StringContains
Parameters
-
string$string -
bool$case optional
Returns
StringContainsstringEndsWith() ¶ public static
stringEndsWith(string $suffix): StringEndsWith
Parameters
-
string$suffix
Returns
StringEndsWithstringStartsWith() ¶ public static
stringStartsWith(mixed $prefix): StringStartsWith
Parameters
-
$prefix
Returns
StringStartsWithtearDown() ¶ public
tearDown(): void
teardown any static object changes and restore them.
Returns
voidtearDownAfterClass() ¶ public static
tearDownAfterClass(): void
This method is called after the last test of this test class is run.
Returns
voidthrowException() ¶ public static
throwException(Throwable $exception): ExceptionStub
Parameters
-
Throwable$exception
Returns
ExceptionStubtoString() ¶ public
toString(): string
Returns a string representation of the test case.
Returns
stringThrows
ExceptionInvalidArgumentExceptionwithErrorReporting() ¶ public
withErrorReporting(int $errorLevel, callable $callable): void
Helper method for tests that needs to use error_reporting()
Parameters
-
int$errorLevel value of error_reporting() that needs to use
-
callable$callable callable function that will receive asserts
Returns
voidProperty Detail
$autoFixtures ¶ public
By default, all fixtures attached to this class will be truncated and reloaded after each test. Set this to false to handle manually
Type
bool$dropTables ¶ public
Control table create/drops on each test method.
If true, tables will still be dropped at the end of each test runner execution.
Type
bool$fixtureManager ¶ public
The class responsible for managing the creation, loading and removing of fixtures
Type
Cake\TestSuite\Fixture\FixtureManager|null