class PHPUnit_Framework_WarningTestCase extends PHPUnit_Framework_TestCase (View source)

A warning.

Properties

protected bool $backupGlobals
protected array $backupGlobalsBlacklist from PHPUnit_Framework_TestCase
protected bool $backupStaticAttributes
protected array $backupStaticAttributesBlacklist from PHPUnit_Framework_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 PHPUnit_Framework_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.

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

Asserts that an array has a specified subset.

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

Asserts that an array does not have a specified key.

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

Asserts that a haystack contains a needle.

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.

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.

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.

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

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

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

Asserts that a haystack contains only instances of a given classname

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.

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

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

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.

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

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

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.

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

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

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.

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.

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.

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.

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.

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

Asserts that a variable is empty.

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.

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

Asserts that a variable is not empty.

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.

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

Asserts that a value is greater than another value.

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

Asserts that an attribute is greater than another value.

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

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

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

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

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

Asserts that a value is smaller than another value.

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

Asserts that an attribute is smaller than another value.

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

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

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

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

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.

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.

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.

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.

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

Asserts that a file/dir is readable.

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

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

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

Asserts that a file/dir exists and is writable.

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

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

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

Asserts that a directory exists.

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

Asserts that a directory does not exist.

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

Asserts that a directory exists and is readable.

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

Asserts that a directory exists and is not readable.

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

Asserts that a directory exists and is writable.

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

Asserts that a directory exists and is not writable.

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

Asserts that a file exists.

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

Asserts that a file does not exist.

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

Asserts that a file exists and is readable.

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

Asserts that a file exists and is not readable.

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

Asserts that a file exists and is writable.

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

Asserts that a file exists and is not writable.

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

Asserts that a condition is true.

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

Asserts that a condition is not true.

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

Asserts that a condition is false.

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

Asserts that a condition is not false.

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

Asserts that a variable is null.

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

Asserts that a variable is not null.

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

Asserts that a variable is finite.

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

Asserts that a variable is infinite.

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

Asserts that a variable is nan.

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

Asserts that a class has a specified attribute.

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

Asserts that a class does not have a specified attribute.

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

Asserts that a class has a specified static attribute.

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

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

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

Asserts that an object has a specified attribute.

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

Asserts that an object does not have a specified attribute.

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

Asserts that two variables have the same type and value.

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.

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

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

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.

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

Asserts that a variable is of a given type.

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

Asserts that an attribute is of a given type.

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

Asserts that a variable is not of a given type.

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

Asserts that an attribute is of a given type.

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

Asserts that a variable is of a given type.

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

Asserts that an attribute is of a given type.

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

Asserts that a variable is not of a given type.

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

Asserts that an attribute is of a given type.

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

Asserts that a string matches a given regular expression.

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

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

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.

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.

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

Asserts that a string matches a given format string.

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

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

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

Asserts that a string matches a given format file.

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

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

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

Asserts that a string starts with a given prefix.

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

Asserts that a string starts not with a given prefix.

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

Asserts that a string ends with a given suffix.

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

Asserts that a string ends not with a given suffix.

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

Asserts that two XML files are equal.

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

Asserts that two XML files are not equal.

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

Asserts that two XML documents are equal.

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

Asserts that two XML documents are not equal.

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

Asserts that two XML documents are equal.

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

Asserts that two XML documents are not equal.

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

Asserts that a hierarchy of DOMElements matches.

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

Evaluates a PHPUnit_Framework_Constraint matcher object.

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

Asserts that a string is a valid JSON string.

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

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

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

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

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

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

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.

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

Asserts that two JSON files are equal.

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

Asserts that two JSON files are not equal.

logicalAnd()

Returns a PHPUnit_Framework_Constraint_And matcher object.

logicalOr()

Returns a PHPUnit_Framework_Constraint_Or matcher object.

logicalNot(PHPUnit_Framework_Constraint $constraint)

Returns a PHPUnit_Framework_Constraint_Not matcher object.

logicalXor()

Returns a PHPUnit_Framework_Constraint_Xor matcher object.

anything()

Returns a PHPUnit_Framework_Constraint_IsAnything matcher object.

isTrue()

Returns a PHPUnit_Framework_Constraint_IsTrue matcher object.

