abstract class (none) \ PHPUnit_Framework_TestCase

All implemented interfaces:
Countable, PHPUnit_Framework_Test, PHPUnit_Framework_SelfDescribing
All known direct subclasses:
PHPUnit_Framework_IncompleteTestCase, PHPUnit_Framework_SkippedTestCase, PHPUnit_Framework_Warning

A TestCase defines the fixture to run multiple tests.

To define a TestCase

1) Implement a subclass of PHPUnit_Framework_TestCase. 2) Define instance variables that store the state of the fixture. 3) Initialize the fixture state by overriding setUp(). 4) Clean-up after a test by overriding tearDown().

Each test runs in its own fixture so there can be no side effects among test runs.

Here is an example:

protected function setUp() { $this->value1 = 2; $this->value2 = 3; } } ?>

For each test implement a method which interacts with the fixture. Verify the expected results with assertions specified by calling assert with a boolean.

assertTrue($this->value1 + $this->value2 == 5); } ?>


Method Summary

Name Description
__construct($name = null, array $data = array(), $dataName = "")Constructs a test case with the given name.
addToAssertionCount($count)Adds a value to the assertion counter.
any()Returns a matcher that matches when the method it is evaluated for is executed zero or more times.
assertPostConditions()Performs assertions shared by all tests of a test case.
assertPreConditions()Performs assertions shared by all tests of a test case.
at($index)Returns a matcher that matches when the method it is evaluated for is invoked at the given $index.
atLeast($requiredInvocations)Returns a matcher that matches when the method it is evaluated for is executed at least N times.
atLeastOnce()Returns a matcher that matches when the method it is evaluated for is executed at least once.
atMost($allowedInvocations)Returns a matcher that matches when the method it is evaluated for is executed at most N times.
checkRequirements()
compareGlobalStateSnapshotPart(array $before, array $after, $header)
compareGlobalStateSnapshots(Snapshot $before, Snapshot $after)
count()Counts the number of test cases executed by run(TestResult result).
createGlobalStateSnapshot($backupGlobals)
createResult()Creates a default TestResult object.
exactly($count)Returns a matcher that matches when the method it is evaluated for is executed exactly $count times.
expectOutputRegex($expectedRegex)
expectOutputString($expectedString)
getActualOutput()
getAnnotations()Returns the annotations for this test.
getDataSetAsString($includeData = true)Gets the data set description of a TestCase.
getExpectedException()
getMock($originalClassName, $methods = array(), array $arguments = array(), $mockClassName = "", $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $cloneArguments = false, $callOriginalMethods = false)Returns a mock object for the specified class.
getMockBuilder($className)Returns a builder object to create mock objects using a fluent interface.
getMockClass($originalClassName, $methods = array(), array $arguments = array(), $mockClassName = "", $callOriginalConstructor = false, $callOriginalClone = true, $callAutoload = true, $cloneArguments = false)Mocks the specified class and returns the name of the mocked class.
getMockForAbstractClass($originalClassName, array $arguments = array(), $mockClassName = "", $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = array(), $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).
getMockForTrait($traitName, array $arguments = array(), $mockClassName = "", $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = array(), $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.
getMockFromWsdl($wsdlFile, $originalClassName = "", $mockClassName = "", array $methods = array(), $callOriginalConstructor = true, array $options = array())Returns a mock object based on the given WSDL file.
getMockObjectGenerator()Get the mock object generator, creating it if it doesn't exist.
getName($withDataSet = true)Gets the name of a TestCase.
getNumAssertions()Returns the number of assertions performed by this test.
getObjectForTrait($traitName, array $arguments = array(), $traitClassName = "", $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $cloneArguments = false)Returns an object for the specified trait.
getProphet()
getResult()
getSize()Returns the size of the test.
getStatus()Returns the status of this test.
getStatusMessage()Returns the status message of this test.
getTestResultObject()
handleDependencies()
hasDependencies()Returns true if the tests has dependencies
hasExpectationOnOutput()
hasFailed()Returns whether or not this test has failed.
hasOutput()
hasPerformedExpectationsOnOutput()
iniSet($varName, $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.
isInIsolation()
never()Returns a matcher that matches when the method it is evaluated for is never executed.
onConsecutiveCalls()
onNotSuccessfulTest(Exception $e)This method is called when a test method did not execute successfully.
once()Returns a matcher that matches when the method it is evaluated for is executed exactly once.
prepareTemplate(Text_Template $template)Performs custom preparations on the process isolation template.
prophesize($classOrInterface = null)
restoreGlobalState()
returnArgument($argumentIndex)
returnCallback($callback)
returnSelf()Returns the current object.
returnValue($value)
returnValueMap(array $valueMap)
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.
runTest()Override to run the test and assert its state.
setBackupGlobals($backupGlobals)Calling this method in setUp() has no effect!
setBackupStaticAttributes($backupStaticAttributes)Calling this method in setUp() has no effect!
setDependencies(array $dependencies)Sets the dependencies of a TestCase.
setDependencyInput(array $dependencyInput)Sets
setDisallowChangesToGlobalState($disallowChangesToGlobalState)
setExpectedException($exceptionName, $exceptionMessage = "", $exceptionCode = null)
setExpectedExceptionFromAnnotation()
setExpectedExceptionRegExp($exceptionName, $exceptionMessageRegExp = "", $exceptionCode = null)
setInIsolation($inIsolation)
setLocale()This method is a wrapper for the setlocale() function that automatically resets the locale to its original value after the test is run.
setName($name)Sets the name of a TestCase.
setOutputCallback($callback)
setPreserveGlobalState($preserveGlobalState)
setResult($result)
setRunTestInSeparateProcess($runTestInSeparateProcess)
setTestResultObject(PHPUnit_Framework_TestResult $result)
setUp()Sets up the fixture, for example, open a network connection. This method is called before a test is executed.
setUpBeforeClass()This method is called before the first test of this test class is run.
setUseErrorHandler($useErrorHandler)
setUseErrorHandlerFromAnnotation()
snapshotGlobalState()
startOutputBuffering()
stopOutputBuffering()
tearDown()Tears down the fixture, for example, close a network connection. This method is called after a test is executed.
tearDownAfterClass()This method is called after the last test of this test class is run.
throwException(Exception $exception)
toString()Returns a string representation of the test case.
verifyMockObjects()Verifies the mock object expectations.

Inherited Method Summary

Name Description
anything()Returns a PHPUnit_Framework_Constraint_IsAnything matcher object. (from PHPUnit_Framework_Assert)
arrayHasKey($key)Returns a PHPUnit_Framework_Constraint_ArrayHasKey matcher object. (from PHPUnit_Framework_Assert)
assertArrayHasKey($key, $array, $message = "")Asserts that an array has a specified key. (from PHPUnit_Framework_Assert)
assertArrayNotHasKey($key, $array, $message = "")Asserts that an array does not have a specified key. (from PHPUnit_Framework_Assert)
assertArraySubset($subset, $array, $strict = false, $message = "")Asserts that an array has a specified subset. (from PHPUnit_Framework_Assert)
assertAttributeContains($needle, $haystackAttributeName, $haystackClassOrObject, $message = "", $ignoreCase = false, $checkForObjectIdentity = true, $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 PHPUnit_Framework_Assert)
assertAttributeContainsOnly($type, $haystackAttributeName, $haystackClassOrObject, $isNativeType = null, $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 PHPUnit_Framework_Assert)
assertAttributeCount($expectedCount, $haystackAttributeName, $haystackClassOrObject, $message = "")Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute. (from PHPUnit_Framework_Assert)
assertAttributeEmpty($haystackAttributeName, $haystackClassOrObject, $message = "")Asserts that a static attribute of a class or an attribute of an object is empty. (from PHPUnit_Framework_Assert)
assertAttributeEquals($expected, $actualAttributeName, $actualClassOrObject, $message = "", $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)Asserts that a variable is equal to an attribute of an object. (from PHPUnit_Framework_Assert)
assertAttributeGreaterThan($expected, $actualAttributeName, $actualClassOrObject, $message = "")Asserts that an attribute is greater than another value. (from PHPUnit_Framework_Assert)
assertAttributeGreaterThanOrEqual($expected, $actualAttributeName, $actualClassOrObject, $message = "")Asserts that an attribute is greater than or equal to another value. (from PHPUnit_Framework_Assert)
assertAttributeInstanceOf($expected, $attributeName, $classOrObject, $message = "")Asserts that an attribute is of a given type. (from PHPUnit_Framework_Assert)
assertAttributeInternalType($expected, $attributeName, $classOrObject, $message = "")Asserts that an attribute is of a given type. (from PHPUnit_Framework_Assert)
assertAttributeLessThan($expected, $actualAttributeName, $actualClassOrObject, $message = "")Asserts that an attribute is smaller than another value. (from PHPUnit_Framework_Assert)
assertAttributeLessThanOrEqual($expected, $actualAttributeName, $actualClassOrObject, $message = "")Asserts that an attribute is smaller than or equal to another value. (from PHPUnit_Framework_Assert)
assertAttributeNotContains($needle, $haystackAttributeName, $haystackClassOrObject, $message = "", $ignoreCase = false, $checkForObjectIdentity = true, $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 PHPUnit_Framework_Assert)
assertAttributeNotContainsOnly($type, $haystackAttributeName, $haystackClassOrObject, $isNativeType = null, $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 PHPUnit_Framework_Assert)
assertAttributeNotCount($expectedCount, $haystackAttributeName, $haystackClassOrObject, $message = "")Asserts the number of elements of an array, Countable or Traversable that is stored in an attribute. (from PHPUnit_Framework_Assert)
assertAttributeNotEmpty($haystackAttributeName, $haystackClassOrObject, $message = "")Asserts that a static attribute of a class or an attribute of an object is not empty. (from PHPUnit_Framework_Assert)
assertAttributeNotEquals($expected, $actualAttributeName, $actualClassOrObject, $message = "", $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)Asserts that a variable is not equal to an attribute of an object. (from PHPUnit_Framework_Assert)
assertAttributeNotInstanceOf($expected, $attributeName, $classOrObject, $message = "")Asserts that an attribute is of a given type. (from PHPUnit_Framework_Assert)
assertAttributeNotInternalType($expected, $attributeName, $classOrObject, $message = "")Asserts that an attribute is of a given type. (from PHPUnit_Framework_Assert)
assertAttributeNotSame($expected, $actualAttributeName, $actualClassOrObject, $message = "")Asserts that a variable and an attribute of an object do not have the same type and value. (from PHPUnit_Framework_Assert)
assertAttributeSame($expected, $actualAttributeName, $actualClassOrObject, $message = "")Asserts that a variable and an attribute of an object have the same type and value. (from PHPUnit_Framework_Assert)
assertClassHasAttribute($attributeName, $className, $message = "")Asserts that a class has a specified attribute. (from PHPUnit_Framework_Assert)
assertClassHasStaticAttribute($attributeName, $className, $message = "")Asserts that a class has a specified static attribute. (from PHPUnit_Framework_Assert)
assertClassNotHasAttribute($attributeName, $className, $message = "")Asserts that a class does not have a specified attribute. (from PHPUnit_Framework_Assert)
assertClassNotHasStaticAttribute($attributeName, $className, $message = "")Asserts that a class does not have a specified static attribute. (from PHPUnit_Framework_Assert)
assertContains($needle, $haystack, $message = "", $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false)Asserts that a haystack contains a needle. (from PHPUnit_Framework_Assert)
assertContainsOnly($type, $haystack, $isNativeType = null, $message = "")Asserts that a haystack contains only values of a given type. (from PHPUnit_Framework_Assert)
assertContainsOnlyInstancesOf($classname, $haystack, $message = "")Asserts that a haystack contains only instances of a given classname (from PHPUnit_Framework_Assert)
assertCount($expectedCount, $haystack, $message = "")Asserts the number of elements of an array, Countable or Traversable. (from PHPUnit_Framework_Assert)
assertEmpty($actual, $message = "")Asserts that a variable is empty. (from PHPUnit_Framework_Assert)
assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement, $checkAttributes = false, $message = "")Asserts that a hierarchy of DOMElements matches. (from PHPUnit_Framework_Assert)
assertEquals($expected, $actual, $message = "", $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)Asserts that two variables are equal. (from PHPUnit_Framework_Assert)
assertFalse($condition, $message = "")Asserts that a condition is false. (from PHPUnit_Framework_Assert)
assertFileEquals($expected, $actual, $message = "", $canonicalize = false, $ignoreCase = false)Asserts that the contents of one file is equal to the contents of another file. (from PHPUnit_Framework_Assert)
assertFileExists($filename, $message = "")Asserts that a file exists. (from PHPUnit_Framework_Assert)
assertFileNotEquals($expected, $actual, $message = "", $canonicalize = false, $ignoreCase = false)Asserts that the contents of one file is not equal to the contents of another file. (from PHPUnit_Framework_Assert)
assertFileNotExists($filename, $message = "")Asserts that a file does not exist. (from PHPUnit_Framework_Assert)
assertGreaterThan($expected, $actual, $message = "")Asserts that a value is greater than another value. (from PHPUnit_Framework_Assert)
assertGreaterThanOrEqual($expected, $actual, $message = "")Asserts that a value is greater than or equal to another value. (from PHPUnit_Framework_Assert)
assertInstanceOf($expected, $actual, $message = "")Asserts that a variable is of a given type. (from PHPUnit_Framework_Assert)
assertInternalType($expected, $actual, $message = "")Asserts that a variable is of a given type. (from PHPUnit_Framework_Assert)
assertJson($actualJson, $message = "")Asserts that a string is a valid JSON string. (from PHPUnit_Framework_Assert)
assertJsonFileEqualsJsonFile($expectedFile, $actualFile, $message = "")Asserts that two JSON files are equal. (from PHPUnit_Framework_Assert)
assertJsonFileNotEqualsJsonFile($expectedFile, $actualFile, $message = "")Asserts that two JSON files are not equal. (from PHPUnit_Framework_Assert)
assertJsonStringEqualsJsonFile($expectedFile, $actualJson, $message = "")Asserts that the generated JSON encoded object and the content of the given file are equal. (from PHPUnit_Framework_Assert)
assertJsonStringEqualsJsonString($expectedJson, $actualJson, $message = "")Asserts that two given JSON encoded objects or arrays are equal. (from PHPUnit_Framework_Assert)
assertJsonStringNotEqualsJsonFile($expectedFile, $actualJson, $message = "")Asserts that the generated JSON encoded object and the content of the given file are not equal. (from PHPUnit_Framework_Assert)
assertJsonStringNotEqualsJsonString($expectedJson, $actualJson, $message = "")Asserts that two given JSON encoded objects or arrays are not equal. (from PHPUnit_Framework_Assert)
assertLessThan($expected, $actual, $message = "")Asserts that a value is smaller than another value. (from PHPUnit_Framework_Assert)
assertLessThanOrEqual($expected, $actual, $message = "")Asserts that a value is smaller than or equal to another value. (from PHPUnit_Framework_Assert)
assertNotContains($needle, $haystack, $message = "", $ignoreCase = false, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false)Asserts that a haystack does not contain a needle. (from PHPUnit_Framework_Assert)
assertNotContainsOnly($type, $haystack, $isNativeType = null, $message = "")Asserts that a haystack does not contain only values of a given type. (from PHPUnit_Framework_Assert)
assertNotCount($expectedCount, $haystack, $message = "")Asserts the number of elements of an array, Countable or Traversable. (from PHPUnit_Framework_Assert)
assertNotEmpty($actual, $message = "")Asserts that a variable is not empty. (from PHPUnit_Framework_Assert)
assertNotEquals($expected, $actual, $message = "", $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)Asserts that two variables are not equal. (from PHPUnit_Framework_Assert)
assertNotFalse($condition, $message = "")Asserts that a condition is not false. (from PHPUnit_Framework_Assert)
assertNotInstanceOf($expected, $actual, $message = "")Asserts that a variable is not of a given type. (from PHPUnit_Framework_Assert)
assertNotInternalType($expected, $actual, $message = "")Asserts that a variable is not of a given type. (from PHPUnit_Framework_Assert)
assertNotNull($actual, $message = "")Asserts that a variable is not null. (from PHPUnit_Framework_Assert)
assertNotRegExp($pattern, $string, $message = "")Asserts that a string does not match a given regular expression. (from PHPUnit_Framework_Assert)
assertNotSame($expected, $actual, $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. (from PHPUnit_Framework_Assert)
assertNotSameSize($expected, $actual, $message = "")Assert that the size of two arrays (or Countable or Traversable objects) is not the same. (from PHPUnit_Framework_Assert)
assertNotTag($matcher, $actual, $message = "", $isHtml = true)This assertion is the exact opposite of assertTag(). (from PHPUnit_Framework_Assert)
assertNotTrue($condition, $message = "")Asserts that a condition is not true. (from PHPUnit_Framework_Assert)
assertNull($actual, $message = "")Asserts that a variable is null. (from PHPUnit_Framework_Assert)
assertObjectHasAttribute($attributeName, $object, $message = "")Asserts that an object has a specified attribute. (from PHPUnit_Framework_Assert)
assertObjectNotHasAttribute($attributeName, $object, $message = "")Asserts that an object does not have a specified attribute. (from PHPUnit_Framework_Assert)
assertRegExp($pattern, $string, $message = "")Asserts that a string matches a given regular expression. (from PHPUnit_Framework_Assert)
assertSame($expected, $actual, $message = "")Asserts that two variables have the same type and value. Used on objects, it asserts that two variables reference the same object. (from PHPUnit_Framework_Assert)
assertSameSize($expected, $actual, $message = "")Assert that the size of two arrays (or Countable or Traversable objects) is the same. (from PHPUnit_Framework_Assert)
assertSelectCount($selector, $count, $actual, $message = "", $isHtml = true)Assert the presence, absence, or count of elements in a document matching the CSS $selector, regardless of the contents of those elements. (from PHPUnit_Framework_Assert)
assertSelectEquals($selector, $content, $count, $actual, $message = "", $isHtml = true)assertSelectEquals("#binder .name", "Chuck", true, $xml); // any? assertSelectEquals("#binder .name", "Chuck", false, $xml); // none? (from PHPUnit_Framework_Assert)
assertSelectRegExp($selector, $pattern, $count, $actual, $message = "", $isHtml = true)assertSelectRegExp("#binder .name", "/Mike|Derek/", true, $xml); // any? assertSelectRegExp("#binder .name", "/Mike|Derek/", 3, $xml); // 3? (from PHPUnit_Framework_Assert)
assertStringEndsNotWith($suffix, $string, $message = "")Asserts that a string ends not with a given suffix. (from PHPUnit_Framework_Assert)
assertStringEndsWith($suffix, $string, $message = "")Asserts that a string ends with a given suffix. (from PHPUnit_Framework_Assert)
assertStringEqualsFile($expectedFile, $actualString, $message = "", $canonicalize = false, $ignoreCase = false)Asserts that the contents of a string is equal to the contents of a file. (from PHPUnit_Framework_Assert)
assertStringMatchesFormat($format, $string, $message = "")Asserts that a string matches a given format string. (from PHPUnit_Framework_Assert)
assertStringMatchesFormatFile($formatFile, $string, $message = "")Asserts that a string matches a given format file. (from PHPUnit_Framework_Assert)
assertStringNotEqualsFile($expectedFile, $actualString, $message = "", $canonicalize = false, $ignoreCase = false)Asserts that the contents of a string is not equal to the contents of a file. (from PHPUnit_Framework_Assert)
assertStringNotMatchesFormat($format, $string, $message = "")Asserts that a string does not match a given format string. (from PHPUnit_Framework_Assert)
assertStringNotMatchesFormatFile($formatFile, $string, $message = "")Asserts that a string does not match a given format string. (from PHPUnit_Framework_Assert)
assertStringStartsNotWith($prefix, $string, $message = "")Asserts that a string starts not with a given prefix. (from PHPUnit_Framework_Assert)
assertStringStartsWith($prefix, $string, $message = "")Asserts that a string starts with a given prefix. (from PHPUnit_Framework_Assert)
assertTag($matcher, $actual, $message = "", $isHtml = true)Evaluate an HTML or XML string and assert its structure and/or contents. (from PHPUnit_Framework_Assert)
assertThat($value, PHPUnit_Framework_Constraint $constraint, $message = "")Evaluates a PHPUnit_Framework_Constraint matcher object. (from PHPUnit_Framework_Assert)
assertTrue($condition, $message = "")Asserts that a condition is true. (from PHPUnit_Framework_Assert)
assertXmlFileEqualsXmlFile($expectedFile, $actualFile, $message = "")Asserts that two XML files are equal. (from PHPUnit_Framework_Assert)
assertXmlFileNotEqualsXmlFile($expectedFile, $actualFile, $message = "")Asserts that two XML files are not equal. (from PHPUnit_Framework_Assert)
assertXmlStringEqualsXmlFile($expectedFile, $actualXml, $message = "")Asserts that two XML documents are equal. (from PHPUnit_Framework_Assert)
assertXmlStringEqualsXmlString($expectedXml, $actualXml, $message = "")Asserts that two XML documents are equal. (from PHPUnit_Framework_Assert)
assertXmlStringNotEqualsXmlFile($expectedFile, $actualXml, $message = "")Asserts that two XML documents are not equal. (from PHPUnit_Framework_Assert)
assertXmlStringNotEqualsXmlString($expectedXml, $actualXml, $message = "")Asserts that two XML documents are not equal. (from PHPUnit_Framework_Assert)
attribute(PHPUnit_Framework_Constraint $constraint, $attributeName)Returns a PHPUnit_Framework_Constraint_Attribute matcher object. (from PHPUnit_Framework_Assert)
attributeEqualTo($attributeName, $value, $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)Returns a PHPUnit_Framework_Constraint_IsEqual matcher object that is wrapped in a PHPUnit_Framework_Constraint_Attribute matcher object. (from PHPUnit_Framework_Assert)
callback($callback)Returns a PHPUnit_Framework_Constraint_Callback matcher object. (from PHPUnit_Framework_Assert)
classHasAttribute($attributeName)Returns a PHPUnit_Framework_Constraint_ClassHasAttribute matcher object. (from PHPUnit_Framework_Assert)
classHasStaticAttribute($attributeName)Returns a PHPUnit_Framework_Constraint_ClassHasStaticAttribute matcher object. (from PHPUnit_Framework_Assert)
contains($value, $checkForObjectIdentity = true, $checkForNonObjectIdentity = false)Returns a PHPUnit_Framework_Constraint_TraversableContains matcher object. (from PHPUnit_Framework_Assert)
containsOnly($type)Returns a PHPUnit_Framework_Constraint_TraversableContainsOnly matcher object. (from PHPUnit_Framework_Assert)
containsOnlyInstancesOf($classname)Returns a PHPUnit_Framework_Constraint_TraversableContainsOnly matcher object. (from PHPUnit_Framework_Assert)
countOf($count)Returns a PHPUnit_Framework_Constraint_Count matcher object. (from PHPUnit_Framework_Assert)
equalTo($value, $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)Returns a PHPUnit_Framework_Constraint_IsEqual matcher object. (from PHPUnit_Framework_Assert)
fail($message = "")Fails a test with the given message. (from PHPUnit_Framework_Assert)
fileExists()Returns a PHPUnit_Framework_Constraint_FileExists matcher object. (from PHPUnit_Framework_Assert)
getCount()Return the current assertion count. (from PHPUnit_Framework_Assert)
getObjectAttribute($object, $attributeName)Returns the value of an object's attribute. This also works for attributes that are declared protected or private. (from PHPUnit_Framework_Assert)
getStaticAttribute($className, $attributeName)Returns the value of a static attribute. This also works for attributes that are declared protected or private. (from PHPUnit_Framework_Assert)
greaterThan($value)Returns a PHPUnit_Framework_Constraint_GreaterThan matcher object. (from PHPUnit_Framework_Assert)
greaterThanOrEqual($value)Returns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_GreaterThan matcher object. (from PHPUnit_Framework_Assert)
identicalTo($value)Returns a PHPUnit_Framework_Constraint_IsIdentical matcher object. (from PHPUnit_Framework_Assert)
isEmpty()Returns a PHPUnit_Framework_Constraint_IsEmpty matcher object. (from PHPUnit_Framework_Assert)
isFalse()Returns a PHPUnit_Framework_Constraint_IsFalse matcher object. (from PHPUnit_Framework_Assert)
isInstanceOf($className)Returns a PHPUnit_Framework_Constraint_IsInstanceOf matcher object. (from PHPUnit_Framework_Assert)
isJson()Returns a PHPUnit_Framework_Constraint_IsJson matcher object. (from PHPUnit_Framework_Assert)
isNull()Returns a PHPUnit_Framework_Constraint_IsNull matcher object. (from PHPUnit_Framework_Assert)
isTrue()Returns a PHPUnit_Framework_Constraint_IsTrue matcher object. (from PHPUnit_Framework_Assert)
isType($type)Returns a PHPUnit_Framework_Constraint_IsType matcher object. (from PHPUnit_Framework_Assert)
lessThan($value)Returns a PHPUnit_Framework_Constraint_LessThan matcher object. (from PHPUnit_Framework_Assert)
lessThanOrEqual($value)Returns a PHPUnit_Framework_Constraint_Or matcher object that wraps a PHPUnit_Framework_Constraint_IsEqual and a PHPUnit_Framework_Constraint_LessThan matcher object. (from PHPUnit_Framework_Assert)
logicalAnd()Returns a PHPUnit_Framework_Constraint_And matcher object. (from PHPUnit_Framework_Assert)
logicalNot(PHPUnit_Framework_Constraint $constraint)Returns a PHPUnit_Framework_Constraint_Not matcher object. (from PHPUnit_Framework_Assert)
logicalOr()Returns a PHPUnit_Framework_Constraint_Or matcher object. (from PHPUnit_Framework_Assert)
logicalXor()Returns a PHPUnit_Framework_Constraint_Xor matcher object. (from PHPUnit_Framework_Assert)
markTestIncomplete($message = "")Mark the test as incomplete. (from PHPUnit_Framework_Assert)
markTestSkipped($message = "")Mark the test as skipped. (from PHPUnit_Framework_Assert)
matches($string)Returns a PHPUnit_Framework_Constraint_StringMatches matcher object. (from PHPUnit_Framework_Assert)
matchesRegularExpression($pattern)Returns a PHPUnit_Framework_Constraint_PCREMatch matcher object. (from PHPUnit_Framework_Assert)
objectHasAttribute($attributeName)Returns a PHPUnit_Framework_Constraint_ObjectHasAttribute matcher object. (from PHPUnit_Framework_Assert)
readAttribute($classOrObject, $attributeName)Returns the value of an attribute of a class or an object. This also works for attributes that are declared protected or private. (from PHPUnit_Framework_Assert)
resetCount()Reset the assertion counter. (from PHPUnit_Framework_Assert)
stringContains($string, $case = true)Returns a PHPUnit_Framework_Constraint_StringContains matcher object. (from PHPUnit_Framework_Assert)
stringEndsWith($suffix)Returns a PHPUnit_Framework_Constraint_StringEndsWith matcher object. (from PHPUnit_Framework_Assert)
stringStartsWith($prefix)Returns a PHPUnit_Framework_Constraint_StringStartsWith matcher object. (from PHPUnit_Framework_Assert)

public function __construct($name = null, array $data = array(), $dataName = "")

Constructs a test case with the given name.

Parameters:
string - $dataName
array - $data
Defaults:
name = null
data = array()
dataName = ""

public function addToAssertionCount($count)

Adds a value to the assertion counter.

Parameters:
integer - $count

public static function any()

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

Returns:
PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount

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


public static function at($index)

Returns a matcher that matches when the method it is evaluated for is invoked at the given $index.

Parameters:
integer - $index
Returns:
PHPUnit_Framework_MockObject_Matcher_InvokedAtIndex

public static function atLeast($requiredInvocations)

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

Parameters:
integer - $requiredInvocations
Returns:
PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastCount

public static function atLeastOnce()

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

Returns:
PHPUnit_Framework_MockObject_Matcher_InvokedAtLeastOnce

public static function atMost($allowedInvocations)

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

Parameters:
integer - $allowedInvocations
Returns:
PHPUnit_Framework_MockObject_Matcher_InvokedAtMostCount

protected function checkRequirements()


private function compareGlobalStateSnapshotPart(array $before, array $after, $header)

Parameters:
array - $after
string - $header
Throws:
PHPUnit_Framework_RiskyTestError

private function compareGlobalStateSnapshots(Snapshot $before, Snapshot $after)

Parameters:
Snapshot - $after
Throws:
PHPUnit_Framework_RiskyTestError

public function count()

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

Returns:
integer

private function createGlobalStateSnapshot($backupGlobals)

Parameters:
boolean - $backupGlobals
Returns:
Snapshot

protected function createResult()

Creates a default TestResult object.

Returns:
PHPUnit_Framework_TestResult

public static function exactly($count)

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

Parameters:
integer - $count
Returns:
PHPUnit_Framework_MockObject_Matcher_InvokedCount

public function expectOutputRegex($expectedRegex)

Parameters:
string - $expectedRegex
Throws:
PHPUnit_Framework_Exception

public function expectOutputString($expectedString)

Parameters:
string - $expectedString

public function getActualOutput()

Returns:
string

public function getAnnotations()

Returns the annotations for this test.

Returns:
array

protected function getDataSetAsString($includeData = true)

Gets the data set description of a TestCase.

Parameters:
boolean - $includeData
Defaults:
includeData = true
Returns:
string

public function getExpectedException()

Returns:
string

public function getMock($originalClassName, $methods = array(), array $arguments = array(), $mockClassName = "", $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $cloneArguments = false, $callOriginalMethods = false)

Returns a mock object for the specified class.

Parameters:
string - $mockClassName Class name for the generated test double class.
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.
boolean - $callOriginalMethods
Defaults:
methods = array()
arguments = array()
mockClassName = ""
callOriginalConstructor = true
callOriginalClone = true
callAutoload = true
cloneArguments = false
callOriginalMethods = false
Returns:
PHPUnit_Framework_MockObject_MockObject
Throws:
PHPUnit_Framework_Exception

public function getMockBuilder($className)

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

Parameters:
string - $className
Returns:
PHPUnit_Framework_MockObject_MockBuilder

protected function getMockClass($originalClassName, $methods = array(), array $arguments = array(), $mockClassName = "", $callOriginalConstructor = false, $callOriginalClone = true, $callAutoload = true, $cloneArguments = false)

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

Parameters:
string - $mockClassName
array - $arguments
boolean - $cloneArguments
Defaults:
methods = array()
arguments = array()
mockClassName = ""
callOriginalConstructor = false
callOriginalClone = true
callAutoload = true
cloneArguments = false
Returns:
string
Throws:
PHPUnit_Framework_Exception

public function getMockForAbstractClass($originalClassName, array $arguments = array(), $mockClassName = "", $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = array(), $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 - $mockClassName
array - $mockedMethods
boolean - $cloneArguments
Defaults:
arguments = array()
mockClassName = ""
callOriginalConstructor = true
callOriginalClone = true
callAutoload = true
mockedMethods = array()
cloneArguments = false
Returns:
PHPUnit_Framework_MockObject_MockObject
Throws:
PHPUnit_Framework_Exception

public function getMockForTrait($traitName, array $arguments = array(), $mockClassName = "", $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $mockedMethods = array(), $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 - $mockClassName
array - $mockedMethods
boolean - $cloneArguments
Defaults:
arguments = array()
mockClassName = ""
callOriginalConstructor = true
callOriginalClone = true
callAutoload = true
mockedMethods = array()
cloneArguments = false
Returns:
PHPUnit_Framework_MockObject_MockObject
Throws:
PHPUnit_Framework_Exception

protected function getMockFromWsdl($wsdlFile, $originalClassName = "", $mockClassName = "", array $methods = array(), $callOriginalConstructor = true, array $options = array())

Returns a mock object based on the given WSDL file.

Parameters:
string - $mockClassName
array - $options An array of options passed to SOAPClient::_construct
boolean - $callOriginalConstructor
Defaults:
originalClassName = ""
mockClassName = ""
methods = array()
callOriginalConstructor = true
options = array()
Returns:
PHPUnit_Framework_MockObject_MockObject

protected function getMockObjectGenerator()

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

Returns:
PHPUnit_Framework_MockObject_Generator

public function getName($withDataSet = true)

Gets the name of a TestCase.

Parameters:
boolean - $withDataSet
Defaults:
withDataSet = true
Returns:
string

public function getNumAssertions()

Returns the number of assertions performed by this test.

Returns:
integer

protected function getObjectForTrait($traitName, array $arguments = array(), $traitClassName = "", $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $cloneArguments = false)

Returns an object for the specified trait.

Parameters:
string - $traitClassName
array - $arguments
boolean - $cloneArguments
Defaults:
arguments = array()
traitClassName = ""
callOriginalConstructor = true
callOriginalClone = true
callAutoload = true
cloneArguments = false
Returns:
object
Throws:
PHPUnit_Framework_Exception

private function getProphet()

Returns:
Prophecy\Prophet

public function getResult()

Returns:
mixed

public function getSize()

Returns the size of the test.

Returns:
integer

public function getStatus()

Returns the status of this test.

Returns:
integer

public function getStatusMessage()

Returns the status message of this test.

Returns:
string

public function getTestResultObject()

Returns:
PHPUnit_Framework_TestResult

protected function handleDependencies()


public function hasDependencies()

Returns true if the tests has dependencies

Returns:
boolean

public function hasExpectationOnOutput()

Returns:
bool

public function hasFailed()

Returns whether or not this test has failed.

Returns:
boolean

public function hasOutput()

Returns:
boolean

public function hasPerformedExpectationsOnOutput()

Returns:
bool

protected function iniSet($varName, $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 - $newValue
Throws:
PHPUnit_Framework_Exception

public function isInIsolation()

Returns:
boolean

public static function never()

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

Returns:
PHPUnit_Framework_MockObject_Matcher_InvokedCount

public static function onConsecutiveCalls()

Parameters:
mixed - $value, ...
Returns:
PHPUnit_Framework_MockObject_Stub_ConsecutiveCalls

protected function onNotSuccessfulTest(Exception $e)

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

Parameters:
Exception - $e
Throws:
Exception

public static function once()

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

Returns:
PHPUnit_Framework_MockObject_Matcher_InvokedCount

protected function prepareTemplate(Text_Template $template)

Performs custom preparations on the process isolation template.

Parameters:
Text_Template - $template

protected function prophesize($classOrInterface = null)

Parameters:
string|null - $classOrInterface
Defaults:
classOrInterface = null
Returns:
\Prophecy\Prophecy\ObjectProphecy
Throws:
\LogicException

private function restoreGlobalState()


public static function returnArgument($argumentIndex)

Parameters:
integer - $argumentIndex
Returns:
PHPUnit_Framework_MockObject_Stub_ReturnArgument

public static function returnCallback($callback)

Parameters:
mixed - $callback
Returns:
PHPUnit_Framework_MockObject_Stub_ReturnCallback

public static function returnSelf()

Returns the current object.

This method is useful when mocking a fluent interface.

Returns:
PHPUnit_Framework_MockObject_Stub_ReturnSelf

public static function returnValue($value)

Parameters:
mixed - $value
Returns:
PHPUnit_Framework_MockObject_Stub_Return

public static function returnValueMap(array $valueMap)

Parameters:
array - $valueMap
Returns:
PHPUnit_Framework_MockObject_Stub_ReturnValueMap

public function 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.

Parameters:
PHPUnit_Framework_TestResult - $result
Defaults:
result = null
Returns:
PHPUnit_Framework_TestResult
Throws:
PHPUnit_Framework_Exception

public function runBare()

Runs the bare test sequence.


protected function runTest()

Override to run the test and assert its state.

Returns:
mixed
Throws:
Exception|PHPUnit_Framework_Exception
PHPUnit_Framework_Exception

public function setBackupGlobals($backupGlobals)

Calling this method in setUp() has no effect!

Parameters:
boolean - $backupGlobals

public function setBackupStaticAttributes($backupStaticAttributes)

Calling this method in setUp() has no effect!

Parameters:
boolean - $backupStaticAttributes

public function setDependencies(array $dependencies)

Sets the dependencies of a TestCase.

Parameters:
array - $dependencies

public function setDependencyInput(array $dependencyInput)

Sets

Parameters:
array - $dependencyInput

public function setDisallowChangesToGlobalState($disallowChangesToGlobalState)

Parameters:
boolean - $disallowChangesToGlobalState

public function setExpectedException($exceptionName, $exceptionMessage = "", $exceptionCode = null)

Parameters:
mixed - $exceptionName
string - $exceptionMessage
integer - $exceptionCode
Defaults:
exceptionMessage = ""
exceptionCode = null

protected function setExpectedExceptionFromAnnotation()


public function setExpectedExceptionRegExp($exceptionName, $exceptionMessageRegExp = "", $exceptionCode = null)

Parameters:
mixed - $exceptionName
string - $exceptionMessageRegExp
integer - $exceptionCode
Defaults:
exceptionMessageRegExp = ""
exceptionCode = null

public function setInIsolation($inIsolation)

Parameters:
boolean - $inIsolation
Throws:
PHPUnit_Framework_Exception

protected function setLocale()

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

Parameters:
integer - $category
string - $locale
Throws:
PHPUnit_Framework_Exception

public function setName($name)

Sets the name of a TestCase.

Parameters:
string -

public function setOutputCallback($callback)

Parameters:
callable - $callback
Throws:
PHPUnit_Framework_Exception

public function setPreserveGlobalState($preserveGlobalState)

Parameters:
boolean - $preserveGlobalState
Throws:
PHPUnit_Framework_Exception

public function setResult($result)

Parameters:
mixed - $result

public function setRunTestInSeparateProcess($runTestInSeparateProcess)

Parameters:
boolean - $runTestInSeparateProcess
Throws:
PHPUnit_Framework_Exception

public function setTestResultObject(PHPUnit_Framework_TestResult $result)

Parameters:
PHPUnit_Framework_TestResult - $result

protected function setUp()

Sets up the fixture, for example, open a network connection. This method is called before a test is executed.


public static function setUpBeforeClass()

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


public function setUseErrorHandler($useErrorHandler)

Parameters:
boolean - $useErrorHandler

protected function setUseErrorHandlerFromAnnotation()


private function snapshotGlobalState()


private function startOutputBuffering()


private function stopOutputBuffering()


protected function tearDown()

Tears down the fixture, for example, close a network connection. This method is called after a test is executed.


public static function tearDownAfterClass()

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


public static function throwException(Exception $exception)

Parameters:
Exception - $exception
Returns:
PHPUnit_Framework_MockObject_Stub_Exception

public function toString()

Returns a string representation of the test case.

Returns:
string

protected function verifyMockObjects()

Verifies the mock object expectations.