class WarningTestCase extends TestCase (View source)

A warning.

Properties

protected bool $backupGlobals
protected array $backupGlobalsBlacklist from TestCase
protected bool $backupStaticAttributes
protected array $backupStaticAttributesBlacklist from TestCase
protected bool $runTestInSeparateProcess
protected bool $preserveGlobalState Whether or not this test should preserve the global state when running in a separate PHP process. from TestCase
protected string $message
protected bool $useErrorHandler

Methods

static 
assertArrayHasKey(mixed $key, array|ArrayAccess $array, string $message = '')

Asserts that an array has a specified key.

from Assert
static 
assertArraySubset(array|ArrayAccess $subset, array|ArrayAccess $array, bool $strict = false, string $message = '')

Asserts that an array has a specified subset.

from Assert
static 
assertArrayNotHasKey(mixed $key, array|ArrayAccess $array, string $message = '')

Asserts that an array does not have a specified key.

from Assert
static 
assertContains(mixed $needle, mixed $haystack, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false)

Asserts that a haystack contains a needle.

from Assert
static 
assertAttributeContains(mixed $needle, string $haystackAttributeName, string|object $haystackClassOrObject, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false)

Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains a needle.

from Assert
static 
assertNotContains(mixed $needle, mixed $haystack, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false)

Asserts that a haystack does not contain a needle.

from Assert
static 
assertAttributeNotContains(mixed $needle, string $haystackAttributeName, string|object $haystackClassOrObject, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false)

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.

from Assert
static 
assertContainsOnly(string $type, mixed $haystack, bool $isNativeType = null, string $message = '')

Asserts that a haystack contains only values of a given type.

from Assert
static 
assertContainsOnlyInstancesOf(string $classname, array|Traversable $haystack, string $message = '')

Asserts that a haystack contains only instances of a given classname

from Assert
static 
assertAttributeContainsOnly(string $type, string $haystackAttributeName, string|object $haystackClassOrObject, bool $isNativeType = null, 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.

from Assert
static 
assertNotContainsOnly(string $type, mixed $haystack, bool $isNativeType = null, string $message = '')

Asserts that a haystack does not contain only values of a given type.

from Assert
static 
assertAttributeNotContainsOnly(string $type, string $haystackAttributeName, string|object $haystackClassOrObject, bool $isNativeType = null, 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.

from Assert
static 
assertCount(int $expectedCount, mixed $haystack, string $message = '')

Asserts the number of elements of an array, Countable or Traversable.

from Assert
static 
assertAttributeCount(int $expectedCount, string $haystackAttributeName, string|object $haystackClassOrObject, string $message = '')

Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.

from Assert
static 
assertNotCount(int $expectedCount, mixed $haystack, string $message = '')

Asserts the number of elements of an array, Countable or Traversable.

from Assert
static 
assertAttributeNotCount(int $expectedCount, string $haystackAttributeName, string|object $haystackClassOrObject, string $message = '')

Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.

from Assert
static 
assertEquals(mixed $expected, mixed $actual, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false)

Asserts that two variables are equal.

from Assert
static 
assertAttributeEquals(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false)

Asserts that a variable is equal to an attribute of an object.

from Assert
static 
assertNotEquals(mixed $expected, mixed $actual, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false)

Asserts that two variables are not equal.

from Assert
static 
assertAttributeNotEquals(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false)

Asserts that a variable is not equal to an attribute of an object.

from Assert
static 
assertEmpty(mixed $actual, string $message = '')

Asserts that a variable is empty.

from Assert
static 
assertAttributeEmpty(string $haystackAttributeName, string|object $haystackClassOrObject, string $message = '')

Asserts that a static attribute of a class or an attribute of an object is empty.

from Assert
static 
assertNotEmpty(mixed $actual, string $message = '')

Asserts that a variable is not empty.

from Assert
static 
assertAttributeNotEmpty(string $haystackAttributeName, string|object $haystackClassOrObject, string $message = '')

Asserts that a static attribute of a class or an attribute of an object is not empty.

from Assert
static 
assertGreaterThan(mixed $expected, mixed $actual, string $message = '')

Asserts that a value is greater than another value.

from Assert
static 
assertAttributeGreaterThan(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '')

Asserts that an attribute is greater than another value.

from Assert
static 
assertGreaterThanOrEqual(mixed $expected, mixed $actual, string $message = '')

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

from Assert
static 
assertAttributeGreaterThanOrEqual(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '')

Asserts that an attribute is greater than or equal to another value.

from Assert
static 
assertLessThan(mixed $expected, mixed $actual, string $message = '')

Asserts that a value is smaller than another value.

from Assert
static 
assertAttributeLessThan(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '')

Asserts that an attribute is smaller than another value.

from Assert
static 
assertLessThanOrEqual(mixed $expected, mixed $actual, string $message = '')

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

from Assert
static 
assertAttributeLessThanOrEqual(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '')

Asserts that an attribute is smaller than or equal to another value.

from Assert
static 
assertFileEquals(string $expected, string $actual, string $message = '', bool $canonicalize = false, bool $ignoreCase = false)

Asserts that the contents of one file is equal to the contents of another file.

from Assert
static 
assertFileNotEquals(string $expected, string $actual, string $message = '', bool $canonicalize = false, bool $ignoreCase = false)

Asserts that the contents of one file is not equal to the contents of another file.

from Assert
static 
assertStringEqualsFile(string $expectedFile, string $actualString, string $message = '', bool $canonicalize = false, bool $ignoreCase = false)

Asserts that the contents of a string is equal to the contents of a file.

from Assert
static 
assertStringNotEqualsFile(string $expectedFile, string $actualString, string $message = '', bool $canonicalize = false, bool $ignoreCase = false)

Asserts that the contents of a string is not equal to the contents of a file.

from Assert
static 
assertIsReadable(string $filename, string $message = '')

Asserts that a file/dir is readable.

from Assert
static 
assertNotIsReadable(string $filename, string $message = '')

Asserts that a file/dir exists and is not readable.

from Assert
static 
assertIsWritable(string $filename, string $message = '')

Asserts that a file/dir exists and is writable.

from Assert
static 
assertNotIsWritable(string $filename, string $message = '')

Asserts that a file/dir exists and is not writable.

from Assert
static 
assertDirectoryExists(string $directory, string $message = '')

Asserts that a directory exists.

from Assert
static 
assertDirectoryNotExists(string $directory, string $message = '')

Asserts that a directory does not exist.

from Assert
static 
assertDirectoryIsReadable(string $directory, string $message = '')

Asserts that a directory exists and is readable.

from Assert
static 
assertDirectoryNotIsReadable(string $directory, string $message = '')

Asserts that a directory exists and is not readable.

from Assert
static 
assertDirectoryIsWritable(string $directory, string $message = '')

Asserts that a directory exists and is writable.

from Assert
static 
assertDirectoryNotIsWritable(string $directory, string $message = '')

Asserts that a directory exists and is not writable.

from Assert
static 
assertFileExists(string $filename, string $message = '')

Asserts that a file exists.

from Assert
static 
assertFileNotExists(string $filename, string $message = '')

Asserts that a file does not exist.

from Assert
static 
assertFileIsReadable(string $file, string $message = '')

Asserts that a file exists and is readable.

from Assert
static 
assertFileNotIsReadable(string $file, string $message = '')

Asserts that a file exists and is not readable.

from Assert
static 
assertFileIsWritable(string $file, string $message = '')

Asserts that a file exists and is writable.

from Assert
static 
assertFileNotIsWritable(string $file, string $message = '')

Asserts that a file exists and is not writable.

from Assert
static 
assertTrue(bool $condition, string $message = '')

Asserts that a condition is true.

from Assert
static 
assertNotTrue(bool $condition, string $message = '')

Asserts that a condition is not true.

from Assert
static 
assertFalse(bool $condition, string $message = '')

Asserts that a condition is false.

from Assert
static 
assertNotFalse(bool $condition, string $message = '')

Asserts that a condition is not false.

from Assert
static 
assertNull(mixed $actual, string $message = '')

Asserts that a variable is null.

from Assert
static 
assertNotNull(mixed $actual, string $message = '')

Asserts that a variable is not null.

from Assert
static 
assertFinite(mixed $actual, string $message = '')

Asserts that a variable is finite.

from Assert
static 
assertInfinite(mixed $actual, string $message = '')

Asserts that a variable is infinite.

from Assert
static 
assertNan(mixed $actual, string $message = '')

Asserts that a variable is nan.

from Assert
static 
assertClassHasAttribute(string $attributeName, string $className, string $message = '')

Asserts that a class has a specified attribute.

from Assert
static 
assertClassNotHasAttribute(string $attributeName, string $className, string $message = '')

Asserts that a class does not have a specified attribute.

from Assert
static 
assertClassHasStaticAttribute(string $attributeName, string $className, string $message = '')

Asserts that a class has a specified static attribute.

from Assert
static 
assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = '')

Asserts that a class does not have a specified static attribute.

from Assert
static 
assertObjectHasAttribute(string $attributeName, object $object, string $message = '')

Asserts that an object has a specified attribute.

from Assert
static 
assertObjectNotHasAttribute(string $attributeName, object $object, string $message = '')

Asserts that an object does not have a specified attribute.

from Assert
static 
assertSame(mixed $expected, mixed $actual, string $message = '')

Asserts that two variables have the same type and value.

from Assert
static 
assertAttributeSame(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '')

Asserts that a variable and an attribute of an object have the same type and value.

from Assert
static 
assertNotSame(mixed $expected, mixed $actual, string $message = '')

Asserts that two variables do not have the same type and value.

from Assert
static 
assertAttributeNotSame(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '')

Asserts that a variable and an attribute of an object do not have the same type and value.

from Assert
static 
assertInstanceOf(string $expected, mixed $actual, string $message = '')

Asserts that a variable is of a given type.

from Assert
static 
assertAttributeInstanceOf(string $expected, string $attributeName, string|object $classOrObject, string $message = '')

Asserts that an attribute is of a given type.

from Assert
static 
assertNotInstanceOf(string $expected, mixed $actual, string $message = '')

Asserts that a variable is not of a given type.

from Assert
static 
assertAttributeNotInstanceOf(string $expected, string $attributeName, string|object $classOrObject, string $message = '')

Asserts that an attribute is of a given type.

from Assert
static 
assertInternalType(string $expected, mixed $actual, string $message = '')

Asserts that a variable is of a given type.

from Assert
static 
assertAttributeInternalType(string $expected, string $attributeName, string|object $classOrObject, string $message = '')

Asserts that an attribute is of a given type.

from Assert
static 
assertNotInternalType(string $expected, mixed $actual, string $message = '')

Asserts that a variable is not of a given type.

from Assert
static 
assertAttributeNotInternalType(string $expected, string $attributeName, string|object $classOrObject, string $message = '')

Asserts that an attribute is of a given type.

from Assert
static 
assertRegExp(string $pattern, string $string, string $message = '')

Asserts that a string matches a given regular expression.

from Assert
static 
assertNotRegExp(string $pattern, string $string, string $message = '')

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

from Assert
static 
assertSameSize(array|Countable|Traversable $expected, array|Countable|Traversable $actual, string $message = '')

Assert that the size of two arrays (or Countable or Traversable objects) is the same.

from Assert
static 
assertNotSameSize(array|Countable|Traversable $expected, array|Countable|Traversable $actual, string $message = '')

Assert that the size of two arrays (or Countable or Traversable objects) is not the same.

from Assert
static 
assertStringMatchesFormat(string $format, string $string, string $message = '')

Asserts that a string matches a given format string.

from Assert
static 
assertStringNotMatchesFormat(string $format, string $string, string $message = '')

Asserts that a string does not match a given format string.

from Assert
static 
assertStringMatchesFormatFile(string $formatFile, string $string, string $message = '')

Asserts that a string matches a given format file.

from Assert
static 
assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message = '')