callback(callable $callback)

Returns a PHPUnit_Framework_Constraint_Callback matcher object.

isFalse()

Returns a PHPUnit_Framework_Constraint_IsFalse matcher object.

isJson()

Returns a PHPUnit_Framework_Constraint_IsJson matcher object.

isNull()

Returns a PHPUnit_Framework_Constraint_IsNull matcher object.

isFinite()

Returns a PHPUnit_Framework_Constraint_IsFinite matcher object.

isInfinite()

Returns a PHPUnit_Framework_Constraint_IsInfinite matcher object.

isNan()

Returns a PHPUnit_Framework_Constraint_IsNan matcher object.

attribute(PHPUnit_Framework_Constraint $constraint, string $attributeName)

Returns a PHPUnit_Framework_Constraint_Attribute matcher object.

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

Returns a PHPUnit_Framework_Constraint_TraversableContains matcher object.

containsOnly(string $type)

Returns a PHPUnit_Framework_Constraint_TraversableContainsOnly matcher object.

containsOnlyInstancesOf(string $classname)

Returns a PHPUnit_Framework_Constraint_TraversableContainsOnly matcher object.

arrayHasKey(mixed $key)

Returns a PHPUnit_Framework_Constraint_ArrayHasKey matcher object.

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

Returns a PHPUnit_Framework_Constraint_IsEqual matcher object.

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

Returns a PHPUnit_Framework_Constraint_IsEqual matcher object that is wrapped in a PHPUnit_Framework_Constraint_Attribute matcher object.

isEmpty()

Returns a PHPUnit_Framework_Constraint_IsEmpty matcher object.

isWritable()

Returns a PHPUnit_Framework_Constraint_IsWritable matcher object.

isReadable()

Returns a PHPUnit_Framework_Constraint_IsReadable matcher object.

directoryExists()

Returns a PHPUnit_Framework_Constraint_DirectoryExists matcher object.

fileExists()

Returns a PHPUnit_Framework_Constraint_FileExists matcher object.

greaterThan(mixed $value)

Returns a PHPUnit_Framework_Constraint_GreaterThan matcher object.

greaterThanOrEqual(mixed $value)

Returns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_GreaterThan matcher object.

classHasAttribute(string $attributeName)

Returns a PHPUnit_Framework_Constraint_ClassHasAttribute matcher object.

classHasStaticAttribute(string $attributeName)

Returns a PHPUnit_Framework_Constraint_ClassHasStaticAttribute matcher object.

objectHasAttribute(string $attributeName)

Returns a PHPUnit_Framework_Constraint_ObjectHasAttribute matcher object.

identicalTo(mixed $value)

Returns a PHPUnit_Framework_Constraint_IsIdentical matcher object.

isInstanceOf(string $className)

Returns a PHPUnit_Framework_Constraint_IsInstanceOf matcher object.

isType(string $type)

Returns a PHPUnit_Framework_Constraint_IsType matcher object.

lessThan(mixed $value)

Returns a PHPUnit_Framework_Constraint_LessThan matcher object.

lessThanOrEqual(mixed $value)

Returns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_LessThan matcher object.

matchesRegularExpression(string $pattern)

Returns a PHPUnit_Framework_Constraint_PCREMatch matcher object.

matches(string $string)

Returns a PHPUnit_Framework_Constraint_StringMatches matcher object.

stringStartsWith(mixed $prefix)

Returns a PHPUnit_Framework_Constraint_StringStartsWith matcher object.

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

Returns a PHPUnit_Framework_Constraint_StringContains matcher object.

stringEndsWith(mixed $suffix)

Returns a PHPUnit_Framework_Constraint_StringEndsWith matcher object.

countOf(int $count)

Returns a PHPUnit_Framework_Constraint_Count matcher object.

static 
fail(string $message = '')

Fails a test with the given message.

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

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

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

Returns the value of a static attribute.

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

Returns the value of an object's attribute.

static 
markTestIncomplete(string $message = '')

Mark the test as incomplete.

static 
markTestSkipped(string $message = '')

Mark the test as skipped.

static int
getCount()

Return the current assertion count.

static 
resetCount()

Reset the assertion counter.

__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).

getGroups()

No description

setGroups(array $groups)

No description

