A test case class intended to make integration tests of cake console commands easier.
array|null
The customized application constructor arguments.
string|null
The customized application class name.
array
Configure values to restore at end of test.
\Cake\TestSuite\Stub\ConsoleOutput
Console error output stub
int|null
Last exit code
\Cake\Console\ConsoleInput
Console input mock
\Cake\TestSuite\Stub\ConsoleOutput
Console output stub
\Cake\ORM\Locator\LocatorInterface|null
Table locator instance
bool
Whether or not to use the CommandRunner
bool
By default, all fixtures attached to this class will be truncated and reloaded after each test.
?bool
string[]
bool
array<string,array<int,string>>
bool
Control table create/drops on each test method.
\Cake\TestSuite\Fixture\FixtureManager|null
The class responsible for managing the creation, loading and removing of fixtures
string[]
Fixtures used by this test case.
bool
bool
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains a needle.
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.
Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.
Asserts that a static attribute of a class or an attribute of an object is empty.
Asserts that a variable is equal to an attribute of an object.
Asserts that an attribute is greater than or equal to another value.
Asserts that an attribute is smaller than or equal to another value.
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.
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.
Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.
Asserts that a static attribute of a class or an attribute of an object is not empty.
Asserts that a variable is not equal to an attribute of an object.
Asserts that a variable and an attribute of an object do not have the same type and value.
Asserts that a variable and an attribute of an object have the same type and value.
Asserts that a class has a specified static attribute.
Asserts that a class does not have a specified attribute.
Asserts that a class does not have a specified static attribute.
Asserts that a haystack contains only instances of a given class name.
Assert that a string matches SQL with db-specific characters like quotes removed.
Asserts that a global event was fired. You must track events in your event manager for this assertion to work
Asserts that the contents of one file is equal to the contents of another file.
Asserts that the contents of one file is equal to the contents of another file (canonicalizing).
Asserts that the contents of one file is equal to the contents of another file (ignoring case).
Asserts that the contents of one file is not equal to the contents of another file.
Asserts that the contents of one file is not equal to the contents of another file (canonicalizing).
Asserts that the contents of one file is not equal to the contents of another file (ignoring case).
Asserts that a value is greater than or equal to another value.
Asserts that the generated JSON encoded object and the content of the given file are equal.
Asserts that two given JSON encoded objects or arrays are equal.
Asserts that the generated JSON encoded object and the content of the given file are not equal.
Asserts that two given JSON encoded objects or arrays are not equal.
Asserts that a value is smaller than or equal to another value.
Asserts that a haystack does not contain only values of a given type.
Asserts the number of elements of an array, Countable or Traversable.
Asserts that two variables are not equal (canonicalizing).
Asserts that two variables are not equal (ignoring case).
Assert that the size of two arrays (or Countable
or Traversable
objects) is not the same.
Compatibility function to test if a value is not between an acceptable range.
Asserts that an object does not have a specified attribute.
Assertion for comparing a regex pattern against a query having its identifiers quoted. It accepts queries quoted with the characters <
and >
. If the third parameter is set to true, it will alter the pattern to both accept quoted and unquoted queries
Assert that the size of two arrays (or Countable
or Traversable
objects) is the same.
Asserts that the contents of a string is equal to the contents of a file.
Asserts that the contents of a string is equal to the contents of a file (canonicalizing).
Asserts that the contents of a string is equal to the contents of a file (ignoring case).
Asserts that the contents of a string is not equal to the contents of a file.
Asserts that the contents of a string is not equal to the contents of a file (canonicalizing).
Asserts that the contents of a string is not equal to the contents of a file (ignoring case).
Asserts that a string does not match a given format string.
Asserts that a string does not match a given format string.
Assert that a string contains another string, ignoring differences in newlines.
Asserts that a string ends not with a given prefix, ignoring differences in newlines.
Asserts that a string ends with a given prefix, ignoring differences in newlines.
Assert that a text doesn't contain another text, ignoring differences in newlines.
Asserts that a string starts not with a given prefix, ignoring differences in newlines.
Asserts that a string starts with a given prefix, ignoring differences in newlines.
Compatibility function to test if a value is between an acceptable range.
Returns a matcher that matches when the method is executed at least N times.
Returns a matcher that matches when the method is executed at least once.
Returns a matcher that matches when the method is executed exactly $count times.
Sets up an expectation for an exception to be raised by the code under test.
Returns a mock object for the specified abstract class with all abstract methods of the class mocked. Concrete methods are not mocked by default.
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.
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.
This method is called when a test method did not execute successfully.
This method is a wrapper for the setlocale() function that automatically resets the locale to its original value after the test is run.
This method is called before the first test of this test class is run.
This method is called after the last test of this test class is run.
Set this test case to use the CommandRunner rather than the legacy ShellDispatcher
__construct(mixed $name, array $data, mixed $dataName)
string
$name optional array
$data optional string
$dataName optional _assertAttributes(array $assertions, string $string, bool $fullDebug, mixed $regex)
Check the attributes as part of an assertTags() check.
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
string|false
_getTableClassName(string $alias, array $options)
Gets the class name for the table.
string
$alias The model to get a mock for.
array
$options The config data for the mock's constructor.
string
Cake\ORM\Exception\MissingTableClassException
_normalizePath(string $path)
Normalize a path for comparison.
string
$path Path separated by "/" slash.
string
Normalized path separated by DIRECTORY_SEPARATOR.
addFixture(string $fixture)
Adds a fixture to this test case.
Examples:
Use this method inside your test cases' {@link getFixtures()} method to build up the fixture list.
string
$fixture Fixture
$this
addToAssertionCount(int $count)
int
$count addWarning(string $warning)
string
$warning any()
Returns a matcher that matches when the method is executed zero or more times.
anything()
arrayHasKey(mixed $key)
int|string
$key assertArrayHasKey(mixed $key, mixed $array, string $message)
Asserts that an array has a specified key.
int|string
$key array|\ArrayAccess
$array string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertArrayNotHasKey(mixed $key, mixed $array, string $message)
Asserts that an array does not have a specified key.
int|string
$key array|\ArrayAccess
$array string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertArraySubset(mixed $subset, mixed $array, bool $checkForObjectIdentity, string $message)
Asserts that an array has a specified subset.
array|\ArrayAccess
$subset array|\ArrayAccess
$array bool
$checkForObjectIdentity optional string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeContains(mixed $needle, string $haystackAttributeName, mixed $haystackClassOrObject, string $message, bool $ignoreCase, bool $checkForObjectIdentity, bool $checkForNonObjectIdentity)
Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains a needle.
mixed
$needle string
$haystackAttributeName object|string
$haystackClassOrObject string
$message optional bool
$ignoreCase optional bool
$checkForObjectIdentity optional bool
$checkForNonObjectIdentity optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeContainsOnly(string $type, string $haystackAttributeName, mixed $haystackClassOrObject, ?bool $isNativeType, string $message)
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.
string
$type string
$haystackAttributeName object|string
$haystackClassOrObject bool
$isNativeType optional string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeCount(int $expectedCount, string $haystackAttributeName, mixed $haystackClassOrObject, string $message)
Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.
int
$expectedCount string
$haystackAttributeName object|string
$haystackClassOrObject string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeEmpty(string $haystackAttributeName, mixed $haystackClassOrObject, string $message)
Asserts that a static attribute of a class or an attribute of an object is empty.
string
$haystackAttributeName object|string
$haystackClassOrObject string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeEquals(mixed $expected, string $actualAttributeName, mixed $actualClassOrObject, string $message, float $delta, int $maxDepth, bool $canonicalize, bool $ignoreCase)
Asserts that a variable is equal to an attribute of an object.
mixed
$expected string
$actualAttributeName object|string
$actualClassOrObject string
$message optional float
$delta optional int
$maxDepth optional bool
$canonicalize optional bool
$ignoreCase optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeGreaterThan(mixed $expected, string $actualAttributeName, mixed $actualClassOrObject, string $message)
Asserts that an attribute is greater than another value.
mixed
$expected string
$actualAttributeName object|string
$actualClassOrObject string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeGreaterThanOrEqual(mixed $expected, string $actualAttributeName, mixed $actualClassOrObject, string $message)
Asserts that an attribute is greater than or equal to another value.
mixed
$expected string
$actualAttributeName object|string
$actualClassOrObject string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeInstanceOf(string $expected, string $attributeName, mixed $classOrObject, string $message)
Asserts that an attribute is of a given type.
string
$expected string
$attributeName object|string
$classOrObject string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeInternalType(string $expected, string $attributeName, mixed $classOrObject, string $message)
Asserts that an attribute is of a given type.
string
$expected string
$attributeName object|string
$classOrObject string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeLessThan(mixed $expected, string $actualAttributeName, mixed $actualClassOrObject, string $message)
Asserts that an attribute is smaller than another value.
mixed
$expected string
$actualAttributeName object|string
$actualClassOrObject string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeLessThanOrEqual(mixed $expected, string $actualAttributeName, mixed $actualClassOrObject, string $message)
Asserts that an attribute is smaller than or equal to another value.
mixed
$expected string
$actualAttributeName object|string
$actualClassOrObject string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeNotContains(mixed $needle, string $haystackAttributeName, mixed $haystackClassOrObject, string $message, bool $ignoreCase, bool $checkForObjectIdentity, bool $checkForNonObjectIdentity)
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.
mixed
$needle string
$haystackAttributeName object|string
$haystackClassOrObject string
$message optional bool
$ignoreCase optional bool
$checkForObjectIdentity optional bool
$checkForNonObjectIdentity optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeNotContainsOnly(string $type, string $haystackAttributeName, mixed $haystackClassOrObject, ?bool $isNativeType, string $message)
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.
string
$type string
$haystackAttributeName object|string
$haystackClassOrObject bool
$isNativeType optional string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeNotCount(int $expectedCount, string $haystackAttributeName, mixed $haystackClassOrObject, string $message)
Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.
int
$expectedCount string
$haystackAttributeName object|string
$haystackClassOrObject string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeNotEmpty(string $haystackAttributeName, mixed $haystackClassOrObject, string $message)
Asserts that a static attribute of a class or an attribute of an object is not empty.
string
$haystackAttributeName object|string
$haystackClassOrObject string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeNotEquals(mixed $expected, string $actualAttributeName, mixed $actualClassOrObject, string $message, float $delta, int $maxDepth, bool $canonicalize, bool $ignoreCase)
Asserts that a variable is not equal to an attribute of an object.
mixed
$expected string
$actualAttributeName object|string
$actualClassOrObject string
$message optional float
$delta optional int
$maxDepth optional bool
$canonicalize optional bool
$ignoreCase optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeNotInstanceOf(string $expected, string $attributeName, mixed $classOrObject, string $message)
Asserts that an attribute is of a given type.
string
$expected string
$attributeName object|string
$classOrObject string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeNotInternalType(string $expected, string $attributeName, mixed $classOrObject, string $message)
Asserts that an attribute is of a given type.
string
$expected string
$attributeName object|string
$classOrObject string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeNotSame(mixed $expected, string $actualAttributeName, mixed $actualClassOrObject, string $message)
Asserts that a variable and an attribute of an object do not have the same type and value.
mixed
$expected string
$actualAttributeName object|string
$actualClassOrObject string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertAttributeSame(mixed $expected, string $actualAttributeName, mixed $actualClassOrObject, string $message)
Asserts that a variable and an attribute of an object have the same type and value.
mixed
$expected string
$actualAttributeName object|string
$actualClassOrObject string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertClassHasAttribute(string $attributeName, string $className, string $message)
Asserts that a class has a specified attribute.
string
$attributeName string
$className string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertClassHasStaticAttribute(string $attributeName, string $className, string $message)
Asserts that a class has a specified static attribute.
string
$attributeName string
$className string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertClassNotHasAttribute(string $attributeName, string $className, string $message)
Asserts that a class does not have a specified attribute.
string
$attributeName string
$className string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message)
Asserts that a class does not have a specified static attribute.
string
$attributeName string
$className string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertContains(mixed $needle, mixed $haystack, string $message, bool $ignoreCase, bool $checkForObjectIdentity, bool $checkForNonObjectIdentity)
Asserts that a haystack contains a needle.
mixed
$needle mixed
$haystack string
$message optional bool
$ignoreCase optional bool
$checkForObjectIdentity optional bool
$checkForNonObjectIdentity optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertContainsEquals(mixed $needle, iterable $haystack, string $message)
mixed
$needle iterable
$haystack string
$message optional assertContainsOnly(string $type, iterable $haystack, ?bool $isNativeType, string $message)
Asserts that a haystack contains only values of a given type.
string
$type iterable
$haystack ?bool
$isNativeType optional string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertContainsOnlyInstancesOf(string $className, iterable $haystack, string $message)
Asserts that a haystack contains only instances of a given class name.
string
$className iterable
$haystack string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertCount(int $expectedCount, mixed $haystack, string $message)
Asserts the number of elements of an array, Countable or Traversable.
int
$expectedCount \Countable|iterable
$haystack string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertDirectoryExists(string $directory, string $message)
Asserts that a directory exists.
string
$directory string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertDirectoryIsReadable(string $directory, string $message)
Asserts that a directory exists and is readable.
string
$directory string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertDirectoryIsWritable(string $directory, string $message)
Asserts that a directory exists and is writable.
string
$directory string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertDirectoryNotExists(string $directory, string $message)
Asserts that a directory does not exist.
string
$directory string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertDirectoryNotIsReadable(string $directory, string $message)
Asserts that a directory exists and is not readable.
string
$directory string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertDirectoryNotIsWritable(string $directory, string $message)
Asserts that a directory exists and is not writable.
string
$directory string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertEmpty(mixed $actual, string $message)
Asserts that a variable is empty.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertEqualXMLStructure(\DOMElement $expectedElement, \DOMElement $actualElement, bool $checkAttributes, string $message)
Asserts that a hierarchy of DOMElements matches.
\DOMElement
$expectedElement \DOMElement
$actualElement bool
$checkAttributes optional string
$message optional PHPUnit\Framework\AssertionFailedError
PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertEquals(mixed $expected, mixed $actual, string $message, float $delta, int $maxDepth, bool $canonicalize, bool $ignoreCase)
Asserts that two variables are equal.
mixed
$expected mixed
$actual string
$message optional float
$delta optional int
$maxDepth optional bool
$canonicalize optional bool
$ignoreCase optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertEqualsCanonicalizing(mixed $expected, mixed $actual, string $message)
Asserts that two variables are equal (canonicalizing).
mixed
$expected mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertEqualsIgnoringCase(mixed $expected, mixed $actual, string $message)
Asserts that two variables are equal (ignoring case).
mixed
$expected mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertEqualsSql(string $expected, string $actual, string $message)
Assert that a string matches SQL with db-specific characters like quotes removed.
string
$expected The expected sql
string
$actual The sql to compare
string
$message optional The message to display on failure
assertEqualsWithDelta(mixed $expected, mixed $actual, float $delta, string $message)
Asserts that two variables are equal (with delta).
mixed
$expected mixed
$actual float
$delta string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertErrorContains(string $expected, string $message)
Asserts stderr
contains expected output
string
$expected Expected output
string
$message optional Failure message
assertErrorEmpty(string $message)
Asserts that stderr
is empty
string
$message optional The message to output when the assertion fails.
assertErrorRegExp(string $pattern, string $message)
Asserts stderr
contains expected regexp
string
$pattern Expected pattern
string
$message optional Failure message
assertEventFired(string $name, ?\Cake\Event\EventManager $eventManager, string $message)
Asserts that a global event was fired. You must track events in your event manager for this assertion to work
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
assertEventFiredWith(string $name, string $dataKey, mixed $dataValue, ?\Cake\Event\EventManager $eventManager, string $message)
Asserts an event was fired with data
If a third argument is passed, that value is used to compare with the value in $dataKey
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
assertExitCode(int $expected, string $message)
Asserts shell exited with the expected code
int
$expected Expected exit code
string
$message optional Failure message
assertExitError(mixed $message)
Asserts shell exited with Command::CODE_ERROR
string
$message optional Failure message
assertExitSuccess(mixed $message)
Asserts shell exited with the Command::CODE_SUCCESS
string
$message optional Failure message
assertFalse(mixed $condition, string $message)
Asserts that a condition is false.
mixed
$condition string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertFileEquals(string $expected, string $actual, string $message, bool $canonicalize, bool $ignoreCase)
Asserts that the contents of one file is equal to the contents of another file.
string
$expected string
$actual string
$message optional bool
$canonicalize optional bool
$ignoreCase optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertFileEqualsCanonicalizing(string $expected, string $actual, string $message)
Asserts that the contents of one file is equal to the contents of another file (canonicalizing).
string
$expected string
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertFileEqualsIgnoringCase(string $expected, string $actual, string $message)
Asserts that the contents of one file is equal to the contents of another file (ignoring case).
string
$expected string
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertFileExists(string $filename, string $message)
Asserts that a file exists.
string
$filename string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertFileIsReadable(string $file, string $message)
Asserts that a file exists and is readable.
string
$file string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertFileIsWritable(string $file, string $message)
Asserts that a file exists and is writable.
string
$file string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertFileNotEquals(string $expected, string $actual, string $message, bool $canonicalize, bool $ignoreCase)
Asserts that the contents of one file is not equal to the contents of another file.
string
$expected string
$actual string
$message optional bool
$canonicalize optional bool
$ignoreCase optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertFileNotEqualsCanonicalizing(string $expected, string $actual, string $message)
Asserts that the contents of one file is not equal to the contents of another file (canonicalizing).
string
$expected string
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertFileNotEqualsIgnoringCase(string $expected, string $actual, string $message)
Asserts that the contents of one file is not equal to the contents of another file (ignoring case).
string
$expected string
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertFileNotExists(string $filename, string $message)
Asserts that a file does not exist.
string
$filename string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertFileNotIsReadable(string $file, string $message)
Asserts that a file exists and is not readable.
string
$file string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertFileNotIsWritable(string $file, string $message)
Asserts that a file exists and is not writable.
string
$file string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertFinite(mixed $actual, string $message)
Asserts that a variable is finite.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertGreaterThan(mixed $expected, mixed $actual, string $message)
Asserts that a value is greater than another value.
mixed
$expected mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertGreaterThanOrEqual(mixed $expected, mixed $actual, string $message)
Asserts that a value is greater than or equal to another value.
mixed
$expected mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertHtml(array $expected, string $string, bool $fullDebug)
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.
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.
bool
assertInfinite(mixed $actual, string $message)
Asserts that a variable is infinite.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertInstanceOf(string $expected, mixed $actual, string $message)
Asserts that a variable is of a given type.
string
$expected mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertInternalType(string $expected, mixed $actual, string $message)
Asserts that a variable is of a given type.
string
$expected mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsArray(mixed $actual, string $message)
Asserts that a variable is of type array.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsBool(mixed $actual, string $message)
Asserts that a variable is of type bool.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsCallable(mixed $actual, string $message)
Asserts that a variable is of type callable.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsFloat(mixed $actual, string $message)
Asserts that a variable is of type float.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsInt(mixed $actual, string $message)
Asserts that a variable is of type int.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsIterable(mixed $actual, string $message)
Asserts that a variable is of type iterable.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsNotArray(mixed $actual, string $message)
Asserts that a variable is not of type array.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsNotBool(mixed $actual, string $message)
Asserts that a variable is not of type bool.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsNotCallable(mixed $actual, string $message)
Asserts that a variable is not of type callable.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsNotFloat(mixed $actual, string $message)
Asserts that a variable is not of type float.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsNotInt(mixed $actual, string $message)
Asserts that a variable is not of type int.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsNotIterable(mixed $actual, string $message)
Asserts that a variable is not of type iterable.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsNotNumeric(mixed $actual, string $message)
Asserts that a variable is not of type numeric.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsNotObject(mixed $actual, string $message)
Asserts that a variable is not of type object.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsNotResource(mixed $actual, string $message)
Asserts that a variable is not of type resource.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsNotScalar(mixed $actual, string $message)
Asserts that a variable is not of type scalar.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsNotString(mixed $actual, string $message)
Asserts that a variable is not of type string.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsNumeric(mixed $actual, string $message)
Asserts that a variable is of type numeric.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsObject(mixed $actual, string $message)
Asserts that a variable is of type object.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsReadable(string $filename, string $message)
Asserts that a file/dir is readable.
string
$filename string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsResource(mixed $actual, string $message)
Asserts that a variable is of type resource.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsScalar(mixed $actual, string $message)
Asserts that a variable is of type scalar.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsString(mixed $actual, string $message)
Asserts that a variable is of type string.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertIsWritable(string $filename, string $message)
Asserts that a file/dir exists and is writable.
string
$filename string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertJson(string $actualJson, string $message)
Asserts that a string is a valid JSON string.
string
$actualJson string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertJsonFileEqualsJsonFile(string $expectedFile, string $actualFile, string $message)
Asserts that two JSON files are equal.
string
$expectedFile string
$actualFile string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertJsonFileNotEqualsJsonFile(string $expectedFile, string $actualFile, string $message)
Asserts that two JSON files are not equal.
string
$expectedFile string
$actualFile string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertJsonStringEqualsJsonFile(string $expectedFile, string $actualJson, string $message)
Asserts that the generated JSON encoded object and the content of the given file are equal.
string
$expectedFile string
$actualJson string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertJsonStringEqualsJsonString(string $expectedJson, string $actualJson, string $message)
Asserts that two given JSON encoded objects or arrays are equal.
string
$expectedJson string
$actualJson string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertJsonStringNotEqualsJsonFile(string $expectedFile, string $actualJson, string $message)
Asserts that the generated JSON encoded object and the content of the given file are not equal.
string
$expectedFile string
$actualJson string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertJsonStringNotEqualsJsonString(mixed $expectedJson, mixed $actualJson, string $message)
Asserts that two given JSON encoded objects or arrays are not equal.
string
$expectedJson string
$actualJson string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertLessThan(mixed $expected, mixed $actual, string $message)
Asserts that a value is smaller than another value.
mixed
$expected mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertLessThanOrEqual(mixed $expected, mixed $actual, string $message)
Asserts that a value is smaller than or equal to another value.
mixed
$expected mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertNan(mixed $actual, string $message)
Asserts that a variable is nan.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertNotContains(mixed $needle, mixed $haystack, string $message, bool $ignoreCase, bool $checkForObjectIdentity, bool $checkForNonObjectIdentity)
Asserts that a haystack does not contain a needle.
mixed
$needle mixed
$haystack string
$message optional bool
$ignoreCase optional bool
$checkForObjectIdentity optional bool
$checkForNonObjectIdentity optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertNotContainsEquals(mixed $needle, iterable $haystack, string $message)
mixed
$needle iterable
$haystack string
$message optional assertNotContainsOnly(string $type, iterable $haystack, ?bool $isNativeType, string $message)
Asserts that a haystack does not contain only values of a given type.
string
$type iterable
$haystack ?bool
$isNativeType optional string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertNotCount(int $expectedCount, mixed $haystack, string $message)
Asserts the number of elements of an array, Countable or Traversable.
int
$expectedCount \Countable|iterable
$haystack string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertNotEmpty(mixed $actual, string $message)
Asserts that a variable is not empty.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertNotEquals(mixed $expected, mixed $actual, string $message, mixed $delta, mixed $maxDepth, mixed $canonicalize, mixed $ignoreCase)
Asserts that two variables are not equal.
mixed
$expected mixed
$actual string
$message optional float
$delta optional int
$maxDepth optional bool
$canonicalize optional bool
$ignoreCase optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertNotEqualsCanonicalizing(mixed $expected, mixed $actual, string $message)
Asserts that two variables are not equal (canonicalizing).
mixed
$expected mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertNotEqualsIgnoringCase(mixed $expected, mixed $actual, string $message)
Asserts that two variables are not equal (ignoring case).
mixed
$expected mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertNotEqualsWithDelta(mixed $expected, mixed $actual, float $delta, string $message)
Asserts that two variables are not equal (with delta).
mixed
$expected mixed
$actual float
$delta string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertNotFalse(mixed $condition, string $message)
Asserts that a condition is not false.
mixed
$condition string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertNotInstanceOf(string $expected, mixed $actual, string $message)
Asserts that a variable is not of a given type.
string
$expected mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertNotInternalType(string $expected, mixed $actual, string $message)
Asserts that a variable is not of a given type.
string
$expected mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertNotIsReadable(string $filename, string $message)
Asserts that a file/dir exists and is not readable.
string
$filename string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertNotIsWritable(string $filename, string $message)
Asserts that a file/dir exists and is not writable.
string
$filename string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertNotNull(mixed $actual, string $message)
Asserts that a variable is not null.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertNotRegExp(string $pattern, string $string, string $message)
Asserts that a string does not match a given regular expression.
string
$pattern string
$string string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertNotSame(mixed $expected, mixed $actual, string $message)
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.
mixed
$expected mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertNotSameSize(mixed $expected, mixed $actual, string $message)
Assert that the size of two arrays (or Countable
or Traversable
objects) is not the same.
\Countable|iterable
$expected \Countable|iterable
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertNotTrue(mixed $condition, string $message)
Asserts that a condition is not true.
mixed
$condition string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertNotWithinRange(mixed $expected, mixed $result, mixed $margin, mixed $message)
Compatibility function to test if a value is not between an acceptable range.
float
$expected float
$result float
$margin the rage of acceptation
string
$message optional the text to display if the assertion is not correct
assertNull(mixed $actual, string $message)
Asserts that a variable is null.
mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertObjectHasAttribute(string $attributeName, mixed $object, string $message)
Asserts that an object has a specified attribute.
string
$attributeName object
$object string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertObjectNotHasAttribute(string $attributeName, mixed $object, string $message)
Asserts that an object does not have a specified attribute.
string
$attributeName object
$object string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertOutputContains(string $expected, string $message)
Asserts stdout
contains expected output
string
$expected Expected output
string
$message optional Failure message
assertOutputContainsRow(array $row, string $message)
Check that a row of cells exists in the output.
array
$row Row of cells to ensure exist in the output.
string
$message optional Failure message.
assertOutputEmpty(string $message)
Asserts that stdout
is empty
string
$message optional The message to output when the assertion fails.
assertOutputNotContains(string $expected, string $message)
Asserts stdout
does not contain expected output
string
$expected Expected output
string
$message optional Failure message
assertOutputRegExp(string $pattern, string $message)
Asserts stdout
contains expected regexp
string
$pattern Expected pattern
string
$message optional Failure message
assertPathEquals(mixed $expected, mixed $result, mixed $message)
Compatibility function to test paths.
string
$expected string
$result string
$message optional the text to display if the assertion is not correct
assertPostConditions()
Performs assertions shared by all tests of a test case.
This method is called between test and tearDown().
assertPreConditions()
Performs assertions shared by all tests of a test case.
This method is called between setUp() and test.
assertRegExp(string $pattern, string $string, string $message)
Asserts that a string matches a given regular expression.
string
$pattern string
$string string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertRegExpSql(string $pattern, string $actual, bool $optional)
Assertion for comparing a regex pattern against a query having its identifiers quoted. It accepts queries quoted with the characters <
and >
. If the third parameter is set to true, it will alter the pattern to both accept quoted and unquoted queries
string
$pattern The expected sql pattern
string
$actual The sql to compare
bool
$optional optional Whether quote characters (marked with <>) are optional
assertSame(mixed $expected, mixed $actual, string $message)
Asserts that two variables have the same type and value.
Used on objects, it asserts that two variables reference the same object.
mixed
$expected mixed
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertSameSize(mixed $expected, mixed $actual, string $message)
Assert that the size of two arrays (or Countable
or Traversable
objects) is the same.
\Countable|iterable
$expected \Countable|iterable
$actual string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertStringContainsString(string $needle, string $haystack, string $message)
string
$needle string
$haystack string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertStringContainsStringIgnoringCase(string $needle, string $haystack, string $message)
string
$needle string
$haystack string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertStringEndsNotWith(string $suffix, string $string, string $message)
Asserts that a string ends not with a given suffix.
string
$suffix string
$string string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertStringEndsWith(string $suffix, string $string, string $message)
Asserts that a string ends with a given suffix.
string
$suffix string
$string string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertStringEqualsFile(string $expectedFile, string $actualString, string $message, bool $canonicalize, bool $ignoreCase)
Asserts that the contents of a string is equal to the contents of a file.
string
$expectedFile string
$actualString string
$message optional bool
$canonicalize optional bool
$ignoreCase optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertStringEqualsFileCanonicalizing(string $expectedFile, string $actualString, string $message)
Asserts that the contents of a string is equal to the contents of a file (canonicalizing).
string
$expectedFile string
$actualString string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertStringEqualsFileIgnoringCase(string $expectedFile, string $actualString, string $message)
Asserts that the contents of a string is equal to the contents of a file (ignoring case).
string
$expectedFile string
$actualString string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertStringMatchesFormat(string $format, string $string, string $message)
Asserts that a string matches a given format string.
string
$format string
$string string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertStringMatchesFormatFile(string $formatFile, string $string, string $message)
Asserts that a string matches a given format file.
string
$formatFile string
$string string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertStringNotContainsString(string $needle, string $haystack, string $message)
string
$needle string
$haystack string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertStringNotContainsStringIgnoringCase(string $needle, string $haystack, string $message)
string
$needle string
$haystack string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertStringNotEqualsFile(string $expectedFile, string $actualString, string $message, bool $canonicalize, bool $ignoreCase)
Asserts that the contents of a string is not equal to the contents of a file.
string
$expectedFile string
$actualString string
$message optional bool
$canonicalize optional bool
$ignoreCase optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertStringNotEqualsFileCanonicalizing(string $expectedFile, string $actualString, string $message)
Asserts that the contents of a string is not equal to the contents of a file (canonicalizing).
string
$expectedFile string
$actualString string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertStringNotEqualsFileIgnoringCase(string $expectedFile, string $actualString, string $message)
Asserts that the contents of a string is not equal to the contents of a file (ignoring case).
string
$expectedFile string
$actualString string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertStringNotMatchesFormat(string $format, string $string, string $message)
Asserts that a string does not match a given format string.
string
$format string
$string string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message)
Asserts that a string does not match a given format string.
string
$formatFile string
$string string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertStringStartsNotWith(mixed $prefix, mixed $string, string $message)
Asserts that a string starts not with a given prefix.
string
$prefix string
$string string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertStringStartsWith(string $prefix, string $string, string $message)
Asserts that a string starts with a given prefix.
string
$prefix string
$string string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertTextContains(string $needle, string $haystack, string $message, bool $ignoreCase)
Assert that a string contains another string, ignoring differences in newlines.
Helpful for doing cross platform tests of blocks of text.
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.
assertTextEndsNotWith(string $suffix, string $string, string $message)
Asserts that a string ends not with a given prefix, ignoring differences in newlines.
Helpful for doing cross platform tests of blocks of text.
string
$suffix The suffix to not find.
string
$string The string to search.
string
$message optional The message to use for failure.
assertTextEndsWith(string $suffix, string $string, string $message)
Asserts that a string ends with a given prefix, ignoring differences in newlines.
Helpful for doing cross platform tests of blocks of text.
string
$suffix The suffix to find.
string
$string The string to search.
string
$message optional The message to use for failure.
assertTextEquals(string $expected, string $result, string $message)
Assert text equality, ignoring differences in newlines.
Helpful for doing cross platform tests of blocks of text.
string
$expected The expected value.
string
$result The actual value.
string
$message optional The message to use for failure.
assertTextNotContains(string $needle, string $haystack, string $message, bool $ignoreCase)
Assert that a text doesn't contain another text, ignoring differences in newlines.
Helpful for doing cross platform tests of blocks of text.
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.
assertTextNotEquals(string $expected, string $result, string $message)
Assert text equality, ignoring differences in newlines.
Helpful for doing cross platform tests of blocks of text.
string
$expected The expected value.
string
$result The actual value.
string
$message optional The message to use for failure.
assertTextStartsNotWith(string $prefix, string $string, string $message)
Asserts that a string starts not with a given prefix, ignoring differences in newlines.
Helpful for doing cross platform tests of blocks of text.
string
$prefix The prefix to not find.
string
$string The string to search.
string
$message optional The message to use for failure.
assertTextStartsWith(string $prefix, string $string, string $message)
Asserts that a string starts with a given prefix, ignoring differences in newlines.
Helpful for doing cross platform tests of blocks of text.
string
$prefix The prefix to check for.
string
$string The string to search in.
string
$message optional The message to use for failure.
assertThat(mixed $value, \PHPUnit\Framework\Constraint\Constraint $constraint, string $message)
Evaluates a PHPUnit\Framework\Constraint matcher object.
mixed
$value \PHPUnit\Framework\Constraint\Constraint
$constraint string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertTrue(mixed $condition, string $message)
Asserts that a condition is true.
mixed
$condition string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
assertWithinRange(mixed $expected, mixed $result, mixed $margin, mixed $message)
Compatibility function to test if a value is between an acceptable range.
float
$expected float
$result float
$margin the rage of acceptation
string
$message optional the text to display if the assertion is not correct
assertXmlFileEqualsXmlFile(string $expectedFile, string $actualFile, string $message)
Asserts that two XML files are equal.
string
$expectedFile string
$actualFile string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertXmlFileNotEqualsXmlFile(string $expectedFile, string $actualFile, string $message)
Asserts that two XML files are not equal.
string
$expectedFile string
$actualFile string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertXmlStringEqualsXmlFile(string $expectedFile, mixed $actualXml, string $message)
Asserts that two XML documents are equal.
string
$expectedFile \DOMDocument|string
$actualXml string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertXmlStringEqualsXmlString(mixed $expectedXml, mixed $actualXml, string $message)
Asserts that two XML documents are equal.
\DOMDocument|string
$expectedXml \DOMDocument|string
$actualXml string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertXmlStringNotEqualsXmlFile(string $expectedFile, mixed $actualXml, string $message)
Asserts that two XML documents are not equal.
string
$expectedFile \DOMDocument|string
$actualXml string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
assertXmlStringNotEqualsXmlString(mixed $expectedXml, mixed $actualXml, string $message)
Asserts that two XML documents are not equal.
\DOMDocument|string
$expectedXml \DOMDocument|string
$actualXml string
$message optional PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
at(int $index)
Returns a matcher that matches when the method is executed at the given index.
int
$index atLeast(int $requiredInvocations)
Returns a matcher that matches when the method is executed at least N times.
int
$requiredInvocations atLeastOnce()
Returns a matcher that matches when the method is executed at least once.
atMost(int $allowedInvocations)
Returns a matcher that matches when the method is executed at most N times.
int
$allowedInvocations attribute(\PHPUnit\Framework\Constraint\Constraint $constraint, string $attributeName)
\PHPUnit\Framework\Constraint\Constraint
$constraint string
$attributeName attributeEqualTo(string $attributeName, mixed $value, float $delta, int $maxDepth, bool $canonicalize, bool $ignoreCase)
string
$attributeName mixed
$value float
$delta optional int
$maxDepth optional bool
$canonicalize optional bool
$ignoreCase optional callback(callable $callback)
callable
$callback classHasAttribute(string $attributeName)
string
$attributeName classHasStaticAttribute(string $attributeName)
string
$attributeName cleanupConsoleTrait()
Cleans state to get ready for the next test
clearPlugins()
Clear all plugins from the global plugin collection.
Useful in test case teardown methods.
commandStringToArgs(string $command)
Creates an $argv array from a command string
string
$command Command string
string[]
configApplication(string $class, ?array $constructorArgs)
Configure the application class to use in console integration tests.
string
$class The application class name.
array|null
$constructorArgs The constructor arguments for your application class.
contains(mixed $value, bool $checkForObjectIdentity, bool $checkForNonObjectIdentity)
mixed
$value bool
$checkForObjectIdentity optional bool
$checkForNonObjectIdentity optional containsEqual(mixed $value)
mixed
$value containsIdentical(mixed $value)
mixed
$value containsOnly(string $type)
string
$type containsOnlyInstancesOf(string $className)
string
$className count()
countOf(int $count)
int
$count createConfiguredMock(mixed $originalClassName, array $configuration)
Returns a configured mock object for the specified class.
string|string[]
$originalClassName array
$configuration createMock(mixed $originalClassName)
Returns a mock object for the specified class.
string|string[]
$originalClassName createPartialMock(mixed $originalClassName, array $methods)
Returns a partial mock object for the specified class.
string|string[]
$originalClassName string[]
$methods createResult()
Creates a default TestResult object.
createStub(string $originalClassName)
Makes configurable stub for the specified class.
string
$originalClassName createTestProxy(string $originalClassName, array $constructorArguments)
Returns a test proxy for the specified class.
string
$originalClassName array
$constructorArguments optional dataDescription()
dataName()
int|string
deprecated(callable $callable)
Helper method for check deprecation methods
callable
$callable callable function that will receive asserts
directoryExists()
doesNotPerformAssertions()
doubledTypes()
string[]
equalTo(mixed $value, float $delta, int $maxDepth, bool $canonicalize, bool $ignoreCase)
mixed
$value float
$delta optional int
$maxDepth optional bool
$canonicalize optional bool
$ignoreCase optional exactly(int $count)
Returns a matcher that matches when the method is executed exactly $count times.
int
$count exec(string $command, array $input)
Runs CLI integration test
string
$command Command to run
array
$input optional Input values to pass to an interactive shell
Cake\TestSuite\Stub\MissingConsoleInputException
RuntimeException
expectDeprecation()
expectDeprecationMessage(string $message)
string
$message expectDeprecationMessageMatches(string $regularExpression)
string
$regularExpression expectError()
expectErrorMessage(string $message)
string
$message expectErrorMessageMatches(string $regularExpression)
string
$regularExpression expectException(string $exception)
string
$exception expectExceptionCode(mixed $code)
int|string
$code expectExceptionMessage(string $message)
string
$message expectExceptionMessageMatches(string $regularExpression)
string
$regularExpression expectExceptionMessageRegExp(string $regularExpression)
string
$regularExpression expectExceptionObject(\Exception $exception)
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.
\Exception
$exception expectNotToPerformAssertions()
expectNotice()
expectNoticeMessage(string $message)
string
$message expectNoticeMessageMatches(string $regularExpression)
string
$regularExpression expectOutputRegex(string $expectedRegex)
string
$expectedRegex expectOutputString(string $expectedString)
string
$expectedString expectWarning()
expectWarningMessage(string $message)
string
$message expectWarningMessageMatches(string $regularExpression)
string
$regularExpression fail(string $message)
Fails a test with the given message.
string
$message optional PHPUnit\Framework\AssertionFailedError
fileExists()
getActualOutput()
getActualOutputForAssertion()
getAnnotations()
getCount()
Return the current assertion count.
getDataSetAsString(bool $includeData)
bool
$includeData optional getDependencies()
getDependencyInput()
getExpectedException()
getExpectedExceptionCode()
null|int|string
getExpectedExceptionMessage()
getExpectedExceptionMessageRegExp()
getFixtures()
Gets fixtures.
string[]
getGroups()
getMockBuilder(mixed $className)
Returns a builder object to create mock objects using a fluent interface.
string|string[]
$className getMockClass(mixed $originalClassName, mixed $methods, array $arguments, mixed $mockClassName, mixed $callOriginalConstructor, mixed $callOriginalClone, mixed $callAutoload, mixed $cloneArguments)
Mocks the specified class and returns the name of the mocked class.
string
$originalClassName array
$methods optional array
$arguments optional string
$mockClassName optional bool
$callOriginalConstructor optional bool
$callOriginalClone optional bool
$callAutoload optional bool
$cloneArguments optional getMockForAbstractClass(mixed $originalClassName, array $arguments, mixed $mockClassName, mixed $callOriginalConstructor, mixed $callOriginalClone, mixed $callAutoload, mixed $mockedMethods, mixed $cloneArguments)
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).
string
$originalClassName array
$arguments optional string
$mockClassName optional bool
$callOriginalConstructor optional bool
$callOriginalClone optional bool
$callAutoload optional array
$mockedMethods optional bool
$cloneArguments optional getMockForModel(string $alias, array $methods, array $options)
Mock a model, maintain fixtures and table association
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.
\Cake\ORM\Table|\PHPUnit\Framework\MockObject\MockObject
Cake\ORM\Exception\MissingTableClassException
getMockForTrait(mixed $traitName, array $arguments, mixed $mockClassName, mixed $callOriginalConstructor, mixed $callOriginalClone, mixed $callAutoload, mixed $mockedMethods, mixed $cloneArguments)
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.
string
$traitName array
$arguments optional string
$mockClassName optional bool
$callOriginalConstructor optional bool
$callOriginalClone optional bool
$callAutoload optional array
$mockedMethods optional bool
$cloneArguments optional getMockFromWsdl(mixed $wsdlFile, mixed $originalClassName, mixed $mockClassName, array $methods, mixed $callOriginalConstructor, array $options)
Returns a mock object based on the given WSDL file.
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
getName(bool $withDataSet)
bool
$withDataSet optional SebastianBergmann\RecursionContext\InvalidArgumentException
getNumAssertions()
Returns the number of assertions performed by this test.
getObjectAttribute(mixed $object, string $attributeName)
Returns the value of an object's attribute.
This also works for attributes that are declared protected or private.
object
$object string
$attributeName PHPUnit\Framework\Exception
getObjectForTrait(mixed $traitName, array $arguments, mixed $traitClassName, mixed $callOriginalConstructor, mixed $callOriginalClone, mixed $callAutoload)
Returns an object for the specified trait.
string
$traitName array
$arguments optional string
$traitClassName optional bool
$callOriginalConstructor optional bool
$callOriginalClone optional bool
$callAutoload optional object
getProvidedData()
Gets the data set of a TestCase.
getResult()
getSize()
Returns the size of the test.
SebastianBergmann\RecursionContext\InvalidArgumentException
getStaticAttribute(string $className, string $attributeName)
Returns the value of a static attribute.
This also works for attributes that are declared protected or private.
string
$className string
$attributeName PHPUnit\Framework\Exception
getStatus()
getStatusMessage()
getTableLocator()
Gets the table locator.
\Cake\ORM\Locator\LocatorInterface
getTestResultObject()
greaterThan(mixed $value)
mixed
$value greaterThanOrEqual(mixed $value)
mixed
$value hasDependencies()
hasExpectationOnOutput()
hasFailed()
hasOutput()
hasSize()
SebastianBergmann\RecursionContext\InvalidArgumentException
identicalTo(mixed $value)
mixed
$value iniSet(string $varName, string $newValue)
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.
string
$varName string
$newValue PHPUnit\Framework\Exception
isEmpty()
isFalse()
isFinite()
isInIsolation()
isInfinite()
isInstanceOf(string $className)
string
$className isJson()
isLarge()
SebastianBergmann\RecursionContext\InvalidArgumentException
isMedium()
SebastianBergmann\RecursionContext\InvalidArgumentException
isNan()
isNull()
isReadable()
isSmall()
SebastianBergmann\RecursionContext\InvalidArgumentException
isTrue()
isType(string $type)
string
$type isWritable()
lessThan(mixed $value)
mixed
$value lessThanOrEqual(mixed $value)
mixed
$value loadFixtures()
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.
RuntimeException
loadPlugins(array $plugins)
Load plugins into a simulated application.
Useful to test how plugins being loaded/not loaded interact with other elements in CakePHP or applications.
array
$plugins optional List of Plugins to load.
\Cake\Http\BaseApplication
loadRoutes(?array $appArgs)
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.
array|null
$appArgs optional Constructor parameters for the application class.
logicalAnd()
PHPUnit\Framework\Exception
logicalNot(\PHPUnit\Framework\Constraint\Constraint $constraint)
\PHPUnit\Framework\Constraint\Constraint
$constraint logicalOr()
logicalXor()
makeRunner()
Builds the appropriate command dispatcher
\Cake\Console\CommandRunner|\Cake\TestSuite\LegacyCommandRunner
markAsRisky()
markTestIncomplete(string $message)
Mark the test as incomplete.
string
$message optional PHPUnit\Framework\IncompleteTestError
markTestSkipped(string $message)
Mark the test as skipped.
string
$message optional PHPUnit\Framework\SkippedTestError
PHPUnit\Framework\SyntheticSkippedError
matches(string $string)
string
$string matchesRegularExpression(string $pattern)
string
$pattern never()
Returns a matcher that matches when the method is never executed.
objectHasAttribute(mixed $attributeName)
mixed
$attributeName onConsecutiveCalls(mixed ...$args)
mixed
...$args onNotSuccessfulTest(\Throwable $t)
This method is called when a test method did not execute successfully.
\Throwable
$t Throwable
once()
Returns a matcher that matches when the method is executed exactly once.
prophesize(mixed $classOrInterface)
null|string
$classOrInterface optional Prophecy\Exception\Doubler\ClassNotFoundException
Prophecy\Exception\Doubler\DoubleException
Prophecy\Exception\Doubler\InterfaceNotFoundException
readAttribute(mixed $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.
object|string
$classOrObject string
$attributeName PHPUnit\Framework\Exception
registerComparator(\SebastianBergmann\Comparator\Comparator $comparator)
\SebastianBergmann\Comparator\Comparator
$comparator registerMockObject(\PHPUnit\Framework\MockObject\MockObject $mockObject)
\PHPUnit\Framework\MockObject\MockObject
$mockObject removePlugins(array $names)
Remove plugins from the global plugin collection.
Useful in test case teardown methods.
string[]
$names optional A list of plugins you want to remove.
resetCount()
Reset the assertion counter.
returnArgument(int $argumentIndex)
int
$argumentIndex returnCallback(mixed $callback)
mixed
$callback returnSelf()
Returns the current object.
This method is useful when mocking a fluent interface.
returnValue(mixed $value)
mixed
$value returnValueMap(array $valueMap)
array
$valueMap run(\PHPUnit\Framework\TestResult $result)
Runs the test case and collects the results in a TestResult object.
If no TestResult object is passed a new one will be created.
\PHPUnit\Framework\TestResult
$result optional PHPUnit\Framework\CodeCoverageException
PHPUnit\Util\Exception
SebastianBergmann\CodeCoverage\CoveredCodeNotExecutedException
SebastianBergmann\CodeCoverage\InvalidArgumentException
SebastianBergmann\CodeCoverage\MissingCoversAnnotationException
SebastianBergmann\CodeCoverage\RuntimeException
SebastianBergmann\CodeCoverage\UnintentionallyCoveredCodeException
SebastianBergmann\RecursionContext\InvalidArgumentException
runBare()
Throwable
runTest()
Override to run the test and assert its state.
PHPUnit\Framework\AssertionFailedError
PHPUnit\Framework\Exception
PHPUnit\Framework\ExpectationFailedException
SebastianBergmann\ObjectEnumerator\InvalidArgumentException
Throwable
setAppNamespace(string $appNamespace)
Set the app namespace
string
$appNamespace optional The app namespace, defaults to "TestApp".
string|null
The previous app namespace or null if not set.
setBackupGlobals(?bool $backupGlobals)
?bool
$backupGlobals setBackupStaticAttributes(?bool $backupStaticAttributes)
?bool
$backupStaticAttributes setBeStrictAboutChangesToGlobalState(?bool $beStrictAboutChangesToGlobalState)
?bool
$beStrictAboutChangesToGlobalState setDependencies(array $dependencies)
string[]
$dependencies setDependencyInput(array $dependencyInput)
array
$dependencyInput setGroups(array $groups)
array
$groups setInIsolation(bool $inIsolation)
bool
$inIsolation setLocale(mixed ...$args)
This method is a wrapper for the setlocale() function that automatically resets the locale to its original value after the test is run.
mixed
...$args PHPUnit\Framework\Exception
setName(string $name)
string
$name setOutputCallback(callable $callback)
callable
$callback setPreserveGlobalState(bool $preserveGlobalState)
bool
$preserveGlobalState setRegisterMockObjectsFromTestArgumentsRecursively(bool $flag)
bool
$flag setResult(mixed $result)
mixed
$result setRunClassInSeparateProcess(bool $runClassInSeparateProcess)
bool
$runClassInSeparateProcess setRunTestInSeparateProcess(bool $runTestInSeparateProcess)
bool
$runTestInSeparateProcess setTableLocator(\Cake\ORM\Locator\LocatorInterface $tableLocator)
Sets the table locator.
\Cake\ORM\Locator\LocatorInterface
$tableLocator LocatorInterface instance.
$this
setTestResultObject(\PHPUnit\Framework\TestResult $result)
\PHPUnit\Framework\TestResult
$result setUp()
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()
This method is called before the first test of this test class is run.
setUseErrorHandler(bool $useErrorHandler)
bool
$useErrorHandler skipIf(bool $shouldSkip, string $message)
Overrides SimpleTestCase::skipIf to provide a boolean return value
bool
$shouldSkip Whether or not the test should be skipped.
string
$message optional The message to display.
bool
skipUnless(mixed $condition, mixed $message)
Compatibility function for skipping.
bool
$condition Condition to trigger skipping
string
$message optional Message for skip
bool
stringContains(string $string, bool $case)
string
$string bool
$case optional stringEndsWith(string $suffix)
string
$suffix stringStartsWith(mixed $prefix)
mixed
$prefix tearDown()
teardown any static object changes and restore them.
tearDownAfterClass()
This method is called after the last test of this test class is run.
throwException(\Throwable $exception)
\Throwable
$exception toString()
Returns a string representation of the test case.
SebastianBergmann\RecursionContext\InvalidArgumentException
PHPUnit\Framework\Exception
useCommandRunner()
Set this test case to use the CommandRunner rather than the legacy ShellDispatcher
usesDataProvider()
withErrorReporting(int $errorLevel, callable $callable)
Helper method for tests that needs to use error_reporting()
int
$errorLevel value of error_reporting() that needs to use
callable
$callable callable function that will receive asserts
The customized application constructor arguments.
array|null
The customized application class name.
string|null
Configure values to restore at end of test.
array
Console error output stub
\Cake\TestSuite\Stub\ConsoleOutput
Last exit code
int|null
Console input mock
\Cake\Console\ConsoleInput
Console output stub
\Cake\TestSuite\Stub\ConsoleOutput
Table locator instance
\Cake\ORM\Locator\LocatorInterface|null
Whether or not to use the CommandRunner
bool
By default, all fixtures attached to this class will be truncated and reloaded after each test.
Set this to false to handle manually
bool
?bool
string[]
bool
array<string,array<int,string>>
Control table create/drops on each test method.
If true, tables will still be dropped at the end of each test runner execution.
bool
The class responsible for managing the creation, loading and removing of fixtures
\Cake\TestSuite\Fixture\FixtureManager|null
Fixtures used by this test case.
string[]
bool
bool
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.1/class-Cake.TestSuite.ConsoleIntegrationTestCase.html