Asserts that a string does not match a given format string.

from Assert
static 
assertStringStartsWith(string $prefix, string $string, string $message = '')

Asserts that a string starts with a given prefix.

from Assert
static 
assertStringStartsNotWith(string $prefix, string $string, string $message = '')

Asserts that a string starts not with a given prefix.

from Assert
static 
assertStringEndsWith(string $suffix, string $string, string $message = '')

Asserts that a string ends with a given suffix.

from Assert
static 
assertStringEndsNotWith(string $suffix, string $string, string $message = '')

Asserts that a string ends not with a given suffix.

from Assert
static 
assertXmlFileEqualsXmlFile(string $expectedFile, string $actualFile, string $message = '')

Asserts that two XML files are equal.

from Assert
static 
assertXmlFileNotEqualsXmlFile(string $expectedFile, string $actualFile, string $message = '')

Asserts that two XML files are not equal.

from Assert
static 
assertXmlStringEqualsXmlFile(string $expectedFile, string|DOMDocument $actualXml, string $message = '')

Asserts that two XML documents are equal.

from Assert
static 
assertXmlStringNotEqualsXmlFile(string $expectedFile, string|DOMDocument $actualXml, string $message = '')

Asserts that two XML documents are not equal.

from Assert
static 
assertXmlStringEqualsXmlString(string|DOMDocument $expectedXml, string|DOMDocument $actualXml, string $message = '')

Asserts that two XML documents are equal.

from Assert
static 
assertXmlStringNotEqualsXmlString(string|DOMDocument $expectedXml, string|DOMDocument $actualXml, string $message = '')

Asserts that two XML documents are not equal.

from Assert
static 
assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement, bool $checkAttributes = false, string $message = '')

Asserts that a hierarchy of DOMElements matches.

from Assert
static 
assertThat(mixed $value, Constraint $constraint, string $message = '')

Evaluates a PHPUnit\Framework\Constraint matcher object.

from Assert
static 
assertJson(string $actualJson, string $message = '')

Asserts that a string is a valid JSON string.

from Assert
static 
assertJsonStringEqualsJsonString(string $expectedJson, string $actualJson, string $message = '')

Asserts that two given JSON encoded objects or arrays are equal.

from Assert
static 
assertJsonStringNotEqualsJsonString(string $expectedJson, string $actualJson, string $message = '')

Asserts that two given JSON encoded objects or arrays are not equal.

from Assert
static 
assertJsonStringEqualsJsonFile(string $expectedFile, string $actualJson, string $message = '')

Asserts that the generated JSON encoded object and the content of the given file are equal.

from Assert
static 
assertJsonStringNotEqualsJsonFile(string $expectedFile, string $actualJson, string $message = '')

Asserts that the generated JSON encoded object and the content of the given file are not equal.

from Assert
static 
assertJsonFileEqualsJsonFile(string $expectedFile, string $actualFile, string $message = '')

Asserts that two JSON files are equal.

from Assert
static 
assertJsonFileNotEqualsJsonFile(string $expectedFile, string $actualFile, string $message = '')

Asserts that two JSON files are not equal.

from Assert
static LogicalAnd
logicalAnd()

No description

from Assert
static LogicalOr
logicalOr()

No description

from Assert
static LogicalNot
logicalNot(Constraint $constraint)

No description

from Assert
static LogicalXor
logicalXor()

No description

from Assert
static IsAnything
anything()

No description

from Assert
static IsTrue
isTrue()

No description

from Assert
static Callback
callback(callable $callback)

No description

from Assert
static IsFalse
isFalse()

No description

from Assert
static IsJson
isJson()

No description

from Assert
static IsNull
isNull()

No description

from Assert
static IsFinite
isFinite()

No description

from Assert
static IsInfinite
isInfinite()

No description

from Assert
static IsNan
isNan()

No description

from Assert
static Attribute
attribute(Constraint $constraint, string $attributeName)

No description

from Assert
contains(mixed $value, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false)

No description

from Assert
containsOnly(string $type)

No description

from Assert
containsOnlyInstancesOf(string $classname)

No description

from Assert
static ArrayHasKey
arrayHasKey(mixed $key)

No description

from Assert
static IsEqual
equalTo(mixed $value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false)

No description

from Assert
static Attribute
attributeEqualTo(string $attributeName, mixed $value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false)