array
getAnnotations()

Returns the annotations for this test.

string
getName(bool $withDataSet = true)

Gets the name of a TestCase.

int
getSize()

Returns the size of the test.

bool
hasSize()

No description

bool
isSmall()

No description

bool
isMedium()

No description

bool
isLarge()

No description

string
getActualOutput()

No description

bool
hasOutput()

No description

expectOutputRegex(string $expectedRegex)

No description

expectOutputString(string $expectedString)

No description

bool
hasPerformedExpectationsOnOutput() deprecated

No description

string
getExpectedException()

No description

setExpectedException(mixed $exception, string $message = '', int|string $code = null) deprecated

No description

setExpectedExceptionRegExp(mixed $exception, string $messageRegExp = '', int $code = null) deprecated

No description

expectException(string $exception)

No description

expectExceptionCode(int|string $code)

No description

expectExceptionMessage(string $message)

No description

expectExceptionMessageRegExp(string $messageRegExp)

No description

setUseErrorHandler(bool $useErrorHandler)

No description

int
getStatus()

Returns the status of this test.

markAsRisky()

No description

string
getStatusMessage()

Returns the status message of this test.

bool
hasFailed()

Returns whether or not this test has failed.

run(PHPUnit_Framework_TestResult $result = null)

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

runBare()

Runs the bare test sequence.

mixed
runTest()

No description

verifyMockObjects()

Verifies the mock object expectations.

setName(string $name)

Sets the name of a TestCase.

setDependencies(array $dependencies)

Sets the dependencies of a TestCase.

bool
hasDependencies()

Returns true if the tests has dependencies

setDependencyInput(array $dependencyInput)

Sets

setBeStrictAboutChangesToGlobalState(bool $beStrictAboutChangesToGlobalState)

No description

setBackupGlobals(bool $backupGlobals)

Calling this method in setUp() has no effect!

setBackupStaticAttributes(bool $backupStaticAttributes)

Calling this method in setUp() has no effect!

setRunTestInSeparateProcess(bool $runTestInSeparateProcess)

No description

setPreserveGlobalState(bool $preserveGlobalState)

No description

setInIsolation(bool $inIsolation)

No description

bool
isInIsolation()

No description

mixed
getResult()

No description

setResult(mixed $result)

No description

setOutputCallback(callable $callback)

No description

registerMockObject(PHPUnit_Framework_MockObject_MockObject $mockObject)

No description

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.

setLocale()

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

PHPUnit_Framework_MockObject_MockBuilder
getMockBuilder(string|string[] $className)

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

PHPUnit_Framework_MockObject_MockObject
createMock(string $originalClassName)

Returns a test double for the specified class.

PHPUnit_Framework_MockObject_MockObject
createConfiguredMock(string $originalClassName, array $configuration)

Returns a configured test double for the specified class.

PHPUnit_Framework_MockObject_MockObject
createPartialMock(string $originalClassName, array $methods)

Returns a partial test double for the specified class.

PHPUnit_Framework_MockObject_MockObject
getMock(string $originalClassName, array|null $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = false, bool $callOriginalMethods = false, object $proxyTarget = null) deprecated

Returns a mock object for the specified class.

PHPUnit_Framework_MockObject_MockObject
getMockWithoutInvokingTheOriginalConstructor(string $originalClassName) deprecated

Returns a mock with disabled constructor object for the specified class.

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.

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.

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.

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.

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

Returns an object for the specified trait.

ObjectProphecy
prophesize(string|null $classOrInterface = null)

No description

addToAssertionCount(int $count)

Adds a value to the assertion counter.

int
getNumAssertions()

Returns the number of assertions performed by this test.

static PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount
any()

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

static PHPUnit_Framework_MockObject_Matcher_InvokedCount
never()

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

static PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastCount
atLeast(int $requiredInvocations)

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

static PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce
atLeastOnce()

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

static PHPUnit_Framework_MockObject_Matcher_InvokedCount
once()

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

static PHPUnit_Framework_MockObject_Matcher_InvokedCount
exactly(int $count)

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

static PHPUnit_Framework_MockObject_Matcher_InvokedAtMostCount
atMost(int $allowedInvocations)

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

static PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex
at(int $index)

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

