Skip to content

ModelTestCase

ModelTestCase is the base class for all model testcases and provides the necessary assertions

abstract class ModelTestCase extends UnitTestCase

ExtendsUnitTestCase
Since1.0.0
SourceTesting/ModelTestCase.php

These come from an ancestor and are documented where they are declared.

MethodDeclared inDescription
anything()Assert
arrayHasKey()Assert
assertArrayHasKey()AssertAsserts that an array has a specified key.
assertArrayIsEqualToArrayIgnoringListOfKeys()AssertAsserts that two arrays are equal while ignoring a list of keys.
assertArrayIsEqualToArrayOnlyConsideringListOfKeys()AssertAsserts that two arrays are equal while only considering a list of keys.
assertArrayIsIdenticalToArrayIgnoringListOfKeys()AssertAsserts that two arrays are equal while ignoring a list of keys.
assertArrayIsIdenticalToArrayOnlyConsideringListOfKeys()AssertAsserts that two arrays are identical while only considering a list of keys.
assertArrayNotHasKey()AssertAsserts that an array does not have a specified key.
assertArraysAreEqual()AssertAssert that two arrays are equal.
assertArraysAreEqualIgnoringOrder()AssertAssert that two arrays are equal while ignoring the order of their values.
assertArraysAreIdentical()AssertAssert that two arrays are identical.
assertArraysAreIdenticalIgnoringOrder()AssertAssert that two arrays are identical while ignoring the order of their values.
assertArraysHaveEqualValues()AssertAssert that two arrays have equal values.
assertArraysHaveEqualValuesIgnoringOrder()AssertAssert that two arrays have equal values while ignoring the order of these values.
assertArraysHaveIdenticalValues()AssertAssert that two arrays have identical values.
assertArraysHaveIdenticalValuesIgnoringOrder()AssertAssert that two arrays have identical values while ignoring the order of these values.
assertContains()AssertAsserts that a haystack contains a needle.
assertContainsEquals()Assert
assertContainsNotOnlyArray()AssertAsserts that a haystack does not contain only values of type array.
assertContainsNotOnlyBool()AssertAsserts that a haystack does not contain only values of type bool.
assertContainsNotOnlyCallable()AssertAsserts that a haystack does not contain only values of type callable.
assertContainsNotOnlyClosedResource()AssertAsserts that a haystack does not contain only values of type closed resource.
assertContainsNotOnlyFloat()AssertAsserts that a haystack does not contain only values of type float.
assertContainsNotOnlyInstancesOf()AssertAsserts that a haystack does not contain only instances of a specified interface or class name.
assertContainsNotOnlyInt()AssertAsserts that a haystack does not contain only values of type int.
assertContainsNotOnlyIterable()AssertAsserts that a haystack does not contain only values of type iterable.
assertContainsNotOnlyNull()AssertAsserts that a haystack does not contain only values of type null.
assertContainsNotOnlyNumeric()AssertAsserts that a haystack does not contain only values of type numeric.
assertContainsNotOnlyObject()AssertAsserts that a haystack does not contain only values of type object.
assertContainsNotOnlyResource()AssertAsserts that a haystack does not contain only values of type resource.
assertContainsNotOnlyScalar()AssertAsserts that a haystack does not contain only values of type scalar.
assertContainsNotOnlyString()AssertAsserts that a haystack does not contain only values of type string.
assertContainsOnlyArray()AssertAsserts that a haystack contains only values of type array.
assertContainsOnlyBool()AssertAsserts that a haystack contains only values of type bool.
assertContainsOnlyCallable()AssertAsserts that a haystack contains only values of type callable.
assertContainsOnlyClosedResource()AssertAsserts that a haystack contains only values of type closed resource.
assertContainsOnlyFloat()AssertAsserts that a haystack contains only values of type float.
assertContainsOnlyInstancesOf()AssertAsserts that a haystack contains only instances of a specified interface or class name.
assertContainsOnlyInt()AssertAsserts that a haystack contains only values of type int.
assertContainsOnlyIterable()AssertAsserts that a haystack contains only values of type iterable.
assertContainsOnlyNull()AssertAsserts that a haystack contains only values of type null.
assertContainsOnlyNumeric()AssertAsserts that a haystack contains only values of type numeric.
assertContainsOnlyObject()AssertAsserts that a haystack contains only values of type object.
assertContainsOnlyResource()AssertAsserts that a haystack contains only values of type resource.
assertContainsOnlyScalar()AssertAsserts that a haystack contains only values of type scalar.
assertContainsOnlyString()AssertAsserts that a haystack contains only values of type string.
assertCount()AssertAsserts the number of elements of an array, Countable or Traversable.
assertDirectoryDoesNotExist()AssertAsserts that a directory does not exist.
assertDirectoryExists()AssertAsserts that a directory exists.
assertDirectoryIsNotReadable()AssertAsserts that a directory exists and is not readable.
assertDirectoryIsNotWritable()AssertAsserts that a directory exists and is not writable.
assertDirectoryIsReadable()AssertAsserts that a directory exists and is readable.
assertDirectoryIsWritable()AssertAsserts that a directory exists and is writable.
assertDoesNotMatchRegularExpression()AssertAsserts that a string does not match a given regular expression.
assertEmpty()AssertAsserts that a variable is empty.
assertEquals()AssertAsserts that two variables are equal.
assertEqualsCanonicalizing()AssertAsserts that two variables are equal (canonicalizing).
assertEqualsIgnoringCase()AssertAsserts that two variables are equal (ignoring case).
assertEqualsWithDelta()AssertAsserts that two variables are equal (with delta).
assertFalse()AssertAsserts that a condition is false.
assertFileDoesNotExist()AssertAsserts that a file does not exist.
assertFileEquals()AssertAsserts that the contents of one file is equal to the contents of another file.
assertFileEqualsCanonicalizing()AssertAsserts that the contents of one file is equal to the contents of another file (canonicalizing).
assertFileEqualsFileIgnoringWhitespace()AssertAsserts that the contents of one file is equal to the contents of another file (ignoring whitespace).
assertFileEqualsIgnoringCase()AssertAsserts that the contents of one file is equal to the contents of another file (ignoring case).
assertFileExists()AssertAsserts that a file exists.
assertFileIsNotReadable()AssertAsserts that a file exists and is not readable.
assertFileIsNotWritable()AssertAsserts that a file exists and is not writable.
assertFileIsReadable()AssertAsserts that a file exists and is readable.
assertFileIsWritable()AssertAsserts that a file exists and is writable.
assertFileMatchesFormat()AssertAsserts that a string matches a given format string.
assertFileMatchesFormatFile()AssertAsserts that a string matches a given format string.
assertFileNotEquals()AssertAsserts that the contents of one file is not equal to the contents of another file.
assertFileNotEqualsCanonicalizing()AssertAsserts that the contents of one file is not equal to the contents of another file (canonicalizing).
assertFileNotEqualsFileIgnoringWhitespace()AssertAsserts that the contents of one file is not equal to the contents of another file (ignoring whitespace).
assertFileNotEqualsIgnoringCase()AssertAsserts that the contents of one file is not equal to the contents of another file (ignoring case).
assertFinite()AssertAsserts that a variable is finite.
assertGreaterThan()AssertAsserts that a value is greater than another value.
assertGreaterThanOrEqual()AssertAsserts that a value is greater than or equal to another value.
assertInfinite()AssertAsserts that a variable is infinite.
assertInstanceOf()AssertAsserts that a variable is of a given type.
assertIsArray()AssertAsserts that a variable is of type array.
assertIsBool()AssertAsserts that a variable is of type bool.
assertIsCallable()AssertAsserts that a variable is of type callable.
assertIsClosedResource()AssertAsserts that a variable is of type resource and is closed.
assertIsFloat()AssertAsserts that a variable is of type float.
assertIsInt()AssertAsserts that a variable is of type int.
assertIsIterable()AssertAsserts that a variable is of type iterable.
assertIsList()Assert
assertIsNotArray()AssertAsserts that a variable is not of type array.
assertIsNotBool()AssertAsserts that a variable is not of type bool.
assertIsNotCallable()AssertAsserts that a variable is not of type callable.
assertIsNotClosedResource()AssertAsserts that a variable is not of type resource.
assertIsNotFloat()AssertAsserts that a variable is not of type float.
assertIsNotInt()AssertAsserts that a variable is not of type int.
assertIsNotIterable()AssertAsserts that a variable is not of type iterable.
assertIsNotNumeric()AssertAsserts that a variable is not of type numeric.
assertIsNotObject()AssertAsserts that a variable is not of type object.
assertIsNotReadable()AssertAsserts that a file/dir exists and is not readable.
assertIsNotResource()AssertAsserts that a variable is not of type resource.
assertIsNotScalar()AssertAsserts that a variable is not of type scalar.
assertIsNotString()AssertAsserts that a variable is not of type string.
assertIsNotWritable()AssertAsserts that a file/dir exists and is not writable.
assertIsNumeric()AssertAsserts that a variable is of type numeric.
assertIsObject()AssertAsserts that a variable is of type object.
assertIsReadable()AssertAsserts that a file/dir is readable.
assertIsResource()AssertAsserts that a variable is of type resource.
assertIsScalar()AssertAsserts that a variable is of type scalar.
assertIsString()AssertAsserts that a variable is of type string.
assertIsWritable()AssertAsserts that a file/dir exists and is writable.
assertJson()AssertAsserts that a string is a valid JSON string.
assertJsonFileEqualsJsonFile()AssertAsserts that two JSON files are equal.
assertJsonFileNotEqualsJsonFile()AssertAsserts that two JSON files are not equal.
assertJsonStringEqualsJsonFile()AssertAsserts that the generated JSON encoded object and the content of the given file are equal.
assertJsonStringEqualsJsonString()AssertAsserts that two given JSON encoded objects or arrays are equal.
assertJsonStringNotEqualsJsonFile()AssertAsserts that the generated JSON encoded object and the content of the given file are not equal.
assertJsonStringNotEqualsJsonString()AssertAsserts that two given JSON encoded objects or arrays are not equal.
assertLessThan()AssertAsserts that a value is smaller than another value.
assertLessThanOrEqual()AssertAsserts that a value is smaller than or equal to another value.
assertMatchesRegularExpression()AssertAsserts that a string matches a given regular expression.
assertNan()AssertAsserts that a variable is nan.
assertNotContains()AssertAsserts that a haystack does not contain a needle.
assertNotContainsEquals()Assert
assertNotCount()AssertAsserts the number of elements of an array, Countable or Traversable.
assertNotEmpty()AssertAsserts that a variable is not empty.
assertNotEquals()AssertAsserts that two variables are not equal.
assertNotEqualsCanonicalizing()AssertAsserts that two variables are not equal (canonicalizing).
assertNotEqualsIgnoringCase()AssertAsserts that two variables are not equal (ignoring case).
assertNotEqualsWithDelta()AssertAsserts that two variables are not equal (with delta).
assertNotFalse()AssertAsserts that a condition is not false.
assertNotInstanceOf()AssertAsserts that a variable is not of a given type.
assertNotNull()AssertAsserts that a variable is not null.
assertNotSame()AssertAsserts that two variables do not have the same type and value.
assertNotSameSize()AssertAssert that the size of two arrays (or Countable or Traversable objects) is not the same.
assertNotTrue()AssertAsserts that a condition is not true.
assertNull()AssertAsserts that a variable is null.
assertObjectEquals()Assert
assertObjectHasProperty()AssertAsserts that an object has a specified property.
assertObjectNotEquals()Assert
assertObjectNotHasProperty()AssertAsserts that an object does not have a specified property.
assertSame()AssertAsserts that two variables have the same type and value.
assertSameSize()AssertAssert that the size of two arrays (or Countable or Traversable objects) is the same.
assertStringContainsString()Assert
assertStringContainsStringIgnoringCase()Assert
assertStringContainsStringIgnoringLineEndings()Assert
assertStringEndsNotWith()AssertAsserts that a string ends not with a given suffix.
assertStringEndsWith()AssertAsserts that a string ends with a given suffix.
assertStringEqualsFile()AssertAsserts that the contents of a string is equal to the contents of a file.
assertStringEqualsFileCanonicalizing()AssertAsserts that the contents of a string is equal to the contents of a file (canonicalizing).
assertStringEqualsFileIgnoringCase()AssertAsserts that the contents of a string is equal to the contents of a file (ignoring case).
assertStringEqualsFileIgnoringWhitespace()AssertAsserts that the contents of a string is equal to the contents of a file (ignoring whitespace).
assertStringEqualsStringIgnoringLineEndings()AssertAsserts that two strings are equal except for line endings.
assertStringEqualsStringIgnoringWhitespace()AssertAsserts that two strings are equal ignoring whitespace.
assertStringMatchesFormat()AssertAsserts that a string matches a given format string.
assertStringMatchesFormatFile()AssertAsserts that a string matches a given format file.
assertStringNotContainsString()Assert
assertStringNotContainsStringIgnoringCase()Assert
assertStringNotEqualsFile()AssertAsserts that the contents of a string is not equal to the contents of a file.
assertStringNotEqualsFileCanonicalizing()AssertAsserts that the contents of a string is not equal to the contents of a file (canonicalizing).
assertStringNotEqualsFileIgnoringCase()AssertAsserts that the contents of a string is not equal to the contents of a file (ignoring case).
assertStringNotEqualsFileIgnoringWhitespace()AssertAsserts that the contents of a string is not equal to the contents of a file (ignoring whitespace).
assertStringNotEqualsStringIgnoringWhitespace()AssertAsserts that two strings are not equal ignoring whitespace.
assertStringStartsNotWith()AssertAsserts that a string starts not with a given prefix.
assertStringStartsWith()AssertAsserts that a string starts with a given prefix.
assertThat()AssertEvaluates a PHPUnit\Framework\Constraint matcher object.
assertTrue()AssertAsserts that a condition is true.
assertXmlFileEqualsXmlFile()AssertAsserts that two XML files are equal, ignoring comments.
assertXmlFileEqualsXmlFileConsideringComments()AssertAsserts that two XML files are equal, considering comments.
assertXmlFileNotEqualsXmlFile()AssertAsserts that two XML files are not equal, ignoring comments.
assertXmlFileNotEqualsXmlFileConsideringComments()AssertAsserts that two XML files are not equal, considering comments.
assertXmlStringEqualsXmlFile()AssertAsserts that two XML documents are equal, ignoring comments.
assertXmlStringEqualsXmlFileConsideringComments()AssertAsserts that two XML documents are equal, considering comments.
assertXmlStringEqualsXmlString()AssertAsserts that two XML documents are equal, ignoring comments.
assertXmlStringEqualsXmlStringConsideringComments()AssertAsserts that two XML documents are equal, considering comments.
assertXmlStringNotEqualsXmlFile()AssertAsserts that two XML documents are not equal, ignoring comments.
assertXmlStringNotEqualsXmlFileConsideringComments()AssertAsserts that two XML documents are not equal, considering comments.
assertXmlStringNotEqualsXmlString()AssertAsserts that two XML documents are not equal, ignoring comments.
assertXmlStringNotEqualsXmlStringConsideringComments()AssertAsserts that two XML documents are not equal, considering comments.
callback()Assert
containsEqual()Assert
containsIdentical()Assert
containsOnlyArray()Assert
containsOnlyBool()Assert
containsOnlyCallable()Assert
containsOnlyClosedResource()Assert
containsOnlyFloat()Assert
containsOnlyInstancesOf()Assert
containsOnlyInt()Assert
containsOnlyIterable()Assert
containsOnlyNull()Assert
containsOnlyNumeric()Assert
containsOnlyObject()Assert
containsOnlyResource()Assert
containsOnlyScalar()Assert
containsOnlyString()Assert
countOf()Assert
createAttribute()PhpUnitTestCaseCreate attributes for custom annotations
directoryExists()Assert
equalTo()Assert
equalToCanonicalizing()Assert
equalToIgnoringCase()Assert
equalToWithDelta()Assert
fail()AssertFails a test with the given message.
fileExists()Assert
getClearCache()PhpUnitTestCasecheck whether to clear the cache in isolated tests
getContext()UnitTestCaseReturn the context defined for this test (or the default one).
getCount()AssertReturn the current assertion count.
getIsolationDefaultContext()PhpUnitTestCaseget the default context to use in isolated tests
getIsolationEnvironment()PhpUnitTestCaseget the environment to bootstrap in isolated tests
greaterThan()Assert
greaterThanOrEqual()Assert
identicalTo()Assert
isArray()Assert
isBool()Assert
isCallable()Assert
isClosedResource()Assert
isEmpty()Assert
isFalse()Assert
isFinite()Assert
isFloat()Assert
isInfinite()Assert
isInstanceOf()Assert
isInt()Assert
isIterable()Assert
isJson()Assert
isList()Assert
isNan()Assert
isNull()Assert
isNumeric()Assert
isObject()Assert
isReadable()Assert
isResource()Assert
isScalar()Assert
isString()Assert
isTrue()Assert
isWritable()Assert
lessThan()Assert
lessThanOrEqual()Assert
logicalAnd()Assert
logicalNot()Assert
logicalOr()Assert
logicalXor()Assert
markTestIncomplete()AssertMark the test as incomplete.
markTestSkipped()AssertMark the test as skipped.
matches()Assert
matchesRegularExpression()Assert
objectEquals()Assert
resetCount()AssertReset the assertion counter.
setClearCache()PhpUnitTestCaseset whether the cache should be cleared for the isolated subprocess
setIsolationDefaultContext()PhpUnitTestCaseset the default context to use in isolated tests
setIsolationEnvironment()PhpUnitTestCaseset the environment to bootstrap in isolated tests
setUpBeforeClass()TestCaseThis method is called before the first test of this test class is run.
stringContains()Assert
stringEndsWith()Assert
stringEqualsStringIgnoringLineEndings()Assert
stringEqualsStringIgnoringWhitespace()Assert
stringStartsWith()Assert
tearDownAfterClass()TestCaseThis method is called after the last test of this test class is run.