No description

from Assert
static IsEmpty
isEmpty()

No description

from Assert
static IsWritable
isWritable()

No description

from Assert
static IsReadable
isReadable()

No description

from Assert
static DirectoryExists
directoryExists()

No description

from Assert
static FileExists
fileExists()

No description

from Assert
static GreaterThan
greaterThan(mixed $value)

No description

from Assert
static LogicalOr
greaterThanOrEqual(mixed $value)

No description

from Assert
classHasAttribute(string $attributeName)

No description

from Assert
classHasStaticAttribute(string $attributeName)

No description

from Assert
objectHasAttribute(string $attributeName)

No description

from Assert
static IsIdentical
identicalTo(mixed $value)

No description

from Assert
static IsInstanceOf
isInstanceOf(string $className)

No description

from Assert
static IsType
isType(string $type)

No description

from Assert
static LessThan
lessThan(mixed $value)

No description

from Assert
static LogicalOr
lessThanOrEqual(mixed $value)

No description

from Assert
matchesRegularExpression(string $pattern)

No description

from Assert
matches(string $string)

No description

from Assert
stringStartsWith(mixed $prefix)

No description

from Assert
static StringContains
stringContains(string $string, bool $case = true)

No description

from Assert
static StringEndsWith
stringEndsWith(mixed $suffix)

No description

from Assert
static Count
countOf(int $count)

No description

from Assert
static 
fail(string $message = '')

Fails a test with the given message.

from Assert
static mixed
readAttribute(string|object $classOrObject, string $attributeName)

Returns the value of an attribute of a class or an object.

from Assert
static mixed
getStaticAttribute(string $className, string $attributeName)

Returns the value of a static attribute.

from Assert
static mixed
getObjectAttribute(object $object, string $attributeName)

Returns the value of an object's attribute.

from Assert
static 
markTestIncomplete(string $message = '')

Mark the test as incomplete.

from Assert
static 
markTestSkipped(string $message = '')

Mark the test as skipped.

from Assert
static int
getCount()

Return the current assertion count.

from Assert
static 
resetCount()

Reset the assertion counter.

from Assert
__construct(string $message = '')

No description

string
toString()

Returns a string representation of the test case.

int
count()

Counts the number of test cases executed by run(TestResult result).

from TestCase
getGroups()

No description

from TestCase
setGroups(array $groups)

No description

from TestCase
array
getAnnotations()

Returns the annotations for this test.

from TestCase
string
getName(bool $withDataSet = true)

Gets the name of a TestCase.

from TestCase
int
getSize()

Returns the size of the test.

from TestCase
bool
hasSize()

No description

from TestCase
bool
isSmall()

No description

from TestCase
bool
isMedium()

No description

from TestCase
bool
isLarge()

No description

from TestCase
string
getActualOutput()

No description

from TestCase
bool
hasOutput()

No description

from TestCase
bool
doesNotPerformAssertions()

No description

from TestCase
expectOutputRegex(string $expectedRegex)

No description

from TestCase
expectOutputString(string $expectedString)

No description

from TestCase
bool
hasExpectationOnOutput()

No description

from TestCase
null|string
getExpectedException()

No description

from TestCase
null|int|string
getExpectedExceptionCode()

No description

from TestCase
string
getExpectedExceptionMessage()

No description

from TestCase
string
from TestCase
expectException(string $exception)

No description

from TestCase
expectExceptionCode(int|string $code)

No description

from TestCase
expectExceptionMessage(string $message)

No description

from TestCase
expectExceptionMessageRegExp(string $messageRegExp)

No description

from TestCase
expectExceptionObject(Exception $exception)

Sets up an expectation for an exception to be raised by the code under test.

from TestCase
setUseErrorHandler(bool $useErrorHandler)

No description

from TestCase
checkRequirements()

No description

from TestCase
int
getStatus()

Returns the status of this test.

from TestCase
markAsRisky()

No description

from TestCase
string
getStatusMessage()

Returns the status message of this test.

from TestCase
bool
hasFailed()

Returns whether or not this test has failed.

from TestCase
run(TestResult $result = null)

Runs the test case and collects the results in a TestResult object.

from TestCase
runBare()

Runs the bare test sequence.

from TestCase
mixed
runTest()

No description

verifyMockObjects()

Verifies the mock object expectations.

from TestCase
setName(string $name)

Sets the name of a TestCase.

from TestCase
setDependencies(array $dependencies)

Sets the dependencies of a TestCase.

from TestCase
bool
hasDependencies()

Returns true if the tests has dependencies

from TestCase
setDependencyInput(array $dependencyInput)

Sets

from TestCase
setBeStrictAboutChangesToGlobalState(bool $beStrictAboutChangesToGlobalState)

No description

from TestCase
setBackupGlobals(bool $backupGlobals)

Calling this method in setUp() has no effect!

from TestCase
setBackupStaticAttributes(bool $backupStaticAttributes)

Calling this method in setUp() has no effect!

from TestCase
setRunTestInSeparateProcess(bool $runTestInSeparateProcess)

No description

from TestCase
setRunClassInSeparateProcess(bool $runClassInSeparateProcess)

No description

from TestCase
setPreserveGlobalState(bool $preserveGlobalState)

No description

from TestCase
setInIsolation(bool $inIsolation)

No description

from TestCase
bool
isInIsolation()

No description

from TestCase
mixed
getResult()

No description

from TestCase
setResult(mixed $result)

No description

from TestCase
setOutputCallback(callable $callback)

No description

from TestCase
getTestResultObject()

No description

from TestCase
setTestResultObject(TestResult $result)

No description

from TestCase
registerMockObject(PHPUnit_Framework_MockObject_MockObject $mockObject)

No description

from TestCase
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.

from TestCase
setLocale()

This method is a wrapper for the setlocale() function that automatically resets the locale to its original value after the test is run.

from TestCase
PHPUnit_Framework_MockObject_MockBuilder
getMockBuilder(string|string[] $className)

Returns a builder object to create mock objects using a fluent interface.

from TestCase
PHPUnit_Framework_MockObject_MockObject
createMock(string $originalClassName)

Returns a test double for the specified class.

from TestCase
PHPUnit_Framework_MockObject_MockObject
createConfiguredMock(string $originalClassName, array $configuration)

Returns a configured test double for the specified class.

from TestCase
PHPUnit_Framework_MockObject_MockObject
createPartialMock(string $originalClassName, array $methods)

Returns a partial test double for the specified class.

from TestCase
PHPUnit_Framework_MockObject_MockObject
createTestProxy(string $originalClassName, array $constructorArguments = [])

Returns a test proxy for the specified class.

from TestCase
string
getMockClass(string $originalClassName, array $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = false, bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = false)

Mocks the specified class and returns the name of the mocked class.

from TestCase
PHPUnit_Framework_MockObject_MockObject
getMockForAbstractClass(string $originalClassName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, array $mockedMethods = [], bool $cloneArguments = false)

Returns a mock object for the specified abstract class with all abstract methods of the class mocked. Concrete methods are not mocked by default.

from TestCase
PHPUnit_Framework_MockObject_MockObject
getMockFromWsdl(string $wsdlFile, string $originalClassName = '', string $mockClassName = '', array $methods = [], bool $callOriginalConstructor = true, array $options = [])

Returns a mock object based on the given WSDL file.

from TestCase
PHPUnit_Framework_MockObject_MockObject
getMockForTrait(string $traitName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, array $mockedMethods = [], bool $cloneArguments = false)

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.

from TestCase
object
getObjectForTrait(string $traitName, array $arguments = [], string $traitClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true)

Returns an object for the specified trait.

from TestCase
ObjectProphecy
prophesize(string|null $classOrInterface = null)

No description

from TestCase
addToAssertionCount(int $count)

Adds a value to the assertion counter.

from TestCase
int
getNumAssertions()

Returns the number of assertions performed by this test.

from TestCase
static PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount
any()

Returns a matcher that matches when the method is executed zero or more times.

from TestCase
static PHPUnit_Framework_MockObject_Matcher_InvokedCount
never()

Returns a matcher that matches when the method is never executed.