static PHPUnit_Framework_MockObject_Stub_Return
returnValue(mixed $value)

No description

static PHPUnit_Framework_MockObject_Stub_ReturnValueMap
returnValueMap(array $valueMap)

No description

static PHPUnit_Framework_MockObject_Stub_ReturnArgument
returnArgument(int $argumentIndex)

No description

static PHPUnit_Framework_MockObject_Stub_ReturnCallback
returnCallback(mixed $callback)

No description

static PHPUnit_Framework_MockObject_Stub_ReturnSelf
returnSelf()

Returns the current object.

static PHPUnit_Framework_MockObject_Stub_Exception
throwException(Throwable|Exception $exception)

No description

static PHPUnit_Framework_MockObject_Stub_ConsecutiveCalls
onConsecutiveCalls()

No description

bool
usesDataProvider()

No description

string
dataDescription()

No description

string
getDataSetAsString(bool $includeData = true)

Gets the data set description of a TestCase.

array
getProvidedData()

Gets the data set of a TestCase.

createResult()

Creates a default TestResult object.

static 
setUpBeforeClass()

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

setUp()

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

assertPreConditions()

Performs assertions shared by all tests of a test case.

assertPostConditions()

Performs assertions shared by all tests of a test case.

tearDown()

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

static 
tearDownAfterClass()

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

onNotSuccessfulTest(Exception|Throwable $e)

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

prepareTemplate(Text_Template $template)

Performs custom preparations on the process isolation template.

PHPUnit_Framework_MockObject_Generator
getMockObjectGenerator()

Get the mock object generator, creating it if it doesn't exist.

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

PHPUnit_Framework_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

PHPUnit_Framework_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

PHPUnit_Framework_AssertionFailedError

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

Asserts that a condition is not true.

Parameters

bool $condition
string $message

Exceptions

PHPUnit_Framework_AssertionFailedError

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

Asserts that a condition is false.

Parameters

bool $condition
string $message

Exceptions

PHPUnit_Framework_AssertionFailedError

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

Asserts that a condition is not false.

Parameters

bool $condition
string $message

Exceptions

PHPUnit_Framework_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 $actualXml, string $message = '')

Asserts that two XML documents are equal.

Parameters

string $expectedFile
string $actualXml
string $message

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

Asserts that two XML documents are not equal.

Parameters

string $expectedFile
string $actualXml
string $message

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

Asserts that two XML documents are equal.

Parameters

string $expectedXml
string $actualXml
string $message

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

Asserts that two XML documents are not equal.

Parameters

string $expectedXml
string $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, PHPUnit_Framework_Constraint $constraint, string $message = '')

Evaluates a PHPUnit_Framework_Constraint matcher object.

Parameters

mixed $value
PHPUnit_Framework_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 PHPUnit_Framework_Constraint_And logicalAnd()

Returns a PHPUnit_Framework_Constraint_And matcher object.

static PHPUnit_Framework_Constraint_Or logicalOr()

Returns a PHPUnit_Framework_Constraint_Or matcher object.

static PHPUnit_Framework_Constraint_Not logicalNot(PHPUnit_Framework_Constraint $constraint)

Returns a PHPUnit_Framework_Constraint_Not matcher object.

static PHPUnit_Framework_Constraint_Xor logicalXor()

Returns a PHPUnit_Framework_Constraint_Xor matcher object.

static PHPUnit_Framework_Constraint_IsAnything anything()

Returns a PHPUnit_Framework_Constraint_IsAnything matcher object.

static PHPUnit_Framework_Constraint_IsTrue isTrue()

Returns a PHPUnit_Framework_Constraint_IsTrue matcher object.

static PHPUnit_Framework_Constraint_Callback callback(callable $callback)

Returns a PHPUnit_Framework_Constraint_Callback matcher object.

Parameters

callable $callback

Return Value

PHPUnit_Framework_Constraint_Callback

static PHPUnit_Framework_Constraint_IsFalse isFalse()

Returns a PHPUnit_Framework_Constraint_IsFalse matcher object.

static PHPUnit_Framework_Constraint_IsJson isJson()

Returns a PHPUnit_Framework_Constraint_IsJson matcher object.

static PHPUnit_Framework_Constraint_IsNull isNull()