from TestCase
static PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastCount
atLeast(int $requiredInvocations)

Returns a matcher that matches when the method is executed at least N times.

from TestCase
static PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce
atLeastOnce()

Returns a matcher that matches when the method is executed at least once.

from TestCase
static PHPUnit_Framework_MockObject_Matcher_InvokedCount
once()

Returns a matcher that matches when the method is executed exactly once.

from TestCase
static PHPUnit_Framework_MockObject_Matcher_InvokedCount
exactly(int $count)

Returns a matcher that matches when the method is executed exactly $count times.

from TestCase
static PHPUnit_Framework_MockObject_Matcher_InvokedAtMostCount
atMost(int $allowedInvocations)

Returns a matcher that matches when the method is executed at most N times.

from TestCase
static PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex
at(int $index)

Returns a matcher that matches when the method is executed at the given index.

from TestCase
static PHPUnit_Framework_MockObject_Stub_Return
returnValue(mixed $value)

No description

from TestCase
static PHPUnit_Framework_MockObject_Stub_ReturnValueMap
returnValueMap(array $valueMap)

No description

from TestCase
static PHPUnit_Framework_MockObject_Stub_ReturnArgument
returnArgument(int $argumentIndex)

No description

from TestCase
static PHPUnit_Framework_MockObject_Stub_ReturnCallback
returnCallback(mixed $callback)

No description

from TestCase
static PHPUnit_Framework_MockObject_Stub_ReturnSelf
returnSelf()

Returns the current object.

from TestCase
static PHPUnit_Framework_MockObject_Stub_Exception
throwException(Throwable $exception)

No description

from TestCase
static PHPUnit_Framework_MockObject_Stub_ConsecutiveCalls
onConsecutiveCalls()

No description

from TestCase
bool
usesDataProvider()

No description

from TestCase
string
dataDescription()

No description

from TestCase
registerComparator(Comparator $comparator)

No description

from TestCase
string
getDataSetAsString(bool $includeData = true)

Gets the data set description of a TestCase.

from TestCase
array
getProvidedData()

Gets the data set of a TestCase.

from TestCase
createResult()

Creates a default TestResult object.

from TestCase
handleDependencies()

No description

from TestCase
static 
setUpBeforeClass()

This method is called before the first test of this test class is run.

from TestCase
setUp()

Sets up the fixture, for example, open a network connection.

from TestCase
assertPreConditions()

Performs assertions shared by all tests of a test case.

from TestCase
assertPostConditions()

Performs assertions shared by all tests of a test case.

from TestCase
tearDown()

Tears down the fixture, for example, close a network connection.

from TestCase
static 
tearDownAfterClass()

This method is called after the last test of this test class is run.

from TestCase
onNotSuccessfulTest(Throwable $t)

This method is called when a test method did not execute successfully.

from TestCase
prepareTemplate(Text_Template $template)

Performs custom preparations on the process isolation template.

from TestCase
string
getMessage()

No description

Details

static assertArrayHasKey(mixed $key, array|ArrayAccess $array, string $message = '')

Asserts that an array has a specified key.

Parameters

mixed $key
array|ArrayAccess $array
string $message

static assertArraySubset(array|ArrayAccess $subset, array|ArrayAccess $array, bool $strict = false, string $message = '')

Asserts that an array has a specified subset.

Parameters

array|ArrayAccess $subset
array|ArrayAccess $array
bool $strict Check for object identity
string $message

static assertArrayNotHasKey(mixed $key, array|ArrayAccess $array, string $message = '')

Asserts that an array does not have a specified key.

Parameters

mixed $key
array|ArrayAccess $array
string $message

static assertContains(mixed $needle, mixed $haystack, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false)

Asserts that a haystack contains a needle.

Parameters

mixed $needle
mixed $haystack
string $message
bool $ignoreCase
bool $checkForObjectIdentity
bool $checkForNonObjectIdentity

static assertAttributeContains(mixed $needle, string $haystackAttributeName, string|object $haystackClassOrObject, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false)

Asserts that a haystack that is stored in a static attribute of a class or an attribute of an object contains a needle.

Parameters

mixed $needle
string $haystackAttributeName
string|object $haystackClassOrObject
string $message
bool $ignoreCase
bool $checkForObjectIdentity
bool $checkForNonObjectIdentity

static assertNotContains(mixed $needle, mixed $haystack, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false)

Asserts that a haystack does not contain a needle.

Parameters

mixed $needle
mixed $haystack
string $message
bool $ignoreCase
bool $checkForObjectIdentity
bool $checkForNonObjectIdentity

static assertAttributeNotContains(mixed $needle, string $haystackAttributeName, string|object $haystackClassOrObject, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false)

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

mixed $needle
string $haystackAttributeName
string|object $haystackClassOrObject
string $message
bool $ignoreCase
bool $checkForObjectIdentity
bool $checkForNonObjectIdentity

static assertContainsOnly(string $type, mixed $haystack, bool $isNativeType = null, string $message = '')

Asserts that a haystack contains only values of a given type.

Parameters

string $type
mixed $haystack
bool $isNativeType
string $message

static assertContainsOnlyInstancesOf(string $classname, array|Traversable $haystack, string $message = '')

Asserts that a haystack contains only instances of a given classname

Parameters

string $classname
array|Traversable $haystack
string $message