Returns a PHPUnit_Framework_Constraint_IsNull matcher object.

static PHPUnit_Framework_Constraint_IsFinite isFinite()

Returns a PHPUnit_Framework_Constraint_IsFinite matcher object.

static PHPUnit_Framework_Constraint_IsInfinite isInfinite()

Returns a PHPUnit_Framework_Constraint_IsInfinite matcher object.

static PHPUnit_Framework_Constraint_IsNan isNan()

Returns a PHPUnit_Framework_Constraint_IsNan matcher object.

static PHPUnit_Framework_Constraint_Attribute attribute(PHPUnit_Framework_Constraint $constraint, string $attributeName)

Returns a PHPUnit_Framework_Constraint_Attribute matcher object.

Parameters

PHPUnit_Framework_Constraint $constraint
string $attributeName

Return Value

PHPUnit_Framework_Constraint_Attribute

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

Returns a PHPUnit_Framework_Constraint_TraversableContains matcher object.

Parameters

mixed $value
bool $checkForObjectIdentity
bool $checkForNonObjectIdentity

Return Value

PHPUnit_Framework_Constraint_TraversableContains

static PHPUnit_Framework_Constraint_TraversableContainsOnly containsOnly(string $type)

Returns a PHPUnit_Framework_Constraint_TraversableContainsOnly matcher object.

Parameters

string $type

Return Value

PHPUnit_Framework_Constraint_TraversableContainsOnly

static PHPUnit_Framework_Constraint_TraversableContainsOnly containsOnlyInstancesOf(string $classname)

Returns a PHPUnit_Framework_Constraint_TraversableContainsOnly matcher object.

Parameters

string $classname

Return Value

PHPUnit_Framework_Constraint_TraversableContainsOnly

static PHPUnit_Framework_Constraint_ArrayHasKey arrayHasKey(mixed $key)

Returns a PHPUnit_Framework_Constraint_ArrayHasKey matcher object.

Parameters

mixed $key

Return Value

PHPUnit_Framework_Constraint_ArrayHasKey

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

Returns a PHPUnit_Framework_Constraint_IsEqual matcher object.

Parameters

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

Return Value

PHPUnit_Framework_Constraint_IsEqual

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

Returns a PHPUnit_Framework_Constraint_IsEqual matcher object that is wrapped in a PHPUnit_Framework_Constraint_Attribute matcher object.

Parameters

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

Return Value

PHPUnit_Framework_Constraint_Attribute

static PHPUnit_Framework_Constraint_IsEmpty isEmpty()

Returns a PHPUnit_Framework_Constraint_IsEmpty matcher object.

static PHPUnit_Framework_Constraint_IsWritable isWritable()

Returns a PHPUnit_Framework_Constraint_IsWritable matcher object.

static PHPUnit_Framework_Constraint_IsReadable isReadable()

Returns a PHPUnit_Framework_Constraint_IsReadable matcher object.

static PHPUnit_Framework_Constraint_DirectoryExists directoryExists()

Returns a PHPUnit_Framework_Constraint_DirectoryExists matcher object.

static PHPUnit_Framework_Constraint_FileExists fileExists()

Returns a PHPUnit_Framework_Constraint_FileExists matcher object.

static PHPUnit_Framework_Constraint_GreaterThan greaterThan(mixed $value)

Returns a PHPUnit_Framework_Constraint_GreaterThan matcher object.

Parameters

mixed $value

Return Value

PHPUnit_Framework_Constraint_GreaterThan

static PHPUnit_Framework_Constraint_Or greaterThanOrEqual(mixed $value)

Returns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_GreaterThan matcher object.

Parameters

mixed $value

Return Value

PHPUnit_Framework_Constraint_Or

static PHPUnit_Framework_Constraint_ClassHasAttribute classHasAttribute(string $attributeName)

Returns a PHPUnit_Framework_Constraint_ClassHasAttribute matcher object.

Parameters

string $attributeName

Return Value

PHPUnit_Framework_Constraint_ClassHasAttribute

static PHPUnit_Framework_Constraint_ClassHasStaticAttribute classHasStaticAttribute(string $attributeName)

Returns a PHPUnit_Framework_Constraint_ClassHasStaticAttribute matcher object.

Parameters

string $attributeName