static assertAttributeContainsOnly(string $type, string $haystackAttributeName, string|object $haystackClassOrObject, bool $isNativeType = null, 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.

Parameters

string $type
string $haystackAttributeName
string|object $haystackClassOrObject
bool $isNativeType
string $message

static assertNotContainsOnly(string $type, mixed $haystack, bool $isNativeType = null, string $message = '')

Asserts that a haystack does not contain only values of a given type.

Parameters

string $type
mixed $haystack
bool $isNativeType
string $message

static assertAttributeNotContainsOnly(string $type, string $haystackAttributeName, string|object $haystackClassOrObject, bool $isNativeType = null, 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.

Parameters

string $type
string $haystackAttributeName
string|object $haystackClassOrObject
bool $isNativeType
string $message

static assertCount(int $expectedCount, mixed $haystack, string $message = '')

Asserts the number of elements of an array, Countable or Traversable.

Parameters

int $expectedCount
mixed $haystack
string $message

static assertAttributeCount(int $expectedCount, string $haystackAttributeName, string|object $haystackClassOrObject, string $message = '')

Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.

Parameters

int $expectedCount
string $haystackAttributeName
string|object $haystackClassOrObject
string $message

static assertNotCount(int $expectedCount, mixed $haystack, string $message = '')

Asserts the number of elements of an array, Countable or Traversable.

Parameters

int $expectedCount
mixed $haystack
string $message

static assertAttributeNotCount(int $expectedCount, string $haystackAttributeName, string|object $haystackClassOrObject, string $message = '')

Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute.

Parameters

int $expectedCount
string $haystackAttributeName
string|object $haystackClassOrObject
string $message

static assertEquals(mixed $expected, mixed $actual, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false)

Asserts that two variables are equal.

Parameters

mixed $expected
mixed $actual
string $message
float $delta
int $maxDepth
bool $canonicalize
bool $ignoreCase

static assertAttributeEquals(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false)

Asserts that a variable is equal to an attribute of an object.

Parameters

mixed $expected
string $actualAttributeName
string|object $actualClassOrObject
string $message
float $delta
int $maxDepth
bool $canonicalize
bool $ignoreCase

static assertNotEquals(mixed $expected, mixed $actual, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false)

Asserts that two variables are not equal.

Parameters

mixed $expected
mixed $actual
string $message
float $delta
int $maxDepth
bool $canonicalize
bool $ignoreCase

static assertAttributeNotEquals(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false)

Asserts that a variable is not equal to an attribute of an object.

Parameters

mixed $expected
string $actualAttributeName
string|object $actualClassOrObject
string $message
float $delta
int $maxDepth
bool $canonicalize
bool $ignoreCase

static assertEmpty(mixed $actual, string $message = '')

Asserts that a variable is empty.

Parameters

mixed $actual
string $message

Exceptions

AssertionFailedError

static assertAttributeEmpty(string $haystackAttributeName, string|object $haystackClassOrObject, string $message = '')

Asserts that a static attribute of a class or an attribute of an object is empty.

Parameters

string $haystackAttributeName
string|object $haystackClassOrObject
string $message

static assertNotEmpty(mixed $actual, string $message = '')

Asserts that a variable is not empty.

Parameters

mixed $actual
string $message

Exceptions

AssertionFailedError

static assertAttributeNotEmpty(string $haystackAttributeName, string|object $haystackClassOrObject, string $message = '')

Asserts that a static attribute of a class or an attribute of an object is not empty.

Parameters

string $haystackAttributeName
string|object $haystackClassOrObject
string $message

static assertGreaterThan(mixed $expected, mixed $actual, string $message = '')

Asserts that a value is greater than another value.

Parameters

mixed $expected
mixed $actual
string $message

static assertAttributeGreaterThan(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '')

Asserts that an attribute is greater than another value.

Parameters

mixed $expected
string $actualAttributeName
string|object $actualClassOrObject
string $message

static assertGreaterThanOrEqual(mixed $expected, mixed $actual, string $message = '')

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

Parameters

mixed $expected
mixed $actual
string $message

static assertAttributeGreaterThanOrEqual(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '')

Asserts that an attribute is greater than or equal to another value.

Parameters

mixed $expected
string $actualAttributeName
string|object $actualClassOrObject
string $message

static assertLessThan(mixed $expected, mixed $actual, string $message = '')

Asserts that a value is smaller than another value.

Parameters

mixed $expected
mixed $actual
string $message

static assertAttributeLessThan(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '')

Asserts that an attribute is smaller than another value.

Parameters

mixed $expected
string $actualAttributeName
string|object $actualClassOrObject
string $message

static assertLessThanOrEqual(mixed $expected, mixed $actual, string $message = '')

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

Parameters

mixed $expected
mixed $actual
string $message

static assertAttributeLessThanOrEqual(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '')

Asserts that an attribute is smaller than or equal to another value.

Parameters

mixed $expected
string $actualAttributeName
string|object $actualClassOrObject
string $message

static assertFileEquals(string $expected, string $actual, string $message = '', bool $canonicalize = false, bool $ignoreCase = false)

Asserts that the contents of one file is equal to the contents of another file.

Parameters

string $expected
string $actual
string $message
bool $canonicalize
bool $ignoreCase

static assertFileNotEquals(string $expected, string $actual, string $message = '', bool $canonicalize = false, bool $ignoreCase = false)

Asserts that the contents of one file is not equal to the contents of another file.

Parameters

string $expected
string $actual
string $message
bool $canonicalize
bool $ignoreCase

static assertStringEqualsFile(string $expectedFile, string $actualString, string $message = '', bool $canonicalize = false, bool $ignoreCase = false)

Asserts that the contents of a string is equal to the contents of a file.

Parameters

string $expectedFile
string $actualString
string $message
bool $canonicalize
bool $ignoreCase

static assertStringNotEqualsFile(string $expectedFile, string $actualString, string $message = '', bool $canonicalize = false, bool $ignoreCase = false)

Asserts that the contents of a string is not equal to the contents of a file.

Parameters

string $expectedFile
string $actualString
string $message
bool $canonicalize
bool $ignoreCase

static assertIsReadable(string $filename, string $message = '')

Asserts that a file/dir is readable.

Parameters

string $filename
string $message

static assertNotIsReadable(string $filename, string $message = '')

Asserts that a file/dir exists and is not readable.

Parameters

string $filename
string $message

static assertIsWritable(string $filename, string $message = '')

Asserts that a file/dir exists and is writable.

Parameters

string $filename
string $message

static assertNotIsWritable(string $filename, string $message = '')

Asserts that a file/dir exists and is not writable.

Parameters

string $filename
string $message

static assertDirectoryExists(string $directory, string $message = '')

Asserts that a directory exists.

Parameters

string $directory
string $message

static assertDirectoryNotExists(string $directory, string $message = '')

Asserts that a directory does not exist.

Parameters

string $directory
string $message

static assertDirectoryIsReadable(string $directory, string $message = '')

Asserts that a directory exists and is readable.

Parameters

string $directory
string $message

static assertDirectoryNotIsReadable(string $directory, string $message = '')

Asserts that a directory exists and is not readable.

Parameters

string $directory
string $message

static assertDirectoryIsWritable(string $directory, string $message = '')

Asserts that a directory exists and is writable.

Parameters

string $directory
string $message

static assertDirectoryNotIsWritable(string $directory, string $message = '')

Asserts that a directory exists and is not writable.

Parameters

string $directory
string $message

static assertFileExists(string $filename, string $message = '')

Asserts that a file exists.

Parameters

string $filename
string $message

static assertFileNotExists(string $filename, string $message = '')

Asserts that a file does not exist.

Parameters

string $filename
string $message

static assertFileIsReadable(string $file, string $message = '')

Asserts that a file exists and is readable.

Parameters

string $file
string $message

static assertFileNotIsReadable(string $file, string $message = '')

Asserts that a file exists and is not readable.

Parameters

string $file
string $message

static assertFileIsWritable(string $file, string $message = '')

Asserts that a file exists and is writable.

Parameters

string $file
string $message

static assertFileNotIsWritable(string $file, string $message = '')

Asserts that a file exists and is not writable.

Parameters

string $file
string $message

static assertTrue(bool $condition, string $message = '')

Asserts that a condition is true.

Parameters

bool $condition
string $message

Exceptions

AssertionFailedError

static assertNotTrue(bool $condition, string $message = '')

Asserts that a condition is not true.

Parameters

bool $condition
string $message

Exceptions

AssertionFailedError

static assertFalse(bool $condition, string $message = '')

Asserts that a condition is false.

Parameters

bool $condition
string $message

Exceptions

AssertionFailedError

static assertNotFalse(bool $condition, string $message = '')

Asserts that a condition is not false.

Parameters

bool $condition
string $message

Exceptions

AssertionFailedError

static assertNull(mixed $actual, string $message = '')

Asserts that a variable is null.

Parameters

mixed $actual
string $message

static assertNotNull(mixed $actual, string $message = '')

Asserts that a variable is not null.

Parameters

mixed $actual
string $message

static assertFinite(mixed $actual, string $message = '')

Asserts that a variable is finite.

Parameters

mixed $actual
string $message

static assertInfinite(mixed $actual, string $message = '')

Asserts that a variable is infinite.

Parameters

mixed $actual
string $message

static assertNan(mixed $actual, string $message = '')

Asserts that a variable is nan.

Parameters

mixed $actual
string $message

static assertClassHasAttribute(string $attributeName, string $className, string $message = '')

Asserts that a class has a specified attribute.

Parameters

string $attributeName
string $className
string $message

static assertClassNotHasAttribute(string $attributeName, string $className, string $message = '')

Asserts that a class does not have a specified attribute.

Parameters

string $attributeName
string $className
string $message

static assertClassHasStaticAttribute(string $attributeName, string $className, string $message = '')

Asserts that a class has a specified static attribute.

Parameters

string $attributeName
string $className
string $message

static assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = '')

Asserts that a class does not have a specified static attribute.

Parameters

string $attributeName
string $className
string $message

static assertObjectHasAttribute(string $attributeName, object $object, string $message = '')

Asserts that an object has a specified attribute.

Parameters

string $attributeName
object $object
string $message

static assertObjectNotHasAttribute(string $attributeName, object $object, string $message = '')

Asserts that an object does not have a specified attribute.

Parameters

string $attributeName
object $object
string $message

static 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.

Parameters

mixed $expected
mixed $actual
string $message

static assertAttributeSame(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '')

Asserts that a variable and an attribute of an object have the same type and value.

Parameters

mixed $expected
string $actualAttributeName
string|object $actualClassOrObject
string $message

static 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.

Parameters

mixed $expected
mixed $actual
string $message

static assertAttributeNotSame(mixed $expected, string $actualAttributeName, string|object $actualClassOrObject, string $message = '')

Asserts that a variable and an attribute of an object do not have the same type and value.

Parameters

mixed $expected
string $actualAttributeName
string|object $actualClassOrObject
string $message

static assertInstanceOf(string $expected, mixed $actual, string $message = '')

Asserts that a variable is of a given type.

Parameters

string $expected
mixed $actual
string $message

static assertAttributeInstanceOf(string $expected, string $attributeName, string|object $classOrObject, string $message = '')

Asserts that an attribute is of a given type.

Parameters

string $expected
string $attributeName
string|object $classOrObject
string $message

static assertNotInstanceOf(string $expected, mixed $actual, string $message = '')

Asserts that a variable is not of a given type.

Parameters

string $expected
mixed $actual
string $message

static assertAttributeNotInstanceOf(string $expected, string $attributeName, string|object $classOrObject, string $message = '')

Asserts that an attribute is of a given type.

Parameters

string $expected
string $attributeName
string|object $classOrObject
string $message

static assertInternalType(string $expected, mixed $actual, string $message = '')

Asserts that a variable is of a given type.

Parameters

string $expected
mixed $actual
string $message

static assertAttributeInternalType(string $expected, string $attributeName, string|object $classOrObject, string $message = '')

Asserts that an attribute is of a given type.

Parameters

string $expected
string $attributeName
string|object $classOrObject
string $message

static assertNotInternalType(string $expected, mixed $actual, string $message = '')

Asserts that a variable is not of a given type.

Parameters

string $expected
mixed $actual
string $message

static assertAttributeNotInternalType(string $expected, string $attributeName, string|object $classOrObject, string $message = '')

Asserts that an attribute is of a given type.

Parameters

string $expected
string $attributeName
string|object $classOrObject
string $message

static assertRegExp(string $pattern, string $string, string $message = '')

Asserts that a string matches a given regular expression.

Parameters

string $pattern
string $string
string $message

static assertNotRegExp(string $pattern, string $string, string $message = '')

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

Parameters

string $pattern
string $string
string $message

static assertSameSize(array|Countable|Traversable $expected, array|Countable|Traversable $actual, string $message = '')

Assert that the size of two arrays (or Countable or Traversable objects) is the same.

Parameters

array|Countable|Traversable $expected
array|Countable|Traversable $actual
string $message

static assertNotSameSize(array|Countable|Traversable $expected, array|Countable|Traversable $actual, string $message = '')

Assert that the size of two arrays (or Countable or Traversable objects) is not the same.

Parameters

array|Countable|Traversable $expected
array|Countable|Traversable $actual
string $message

static assertStringMatchesFormat(string $format, string $string, string $message = '')

Asserts that a string matches a given format string.

Parameters

string $format
string $string
string $message

static assertStringNotMatchesFormat(string $format, string $string, string $message = '')

Asserts that a string does not match a given format string.

Parameters

string $format
string $string
string $message

static assertStringMatchesFormatFile(string $formatFile, string $string, string $message = '')

Asserts that a string matches a given format file.

Parameters

string $formatFile
string $string
string $message

static assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message = '')

Asserts that a string does not match a given format string.

Parameters

string $formatFile
string $string
string $message

static assertStringStartsWith(string $prefix, string $string, string $message = '')

Asserts that a string starts with a given prefix.

Parameters

string $prefix
string $string
string $message

static assertStringStartsNotWith(string $prefix, string $string, string $message = '')

Asserts that a string starts not with a given prefix.

Parameters

string $prefix
string $string
string $message

static assertStringEndsWith(string $suffix, string $string, string $message = '')

Asserts that a string ends with a given suffix.

Parameters

string $suffix
string $string
string $message

static assertStringEndsNotWith(string $suffix, string $string, string $message = '')

Asserts that a string ends not with a given suffix.

Parameters

string $suffix
string $string
string $message

static assertXmlFileEqualsXmlFile(string $expectedFile, string $actualFile, string $message = '')

Asserts that two XML files are equal.

Parameters

string $expectedFile
string $actualFile
string $message

static assertXmlFileNotEqualsXmlFile(string $expectedFile, string $actualFile, string $message = '')

Asserts that two XML files are not equal.

Parameters

string $expectedFile
string $actualFile
string $message

static assertXmlStringEqualsXmlFile(string $expectedFile, string|DOMDocument $actualXml, string $message = '')

Asserts that two XML documents are equal.

Parameters

string $expectedFile
string|DOMDocument $actualXml
string $message

static assertXmlStringNotEqualsXmlFile(string $expectedFile, string|DOMDocument $actualXml, string $message = '')

Asserts that two XML documents are not equal.

Parameters

string $expectedFile
string|DOMDocument $actualXml
string $message

static assertXmlStringEqualsXmlString(string|DOMDocument $expectedXml, string|DOMDocument $actualXml, string $message = '')

Asserts that two XML documents are equal.

Parameters

string|DOMDocument $expectedXml
string|DOMDocument $actualXml
string $message

static assertXmlStringNotEqualsXmlString(string|DOMDocument $expectedXml, string|DOMDocument $actualXml, string $message = '')

Asserts that two XML documents are not equal.

Parameters

string|DOMDocument $expectedXml
string|DOMDocument $actualXml
string $message

static assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement, bool $checkAttributes = false, string $message = '')

Asserts that a hierarchy of DOMElements matches.

Parameters

DOMElement $expectedElement
DOMElement $actualElement
bool $checkAttributes
string $message

static assertThat(mixed $value, Constraint $constraint, string $message = '')

Evaluates a PHPUnit\Framework\Constraint matcher object.

Parameters

mixed $value
Constraint $constraint
string $message

static assertJson(string $actualJson, string $message = '')

Asserts that a string is a valid JSON string.

Parameters

string $actualJson
string $message

static assertJsonStringEqualsJsonString(string $expectedJson, string $actualJson, string $message = '')

Asserts that two given JSON encoded objects or arrays are equal.

Parameters

string $expectedJson
string $actualJson
string $message

static assertJsonStringNotEqualsJsonString(string $expectedJson, string $actualJson, string $message = '')

Asserts that two given JSON encoded objects or arrays are not equal.

Parameters

string $expectedJson
string $actualJson
string $message

static assertJsonStringEqualsJsonFile(string $expectedFile, string $actualJson, string $message = '')

Asserts that the generated JSON encoded object and the content of the given file are equal.

Parameters

string $expectedFile
string $actualJson
string $message

static assertJsonStringNotEqualsJsonFile(string $expectedFile, string $actualJson, string $message = '')

Asserts that the generated JSON encoded object and the content of the given file are not equal.

Parameters

string $expectedFile
string $actualJson
string $message

static assertJsonFileEqualsJsonFile(string $expectedFile, string $actualFile, string $message = '')

Asserts that two JSON files are equal.

Parameters

string $expectedFile
string $actualFile
string $message

static assertJsonFileNotEqualsJsonFile(string $expectedFile, string $actualFile, string $message = '')

Asserts that two JSON files are not equal.

Parameters

string $expectedFile
string $actualFile
string $message

static LogicalAnd logicalAnd()

Return Value

LogicalAnd

static LogicalOr logicalOr()

Return Value

LogicalOr

static LogicalNot logicalNot(Constraint $constraint)

Parameters

Constraint $constraint

Return Value

LogicalNot

static LogicalXor logicalXor()

Return Value

LogicalXor

static IsAnything anything()

Return Value

IsAnything

static IsTrue isTrue()

Return Value

IsTrue

static Callback callback(callable $callback)

Parameters

callable $callback

Return Value

Callback

static IsFalse isFalse()

Return Value

IsFalse

static IsJson isJson()

Return Value

IsJson

static IsNull isNull()

Return Value

IsNull

static IsFinite isFinite()

Return Value

IsFinite

static IsInfinite isInfinite()

Return Value

IsInfinite

static IsNan isNan()

Return Value

IsNan

static Attribute attribute(Constraint $constraint, string $attributeName)

Parameters

Constraint $constraint
string $attributeName

Return Value

Attribute

static TraversableContains contains(mixed $value, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false)

Parameters

mixed $value
bool $checkForObjectIdentity
bool $checkForNonObjectIdentity

Return Value

TraversableContains