Return Value

PHPUnit_Framework_Constraint_ClassHasStaticAttribute

static PHPUnit_Framework_Constraint_ObjectHasAttribute objectHasAttribute(string $attributeName)

Returns a PHPUnit_Framework_Constraint_ObjectHasAttribute matcher object.

Parameters

string $attributeName

Return Value

PHPUnit_Framework_Constraint_ObjectHasAttribute

static PHPUnit_Framework_Constraint_IsIdentical identicalTo(mixed $value)

Returns a PHPUnit_Framework_Constraint_IsIdentical matcher object.

Parameters

mixed $value

Return Value

PHPUnit_Framework_Constraint_IsIdentical

static PHPUnit_Framework_Constraint_IsInstanceOf isInstanceOf(string $className)

Returns a PHPUnit_Framework_Constraint_IsInstanceOf matcher object.

Parameters

string $className

Return Value

PHPUnit_Framework_Constraint_IsInstanceOf

static PHPUnit_Framework_Constraint_IsType isType(string $type)

Returns a PHPUnit_Framework_Constraint_IsType matcher object.

Parameters

string $type

Return Value

PHPUnit_Framework_Constraint_IsType

static PHPUnit_Framework_Constraint_LessThan lessThan(mixed $value)

Returns a PHPUnit_Framework_Constraint_LessThan matcher object.

Parameters

mixed $value

Return Value

PHPUnit_Framework_Constraint_LessThan

static PHPUnit_Framework_Constraint_Or lessThanOrEqual(mixed $value)

Returns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_LessThan matcher object.

Parameters

mixed $value

Return Value

PHPUnit_Framework_Constraint_Or

static PHPUnit_Framework_Constraint_PCREMatch matchesRegularExpression(string $pattern)

Returns a PHPUnit_Framework_Constraint_PCREMatch matcher object.

Parameters

string $pattern

Return Value

PHPUnit_Framework_Constraint_PCREMatch

static PHPUnit_Framework_Constraint_StringMatches matches(string $string)

Returns a PHPUnit_Framework_Constraint_StringMatches matcher object.

Parameters

string $string

Return Value

PHPUnit_Framework_Constraint_StringMatches

static PHPUnit_Framework_Constraint_StringStartsWith stringStartsWith(mixed $prefix)

Returns a PHPUnit_Framework_Constraint_StringStartsWith matcher object.

Parameters

mixed $prefix

Return Value

PHPUnit_Framework_Constraint_StringStartsWith

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

Returns a PHPUnit_Framework_Constraint_StringContains matcher object.

Parameters

string $string
bool $case

Return Value

PHPUnit_Framework_Constraint_StringContains

static PHPUnit_Framework_Constraint_StringEndsWith stringEndsWith(mixed $suffix)

Returns a PHPUnit_Framework_Constraint_StringEndsWith matcher object.

Parameters

mixed $suffix

Return Value

PHPUnit_Framework_Constraint_StringEndsWith

static PHPUnit_Framework_Constraint_Count countOf(int $count)

Returns a PHPUnit_Framework_Constraint_Count matcher object.

Parameters

int $count

Return Value

PHPUnit_Framework_Constraint_Count

static fail(string $message = '')

Fails a test with the given message.

Parameters

string $message

Exceptions

PHPUnit_Framework_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

PHPUnit_Framework_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

PHPUnit_Framework_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

PHPUnit_Framework_Exception

static markTestIncomplete(string $message = '')

Mark the test as incomplete.

Parameters

string $message

Exceptions

PHPUnit_Framework_IncompleteTestError

static markTestSkipped(string $message = '')

Mark the test as skipped.

Parameters

string $message

Exceptions

PHPUnit_Framework_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

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

PHPUnit_Framework_Exception

expectOutputString(string $expectedString)

Parameters

string $expectedString

bool hasPerformedExpectationsOnOutput() deprecated

deprecated Use hasExpectationOnOutput() instead

Return Value

bool

bool hasExpectationOnOutput()

Return Value

bool

string getExpectedException()

Return Value

string

setExpectedException(mixed $exception, string $message = '', int|string $code = null) deprecated

deprecated Method deprecated since Release 5.2.0; use expectException() instead

Parameters

mixed $exception
string $message
int|string $code

Exceptions

PHPUnit_Framework_Exception

setExpectedExceptionRegExp(mixed $exception, string $messageRegExp = '', int $code = null) deprecated

deprecated Method deprecated since Release 5.6.0; use expectExceptionMessageRegExp() instead

Parameters

mixed $exception
string $messageRegExp
int $code

Exceptions

PHPUnit_Framework_Exception

expectException(string $exception)

Parameters

string $exception

expectExceptionCode(int|string $code)

Parameters

int|string $code

Exceptions

PHPUnit_Framework_Exception

expectExceptionMessage(string $message)

Parameters

string $message

Exceptions

PHPUnit_Framework_Exception

expectExceptionMessageRegExp(string $messageRegExp)

Parameters

string $messageRegExp

Exceptions

PHPUnit_Framework_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

PHPUnit_Framework_TestResult run(PHPUnit_Framework_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.

runBare()

Runs the bare test sequence.

protected mixed runTest()

Return Value

mixed

Exceptions

PHPUnit_Framework_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

PHPUnit_Framework_Exception

setPreserveGlobalState(bool $preserveGlobalState)

Parameters

bool $preserveGlobalState

Exceptions

PHPUnit_Framework_Exception

setInIsolation(bool $inIsolation)

Parameters

bool $inIsolation

Exceptions

PHPUnit_Framework_Exception

bool isInIsolation()

Return Value

bool

mixed getResult()

Return Value

mixed

setResult(mixed $result)

Parameters

mixed $result

setOutputCallback(callable $callback)

Parameters

callable $callback

Exceptions

PHPUnit_Framework_Exception

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

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

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

PHPUnit_Framework_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

PHPUnit_Framework_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

PHPUnit_Framework_Exception

protected PHPUnit_Framework_MockObject_MockObject getMock(string $originalClassName, array|null $methods = [], array $arguments = [], string $mockClassName = '', bool $callOriginalConstructor = true, bool $callOriginalClone = true, bool $callAutoload = true, bool $cloneArguments = false, bool $callOriginalMethods = false, object $proxyTarget = null) deprecated

deprecated Method deprecated since Release 5.4.0; use createMock() or getMockBuilder() instead

Returns a mock object for the specified class.

Parameters

string $originalClassName Name of the class to mock.
array|null $methods When provided, only methods whose names are in the array are replaced with a configurable test double. The behavior of the other methods is not changed. Providing null means that no methods will be replaced.
array $arguments Parameters to pass to the original class' constructor.
string $mockClassName Class name for the generated test double class.
bool $callOriginalConstructor Can be used to disable the call to the original class' constructor.
bool $callOriginalClone Can be used to disable the call to the original class' clone constructor.
bool $callAutoload Can be used to disable __autoload() during the generation of the test double class.
bool $cloneArguments
bool $callOriginalMethods
object $proxyTarget

Return Value

PHPUnit_Framework_MockObject_MockObject

Exceptions

PHPUnit_Framework_Exception

protected PHPUnit_Framework_MockObject_MockObject getMockWithoutInvokingTheOriginalConstructor(string $originalClassName) deprecated

deprecated Method deprecated since Release 5.4.0; use createMock() instead

Returns a mock with disabled constructor object for the specified class.

Parameters

string $originalClassName

Return Value

PHPUnit_Framework_MockObject_MockObject

Exceptions

PHPUnit_Framework_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

PHPUnit_Framework_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

PHPUnit_Framework_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

PHPUnit_Framework_Exception

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

Returns an object for the specified trait.

Parameters

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

Return Value

object

Exceptions

PHPUnit_Framework_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 $exception)

Parameters

Throwable|Exception $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

protected 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 PHPUnit_Framework_TestResult createResult()

Creates a default TestResult object.

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(Exception|Throwable $e)

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

Parameters

Exception|Throwable $e

Exceptions

Throwable

protected prepareTemplate(Text_Template $template)

Performs custom preparations on the process isolation template.

Parameters

Text_Template $template

protected PHPUnit_Framework_MockObject_Generator getMockObjectGenerator()

Get the mock object generator, creating it if it doesn't exist.

Return Value

PHPUnit_Framework_MockObject_Generator

string getMessage()

Return Value

string