static TraversableContainsOnly containsOnly(string $type)

Parameters

string $type

Return Value

TraversableContainsOnly

static TraversableContainsOnly containsOnlyInstancesOf(string $classname)

Parameters

string $classname

Return Value

TraversableContainsOnly

static ArrayHasKey arrayHasKey(mixed $key)

Parameters

mixed $key

Return Value

ArrayHasKey

static IsEqual equalTo(mixed $value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false)

Parameters

mixed $value
float $delta
int $maxDepth
bool $canonicalize
bool $ignoreCase

Return Value

IsEqual

static Attribute attributeEqualTo(string $attributeName, mixed $value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false)

Parameters

string $attributeName
mixed $value
float $delta
int $maxDepth
bool $canonicalize
bool $ignoreCase

Return Value

Attribute

static IsEmpty isEmpty()

Return Value

IsEmpty

static IsWritable isWritable()

Return Value

IsWritable

static IsReadable isReadable()

Return Value

IsReadable

static DirectoryExists directoryExists()

Return Value

DirectoryExists

static FileExists fileExists()

Return Value

FileExists

static GreaterThan greaterThan(mixed $value)

Parameters

mixed $value

Return Value

GreaterThan

static LogicalOr greaterThanOrEqual(mixed $value)

Parameters

mixed $value

Return Value

LogicalOr

static ClassHasAttribute classHasAttribute(string $attributeName)

Parameters

string $attributeName

Return Value

ClassHasAttribute

static ClassHasStaticAttribute classHasStaticAttribute(string $attributeName)

Parameters

string $attributeName

Return Value

ClassHasStaticAttribute

static ObjectHasAttribute objectHasAttribute(string $attributeName)

Parameters

string $attributeName

Return Value

ObjectHasAttribute

static IsIdentical identicalTo(mixed $value)

Parameters

mixed $value

Return Value

IsIdentical

static IsInstanceOf isInstanceOf(string $className)

Parameters

string $className

Return Value

IsInstanceOf

static IsType isType(string $type)

Parameters

string $type

Return Value

IsType

static LessThan lessThan(mixed $value)

Parameters

mixed $value

Return Value

LessThan

static LogicalOr lessThanOrEqual(mixed $value)

Parameters

mixed $value

Return Value

LogicalOr

static RegularExpression matchesRegularExpression(string $pattern)

Parameters

string $pattern

Return Value

RegularExpression

static StringMatchesFormatDescription matches(string $string)

Parameters

string $string

Return Value

StringMatchesFormatDescription

static StringStartsWith stringStartsWith(mixed $prefix)

Parameters

mixed $prefix

Return Value

StringStartsWith

static StringContains stringContains(string $string, bool $case = true)

Parameters

string $string
bool $case

Return Value

StringContains

static StringEndsWith stringEndsWith(mixed $suffix)

Parameters

mixed $suffix

Return Value

StringEndsWith

static Count countOf(int $count)

Parameters

int $count

Return Value

Count

static fail(string $message = '')

Fails a test with the given message.

Parameters

string $message

Exceptions

AssertionFailedError

static mixed readAttribute(string|object $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

string|object $classOrObject
string $attributeName

Return Value

mixed

Exceptions

Exception

static mixed 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

Return Value

mixed

Exceptions

Exception

static mixed 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

Return Value

mixed

Exceptions

Exception

static markTestIncomplete(string $message = '')

Mark the test as incomplete.

Parameters

string $message

Exceptions

IncompleteTestError

static markTestSkipped(string $message = '')

Mark the test as skipped.

Parameters

string $message

Exceptions

SkippedTestError

static int getCount()

Return the current assertion count.

Return Value

int

static resetCount()

Reset the assertion counter.

__construct(string $message = '')

Parameters

string $message

string toString()

Returns a string representation of the test case.

Return Value

string

int count()

Counts the number of test cases executed by run(TestResult result).

Return Value

int

getGroups()

setGroups(array $groups)

Parameters

array $groups

array getAnnotations()

Returns the annotations for this test.

Return Value

array

string getName(bool $withDataSet = true)

Gets the name of a TestCase.

Parameters

bool $withDataSet

Return Value

string

int getSize()

Returns the size of the test.

Return Value

int

bool hasSize()

Return Value

bool

bool isSmall()

Return Value

bool

bool isMedium()

Return Value

bool

bool isLarge()

Return Value

bool

string getActualOutput()

Return Value

string

bool hasOutput()

Return Value

bool

bool doesNotPerformAssertions()

Return Value

bool

expectOutputRegex(string $expectedRegex)

Parameters

string $expectedRegex

Exceptions

Exception

expectOutputString(string $expectedString)

Parameters

string $expectedString

bool hasExpectationOnOutput()

Return Value

bool

null|string getExpectedException()

Return Value

null|string

null|int|string getExpectedExceptionCode()

Return Value

null|int|string

string getExpectedExceptionMessage()

Return Value

string

string getExpectedExceptionMessageRegExp()

Return Value

string

expectException(string $exception)

Parameters

string $exception

expectExceptionCode(int|string $code)

Parameters

int|string $code

Exceptions

Exception

expectExceptionMessage(string $message)

Parameters

string $message

Exceptions

Exception

expectExceptionMessageRegExp(string $messageRegExp)

Parameters

string $messageRegExp

Exceptions

Exception

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.

Parameters

Exception $exception

setRegisterMockObjectsFromTestArgumentsRecursively(bool $flag)

Parameters

bool $flag

protected setExpectedExceptionFromAnnotation()

setUseErrorHandler(bool $useErrorHandler)

Parameters

bool $useErrorHandler

protected setUseErrorHandlerFromAnnotation()

protected checkRequirements()

int getStatus()

Returns the status of this test.

Return Value

int

markAsRisky()

string getStatusMessage()

Returns the status message of this test.

Return Value

string

bool hasFailed()

Returns whether or not this test has failed.

Return Value

bool

TestResult run(TestResult $result = null)

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

Return Value

TestResult

Exceptions

Exception

runBare()

Runs the bare test sequence.

protected mixed runTest()

Return Value

mixed

Exceptions

Exception

protected verifyMockObjects()

Verifies the mock object expectations.

setName(string $name)

Sets the name of a TestCase.

Parameters

string $name

setDependencies(array $dependencies)

Sets the dependencies of a TestCase.

Parameters

array $dependencies

bool hasDependencies()

Returns true if the tests has dependencies

Return Value

bool

setDependencyInput(array $dependencyInput)

Sets

Parameters

array $dependencyInput

setBeStrictAboutChangesToGlobalState(bool $beStrictAboutChangesToGlobalState)

Parameters

bool $beStrictAboutChangesToGlobalState

setBackupGlobals(bool $backupGlobals)

Calling this method in setUp() has no effect!

Parameters

bool $backupGlobals

setBackupStaticAttributes(bool $backupStaticAttributes)

Calling this method in setUp() has no effect!

Parameters

bool $backupStaticAttributes

setRunTestInSeparateProcess(bool $runTestInSeparateProcess)

Parameters

bool $runTestInSeparateProcess

Exceptions

Exception

setRunClassInSeparateProcess(bool $runClassInSeparateProcess)

Parameters

bool $runClassInSeparateProcess

Exceptions

Exception

setPreserveGlobalState(bool $preserveGlobalState)

Parameters

bool $preserveGlobalState

Exceptions

Exception

setInIsolation(bool $inIsolation)

Parameters

bool $inIsolation

Exceptions

Exception

bool isInIsolation()

Return Value

bool

mixed getResult()

Return Value

mixed

setResult(mixed $result)

Parameters

mixed $result

setOutputCallback(callable $callback)

Parameters

callable $callback

Exceptions

Exception

TestResult getTestResultObject()

Return Value

TestResult

setTestResultObject(TestResult $result)

Parameters

TestResult $result

registerMockObject(PHPUnit_Framework_MockObject_MockObject $mockObject)

Parameters

PHPUnit_Framework_MockObject_MockObject $mockObject

protected 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.

Parameters

string $varName
string $newValue

Exceptions

Exception

protected setLocale()

This method is a wrapper for the setlocale() function that automatically resets the locale to its original value after the test is run.

Exceptions

Exception

PHPUnit_Framework_MockObject_MockBuilder getMockBuilder(string|string[] $className)

Returns a builder object to create mock objects using a fluent interface.

Parameters

string|string[] $className

Return Value

PHPUnit_Framework_MockObject_MockBuilder

protected PHPUnit_Framework_MockObject_MockObject createMock(string $originalClassName)

Returns a test double for the specified class.

Parameters

string $originalClassName

Return Value

PHPUnit_Framework_MockObject_MockObject

Exceptions

Exception

protected PHPUnit_Framework_MockObject_MockObject createConfiguredMock(string $originalClassName, array $configuration)

Returns a configured test double for the specified class.

Parameters

string $originalClassName
array $configuration

Return Value

PHPUnit_Framework_MockObject_MockObject

Exceptions

Exception

protected PHPUnit_Framework_MockObject_MockObject createPartialMock(string $originalClassName, array $methods)

Returns a partial test double for the specified class.

Parameters

string $originalClassName
array $methods

Return Value

PHPUnit_Framework_MockObject_MockObject

Exceptions

Exception

protected PHPUnit_Framework_MockObject_MockObject createTestProxy(string $originalClassName, array $constructorArguments = [])

Returns a test proxy for the specified class.

Parameters

string $originalClassName
array $constructorArguments

Return Value

PHPUnit_Framework_MockObject_MockObject

Exceptions

Exception

protected string getMockClass(string $originalClassName, array $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = false, bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = false)

Mocks the specified class and returns the name of the mocked class.

Parameters

string $originalClassName
array $methods
array $arguments
string $mockClassName
bool $callOriginalConstructor
bool $callOriginalClone
bool $callAutoload
bool $cloneArguments

Return Value

string

Exceptions

Exception

protected PHPUnit_Framework_MockObject_MockObject getMockForAbstractClass(string $originalClassName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, array $mockedMethods = [], bool $cloneArguments = false)

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
string $mockClassName
bool $callOriginalConstructor
bool $callOriginalClone
bool $callAutoload
array $mockedMethods
bool $cloneArguments

Return Value

PHPUnit_Framework_MockObject_MockObject

Exceptions

Exception

protected PHPUnit_Framework_MockObject_MockObject getMockFromWsdl(string $wsdlFile, string $originalClassName = '', string $mockClassName = '', array $methods = [], bool $callOriginalConstructor = true, array $options = [])

Returns a mock object based on the given WSDL file.

Parameters

string $wsdlFile
string $originalClassName
string $mockClassName
array $methods
bool $callOriginalConstructor
array $options An array of options passed to SOAPClient::_construct

Return Value

PHPUnit_Framework_MockObject_MockObject

protected PHPUnit_Framework_MockObject_MockObject getMockForTrait(string $traitName, array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, array $mockedMethods = [], bool $cloneArguments = false)

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
string $mockClassName
bool $callOriginalConstructor
bool $callOriginalClone
bool $callAutoload
array $mockedMethods
bool $cloneArguments

Return Value

PHPUnit_Framework_MockObject_MockObject

Exceptions

Exception

protected object getObjectForTrait(string $traitName, array $arguments = [], string $traitClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true)

Returns an object for the specified trait.

Parameters

string $traitName
array $arguments
string $traitClassName
bool $callOriginalConstructor
bool $callOriginalClone
bool $callAutoload

Return Value

object

Exceptions

Exception

protected ObjectProphecy prophesize(string|null $classOrInterface = null)

Parameters

string|null $classOrInterface

Return Value

ObjectProphecy

Exceptions

LogicException

addToAssertionCount(int $count)

Adds a value to the assertion counter.

Parameters

int $count

int getNumAssertions()

Returns the number of assertions performed by this test.

Return Value

int

static PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount any()

Returns a matcher that matches when the method is executed zero or more times.

Return Value

PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount

static PHPUnit_Framework_MockObject_Matcher_InvokedCount never()

Returns a matcher that matches when the method is never executed.

Return Value

PHPUnit_Framework_MockObject_Matcher_InvokedCount

static PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastCount atLeast(int $requiredInvocations)

Returns a matcher that matches when the method is executed at least N times.

Parameters

int $requiredInvocations

Return Value

PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastCount

static PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce atLeastOnce()

Returns a matcher that matches when the method is executed at least once.

Return Value

PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce

static PHPUnit_Framework_MockObject_Matcher_InvokedCount once()

Returns a matcher that matches when the method is executed exactly once.

Return Value

PHPUnit_Framework_MockObject_Matcher_InvokedCount

static PHPUnit_Framework_MockObject_Matcher_InvokedCount exactly(int $count)

Returns a matcher that matches when the method is executed exactly $count times.

Parameters

int $count

Return Value

PHPUnit_Framework_MockObject_Matcher_InvokedCount

static PHPUnit_Framework_MockObject_Matcher_InvokedAtMostCount atMost(int $allowedInvocations)

Returns a matcher that matches when the method is executed at most N times.

Parameters

int $allowedInvocations

Return Value

PHPUnit_Framework_MockObject_Matcher_InvokedAtMostCount

static PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex at(int $index)

Returns a matcher that matches when the method is executed at the given index.

Parameters

int $index

Return Value

PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex

static PHPUnit_Framework_MockObject_Stub_Return returnValue(mixed $value)

Parameters

mixed $value

Return Value

PHPUnit_Framework_MockObject_Stub_Return

static PHPUnit_Framework_MockObject_Stub_ReturnValueMap returnValueMap(array $valueMap)

Parameters

array $valueMap

Return Value

PHPUnit_Framework_MockObject_Stub_ReturnValueMap

static PHPUnit_Framework_MockObject_Stub_ReturnArgument returnArgument(int $argumentIndex)

Parameters

int $argumentIndex

Return Value

PHPUnit_Framework_MockObject_Stub_ReturnArgument

static PHPUnit_Framework_MockObject_Stub_ReturnCallback returnCallback(mixed $callback)

Parameters

mixed $callback

Return Value

PHPUnit_Framework_MockObject_Stub_ReturnCallback

static PHPUnit_Framework_MockObject_Stub_ReturnSelf returnSelf()

Returns the current object.

This method is useful when mocking a fluent interface.

Return Value

PHPUnit_Framework_MockObject_Stub_ReturnSelf

static PHPUnit_Framework_MockObject_Stub_Exception throwException(Throwable $exception)

Parameters

Throwable $exception

Return Value

PHPUnit_Framework_MockObject_Stub_Exception

static PHPUnit_Framework_MockObject_Stub_ConsecutiveCalls onConsecutiveCalls()

Return Value

PHPUnit_Framework_MockObject_Stub_ConsecutiveCalls

bool usesDataProvider()

Return Value

bool

string dataDescription()

Return Value

string

registerComparator(Comparator $comparator)

Parameters

Comparator $comparator

string getDataSetAsString(bool $includeData = true)

Gets the data set description of a TestCase.

Parameters

bool $includeData

Return Value

string

protected array getProvidedData()

Gets the data set of a TestCase.

Return Value

array

protected TestResult createResult()

Creates a default TestResult object.

Return Value

TestResult

protected handleDependencies()

static setUpBeforeClass()

This method is called before the first test of this test class is run.

protected setUp()

Sets up the fixture, for example, open a network connection.

This method is called before a test is executed.

protected assertPreConditions()

Performs assertions shared by all tests of a test case.

This method is called before the execution of a test starts and after setUp() is called.

protected assertPostConditions()

Performs assertions shared by all tests of a test case.

This method is called before the execution of a test ends and before tearDown() is called.

protected tearDown()

Tears down the fixture, for example, close a network connection.

This method is called after a test is executed.

static tearDownAfterClass()

This method is called after the last test of this test class is run.

protected onNotSuccessfulTest(Throwable $t)

This method is called when a test method did not execute successfully.

Parameters

Throwable $t

Exceptions

Throwable

protected prepareTemplate(Text_Template $template)

Performs custom preparations on the process isolation template.

Parameters

Text_Template $template

string getMessage()

Return Value

string