Documentation

FeatureTestCase extends CIUnitTestCase
in package
Uses DatabaseTestTrait

Class FeatureTestCase

Provides a base class with the trait for doing full HTTP testing against your application.

Tags
deprecated

Use FeatureTestTrait instead

codeCoverageIgnore

Table of Contents

LOCALE_CATEGORIES  = [LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME]
$app  : CodeIgniter
$backupGlobals  : bool|null
$backupGlobalsBlacklist  : array<string|int, string>
$backupGlobalsExcludeList  : array<string|int, string>
$backupStaticAttributes  : bool
$backupStaticAttributesBlacklist  : array<string, array<int, string>>
$backupStaticAttributesExcludeList  : array<string, array<int, string>>
$basePath  : string
The path to the seeds directory.
$bodyFormat  : string
Allows for formatting the request body to what the controller is going to expect
$clean  : bool
Enabled auto clean op buffer after request call
$db  : BaseConnection
Our database connection.
$DBGroup  : string
The name of the database group to connect to.
$headers  : array<string|int, mixed>
Custom request's headers
$insertCache  : array<string|int, mixed>
Stores information needed to remove any rows inserted via $this->hasInDatabase();
$migrate  : bool
Should run db migration?
$migrateOnce  : bool
Should run db migration only once?
$migrations  : MigrationRunner|mixed
Migration Runner instance.
$namespace  : string|array<string|int, mixed>|null
The namespace(s) to help us find the migration classes.
$preserveGlobalState  : bool
$providedTests  : list<string|int, ExecutionOrderDependency>
$refresh  : bool
Should the db be refreshed before test?
$requestBody  : mixed
Allows for directly setting the body to what it needs to be.
$routes  : RouteCollection|null
If present, will override application routes when using call().
$runTestInSeparateProcess  : bool
$seed  : string|array<string|int, mixed>
The seed file(s) used for all tests within this test case.
$seeder  : Seeder
Seeder instance
$seedOnce  : bool
Should run seeding only once?
$session  : array<string|int, mixed>
Values to be set in the SESSION global before running the test.
$setUpMethods  : array<string|int, mixed>
Methods to run during setUp.
$tearDownMethods  : array<string|int, mixed>
Methods to run during tearDown.
$beStrictAboutChangesToGlobalState  : bool
$count  : int
$customComparators  : array<string|int, Comparator>
$data  : array<string|int, mixed>
$dataName  : int|string
$dependencies  : list<string|int, ExecutionOrderDependency>
$dependencyInput  : array<string|int, mixed>
$doesNotPerformAssertions  : bool
$doneMigration  : bool
Is db migration done once or more than once?
$doneSeed  : bool
Is seeding done once or more than once?
$doubledTypes  : array<string|int, string>
$expectedException  : null|string
$expectedExceptionCode  : null|int|string
$expectedExceptionMessage  : null|string
$expectedExceptionMessageRegExp  : null|string
$groups  : array<string|int, string>
$iniSettings  : array<string, string>
$inIsolation  : bool
$locale  : array<string|int, mixed>
$mockObjectGenerator  : Generator
$mockObjects  : array<string|int, MockObject>
$name  : string
$numAssertions  : int
$output  : string
$outputBufferingActive  : bool
$outputBufferingLevel  : int
$outputCallback  : mixed
$outputExpectedRegex  : string|null
$outputExpectedString  : string|null
$outputRetrievedForAssertion  : bool
$prophet  : Prophet
$registerMockObjectsFromTestArgumentsRecursively  : bool
$result  : TestResult
$runClassInSeparateProcess  : bool
$snapshot  : Snapshot|null
$status  : int
$statusMessage  : string
$testResult  : mixed
$traits  : array<string|int, string>|null
Store of identified traits.
$warnings  : array<string|int, string>
any()  : AnyInvokedCount
Returns a matcher that matches when the method is executed zero or more times.
anything()  : IsAnything
arrayHasKey()  : ArrayHasKey
assertArrayHasKey()  : void
Asserts that an array has a specified key.
assertArrayNotHasKey()  : void
Asserts that an array does not have a specified key.
assertClassHasAttribute()  : void
Asserts that a class has a specified attribute.
assertClassHasStaticAttribute()  : void
Asserts that a class has a specified static attribute.
assertClassNotHasAttribute()  : void
Asserts that a class does not have a specified attribute.
assertClassNotHasStaticAttribute()  : void
Asserts that a class does not have a specified static attribute.
assertCloseEnough()  : mixed
Custom function to test that two values are "close enough".
assertCloseEnoughString()  : void|bool
Custom function to test that two values are "close enough".
assertContains()  : void
Asserts that a haystack contains a needle.
assertContainsEquals()  : void
assertContainsOnly()  : void
Asserts that a haystack contains only values of a given type.
assertContainsOnlyInstancesOf()  : void
Asserts that a haystack contains only instances of a given class name.
assertCount()  : void
Asserts the number of elements of an array, Countable or Traversable.
assertDirectoryDoesNotExist()  : void
Asserts that a directory does not exist.
assertDirectoryExists()  : void
Asserts that a directory exists.
assertDirectoryIsNotReadable()  : void
Asserts that a directory exists and is not readable.
assertDirectoryIsNotWritable()  : void
Asserts that a directory exists and is not writable.
assertDirectoryIsReadable()  : void
Asserts that a directory exists and is readable.
assertDirectoryIsWritable()  : void
Asserts that a directory exists and is writable.
assertDirectoryNotExists()  : void
Asserts that a directory does not exist.
assertDirectoryNotIsReadable()  : void
Asserts that a directory exists and is not readable.
assertDirectoryNotIsWritable()  : void
Asserts that a directory exists and is not writable.
assertDoesNotMatchRegularExpression()  : void
Asserts that a string does not match a given regular expression.
assertEmpty()  : void
Asserts that a variable is empty.
assertEquals()  : void
Asserts that two variables are equal.
assertEqualsCanonicalizing()  : void
Asserts that two variables are equal (canonicalizing).
assertEqualsIgnoringCase()  : void
Asserts that two variables are equal (ignoring case).
assertEqualsWithDelta()  : void
Asserts that two variables are equal (with delta).
assertEqualXMLStructure()  : void
Asserts that a hierarchy of DOMElements matches.
assertEventTriggered()  : bool
Hooks into CodeIgniter's Events system to check if a specific event was triggered or not.
assertFalse()  : void
Asserts that a condition is false.
assertFileDoesNotExist()  : void
Asserts that a file does not exist.
assertFileEquals()  : void
Asserts that the contents of one file is equal to the contents of another file.
assertFileEqualsCanonicalizing()  : void
Asserts that the contents of one file is equal to the contents of another file (canonicalizing).
assertFileEqualsIgnoringCase()  : void
Asserts that the contents of one file is equal to the contents of another file (ignoring case).
assertFileExists()  : void
Asserts that a file exists.
assertFileIsNotReadable()  : void
Asserts that a file exists and is not readable.
assertFileIsNotWritable()  : void
Asserts that a file exists and is not writable.
assertFileIsReadable()  : void
Asserts that a file exists and is readable.
assertFileIsWritable()  : void
Asserts that a file exists and is writable.
assertFileNotEquals()  : void
Asserts that the contents of one file is not equal to the contents of another file.
assertFileNotEqualsCanonicalizing()  : void
Asserts that the contents of one file is not equal to the contents of another file (canonicalizing).
assertFileNotEqualsIgnoringCase()  : void
Asserts that the contents of one file is not equal to the contents of another file (ignoring case).
assertFileNotExists()  : void
Asserts that a file does not exist.
assertFileNotIsReadable()  : void
Asserts that a file exists and is not readable.
assertFileNotIsWritable()  : void
Asserts that a file exists and is not writable.
assertFinite()  : void
Asserts that a variable is finite.
assertGreaterThan()  : void
Asserts that a value is greater than another value.
assertGreaterThanOrEqual()  : void
Asserts that a value is greater than or equal to another value.
assertHeaderEmitted()  : void
Hooks into xdebug's headers capture, looking for a specific header emitted
assertHeaderNotEmitted()  : void
Hooks into xdebug's headers capture, looking for a specific header emitted
assertInfinite()  : void
Asserts that a variable is infinite.
assertInstanceOf()  : void
Asserts that a variable is of a given type.
assertIsArray()  : void
Asserts that a variable is of type array.
assertIsBool()  : void
Asserts that a variable is of type bool.
assertIsCallable()  : void
Asserts that a variable is of type callable.
assertIsClosedResource()  : void
Asserts that a variable is of type resource and is closed.
assertIsFloat()  : void
Asserts that a variable is of type float.
assertIsInt()  : void
Asserts that a variable is of type int.
assertIsIterable()  : void
Asserts that a variable is of type iterable.
assertIsNotArray()  : void
Asserts that a variable is not of type array.
assertIsNotBool()  : void
Asserts that a variable is not of type bool.
assertIsNotCallable()  : void
Asserts that a variable is not of type callable.
assertIsNotClosedResource()  : void
Asserts that a variable is not of type resource.
assertIsNotFloat()  : void
Asserts that a variable is not of type float.
assertIsNotInt()  : void
Asserts that a variable is not of type int.
assertIsNotIterable()  : void
Asserts that a variable is not of type iterable.
assertIsNotNumeric()  : void
Asserts that a variable is not of type numeric.
assertIsNotObject()  : void
Asserts that a variable is not of type object.
assertIsNotReadable()  : void
Asserts that a file/dir exists and is not readable.
assertIsNotResource()  : void
Asserts that a variable is not of type resource.
assertIsNotScalar()  : void
Asserts that a variable is not of type scalar.
assertIsNotString()  : void
Asserts that a variable is not of type string.
assertIsNotWritable()  : void
Asserts that a file/dir exists and is not writable.
assertIsNumeric()  : void
Asserts that a variable is of type numeric.
assertIsObject()  : void
Asserts that a variable is of type object.
assertIsReadable()  : void
Asserts that a file/dir is readable.
assertIsResource()  : void
Asserts that a variable is of type resource.
assertIsScalar()  : void
Asserts that a variable is of type scalar.
assertIsString()  : void
Asserts that a variable is of type string.
assertIsWritable()  : void
Asserts that a file/dir exists and is writable.
assertJson()  : void
Asserts that a string is a valid JSON string.
assertJsonFileEqualsJsonFile()  : void
Asserts that two JSON files are equal.
assertJsonFileNotEqualsJsonFile()  : void
Asserts that two JSON files are not equal.
assertJsonStringEqualsJsonFile()  : void
Asserts that the generated JSON encoded object and the content of the given file are equal.
assertJsonStringEqualsJsonString()  : void
Asserts that two given JSON encoded objects or arrays are equal.
assertJsonStringNotEqualsJsonFile()  : void
Asserts that the generated JSON encoded object and the content of the given file are not equal.
assertJsonStringNotEqualsJsonString()  : void
Asserts that two given JSON encoded objects or arrays are not equal.
assertLessThan()  : void
Asserts that a value is smaller than another value.
assertLessThanOrEqual()  : void
Asserts that a value is smaller than or equal to another value.
assertLogged()  : bool
Custom function to hook into CodeIgniter's Logging mechanism to check if certain messages were logged during code execution.
assertMatchesRegularExpression()  : void
Asserts that a string matches a given regular expression.
assertNan()  : void
Asserts that a variable is nan.
assertNotContains()  : void
Asserts that a haystack does not contain a needle.
assertNotContainsEquals()  : void
assertNotContainsOnly()  : void
Asserts that a haystack does not contain only values of a given type.
assertNotCount()  : void
Asserts the number of elements of an array, Countable or Traversable.
assertNotEmpty()  : void
Asserts that a variable is not empty.
assertNotEquals()  : void
Asserts that two variables are not equal.
assertNotEqualsCanonicalizing()  : void
Asserts that two variables are not equal (canonicalizing).
assertNotEqualsIgnoringCase()  : void
Asserts that two variables are not equal (ignoring case).
assertNotEqualsWithDelta()  : void
Asserts that two variables are not equal (with delta).
assertNotFalse()  : void
Asserts that a condition is not false.
assertNotInstanceOf()  : void
Asserts that a variable is not of a given type.
assertNotIsReadable()  : void
Asserts that a file/dir exists and is not readable.
assertNotIsWritable()  : void
Asserts that a file/dir exists and is not writable.
assertNotNull()  : void
Asserts that a variable is not null.
assertNotRegExp()  : void
Asserts that a string does not match a given regular expression.
assertNotSame()  : void
Asserts that two variables do not have the same type and value.
assertNotSameSize()  : void
Assert that the size of two arrays (or `Countable` or `Traversable` objects) is not the same.
assertNotTrue()  : void
Asserts that a condition is not true.
assertNull()  : void
Asserts that a variable is null.
assertObjectEquals()  : void
assertObjectHasAttribute()  : void
Asserts that an object has a specified attribute.
assertObjectNotHasAttribute()  : void
Asserts that an object does not have a specified attribute.
assertRegExp()  : void
Asserts that a string matches a given regular expression.
assertSame()  : void
Asserts that two variables have the same type and value.
assertSameSize()  : void
Assert that the size of two arrays (or `Countable` or `Traversable` objects) is the same.
assertStringContainsString()  : void
assertStringContainsStringIgnoringCase()  : void
assertStringEndsNotWith()  : void
Asserts that a string ends not with a given suffix.
assertStringEndsWith()  : void
Asserts that a string ends with a given suffix.
assertStringEqualsFile()  : void
Asserts that the contents of a string is equal to the contents of a file.
assertStringEqualsFileCanonicalizing()  : void
Asserts that the contents of a string is equal to the contents of a file (canonicalizing).
assertStringEqualsFileIgnoringCase()  : void
Asserts that the contents of a string is equal to the contents of a file (ignoring case).
assertStringMatchesFormat()  : void
Asserts that a string matches a given format string.
assertStringMatchesFormatFile()  : void
Asserts that a string matches a given format file.
assertStringNotContainsString()  : void
assertStringNotContainsStringIgnoringCase()  : void
assertStringNotEqualsFile()  : void
Asserts that the contents of a string is not equal to the contents of a file.
assertStringNotEqualsFileCanonicalizing()  : void
Asserts that the contents of a string is not equal to the contents of a file (canonicalizing).
assertStringNotEqualsFileIgnoringCase()  : void
Asserts that the contents of a string is not equal to the contents of a file (ignoring case).
assertStringNotMatchesFormat()  : void
Asserts that a string does not match a given format string.
assertStringNotMatchesFormatFile()  : void
Asserts that a string does not match a given format string.
assertStringStartsNotWith()  : void
Asserts that a string starts not with a given prefix.
assertStringStartsWith()  : void
Asserts that a string starts with a given prefix.
assertThat()  : void
Evaluates a PHPUnit\Framework\Constraint matcher object.
assertTrue()  : void
Asserts that a condition is true.
assertXmlFileEqualsXmlFile()  : void
Asserts that two XML files are equal.
assertXmlFileNotEqualsXmlFile()  : void
Asserts that two XML files are not equal.
assertXmlStringEqualsXmlFile()  : void
Asserts that two XML documents are equal.
assertXmlStringEqualsXmlString()  : void
Asserts that two XML documents are equal.
assertXmlStringNotEqualsXmlFile()  : void
Asserts that two XML documents are not equal.
assertXmlStringNotEqualsXmlString()  : void
Asserts that two XML documents are not equal.
at()  : InvokedAtIndex
Returns a matcher that matches when the method is executed at the given index.
atLeast()  : InvokedAtLeastCount
Returns a matcher that matches when the method is executed at least N times.
atLeastOnce()  : InvokedAtLeastOnce
Returns a matcher that matches when the method is executed at least once.
atMost()  : InvokedAtMostCount
Returns a matcher that matches when the method is executed at most N times.
call()  : FeatureResponse
Calls a single URI, executes it, and returns a FeatureResponse instance that can be used to run many assertions against.
callback()  : Callback
classHasAttribute()  : ClassHasAttribute
classHasStaticAttribute()  : ClassHasStaticAttribute
containsEqual()  : TraversableContainsEqual
containsIdentical()  : TraversableContainsIdentical
containsOnly()  : TraversableContainsOnly
containsOnlyInstancesOf()  : TraversableContainsOnly
count()  : int
countOf()  : Count
delete()  : FeatureResponse
Performs a DELETE request.
directoryExists()  : DirectoryExists
dontSeeInDatabase()  : void
Asserts that records that match the conditions in $where do not exist in the database.
equalTo()  : IsEqual
equalToCanonicalizing()  : IsEqualCanonicalizing
equalToIgnoringCase()  : IsEqualIgnoringCase
equalToWithDelta()  : IsEqualWithDelta
exactly()  : InvokedCount
Returns a matcher that matches when the method is executed exactly $count times.
expectDeprecation()  : void
expectDeprecationMessage()  : void
expectDeprecationMessageMatches()  : void
expectError()  : void
expectErrorMessage()  : void
expectErrorMessageMatches()  : void
expectException()  : void
expectExceptionCode()  : void
expectExceptionMessage()  : void
expectExceptionMessageMatches()  : void
expectExceptionObject()  : void
Sets up an expectation for an exception to be raised by the code under test.
expectNotice()  : void
expectNoticeMessage()  : void
expectNoticeMessageMatches()  : void
expectNotToPerformAssertions()  : void
expectOutputRegex()  : void
expectOutputString()  : void
expectWarning()  : void
expectWarningMessage()  : void
expectWarningMessageMatches()  : void
fail()  : void
Fails a test with the given message.
fileExists()  : FileExists
get()  : FeatureResponse
Performs a GET request.
getActualOutputForAssertion()  : string
getCount()  : int
Return the current assertion count.
getMockBuilder()  : MockBuilder
Returns a builder object to create mock objects using a fluent interface.
getPrivateMethodInvoker()  : Closure
Find a private method invoker.
getPrivateProperty()  : mixed
Retrieve a private property.
getStatus()  : int
getStatusMessage()  : string
grabFromDatabase()  : bool
Fetches a single column from a database row with criteria matching $where.
greaterThan()  : GreaterThan
greaterThanOrEqual()  : LogicalOr
hasFailed()  : bool
hasInDatabase()  : bool
Inserts a row into to the database. This row will be removed after the test has run.
identicalTo()  : IsIdentical
isEmpty()  : IsEmpty
isFalse()  : IsFalse
isFinite()  : IsFinite
isInfinite()  : IsInfinite
isInstanceOf()  : IsInstanceOf
isJson()  : IsJson
isNan()  : IsNan
isNull()  : IsNull
isReadable()  : IsReadable
isTrue()  : IsTrue
isType()  : IsType
isWritable()  : IsWritable
lessThan()  : LessThan
lessThanOrEqual()  : LogicalOr
loadBuilder()  : BaseBuilder
Loads the Builder class appropriate for the current database.
loadDependencies()  : mixed
Load any database test dependencies.
logicalAnd()  : LogicalAnd
logicalNot()  : LogicalNot
logicalOr()  : LogicalOr
logicalXor()  : LogicalXor
markAsRisky()  : void
markTestIncomplete()  : void
Mark the test as incomplete.
markTestSkipped()  : void
Mark the test as skipped.
matches()  : StringMatchesFormatDescription
matchesRegularExpression()  : RegularExpression
never()  : InvokedCount
Returns a matcher that matches when the method is never executed.
objectEquals()  : ObjectEquals
objectHasAttribute()  : ObjectHasAttribute
once()  : InvokedCount
Returns a matcher that matches when the method is executed exactly once.
onConsecutiveCalls()  : ConsecutiveCalls
options()  : FeatureResponse
Performs an OPTIONS request.
patch()  : FeatureResponse
Performss a PATCH request
post()  : FeatureResponse
Performs a POST request.
provides()  : list<string|int, ExecutionOrderDependency>
Returns the normalized test name as class::method.
put()  : FeatureResponse
Performs a PUT request
registerComparator()  : void
requires()  : list<string|int, ExecutionOrderDependency>
Returns a list of normalized dependency names, class::method.
resetCount()  : void
Reset the assertion counter.
resetMigrationSeedCount()  : mixed
Reset $doneMigration and $doneSeed
returnArgument()  : ReturnArgument
returnCallback()  : ReturnCallback
returnSelf()  : ReturnSelf
Returns the current object.
returnValue()  : ReturnStub
returnValueMap()  : ReturnValueMap
run()  : TestResult
Runs the test case and collects the results in a TestResult object.
seed()  : void
Seeds that database with a specific seeder.
seeInDatabase()  : void
Asserts that records that match the conditions in $where DO exist in the database.
seeNumRecords()  : void
Asserts that the number of rows in the database that match $where is equal to $expected.
setPrivateProperty()  : mixed
Set a private property.
setUpBeforeClass()  : void
This method is called before the first test of this test class is run.
skipEvents()  : $this
Don't run any events while running this test.
sortId()  : string
stringContains()  : StringContains
stringEndsWith()  : StringEndsWith
stringStartsWith()  : StringStartsWith
tearDownAfterClass()  : void
This method is called after the last test of this test class is run.
throwException()  : Exception
toString()  : string
Returns a string representation of the test case.
withBody()  : $this
Set the raw body for the request
withBodyFormat()  : $this
Set the format the request's body should have.
withHeaders()  : $this
Set request's headers
withSession()  : $this
Sets any values that should exist during this session.
assertPostConditions()  : void
Performs assertions shared by all tests of a test case.
assertPreConditions()  : void
Performs assertions shared by all tests of a test case.
clearInsertCache()  : mixed
Removes any rows inserted via $this->hasInDatabase()
createApplication()  : CodeIgniter
Loads up an instance of CodeIgniter and gets the environment setup.
createConfiguredMock()  : MockObject
Returns a configured mock object for the specified class.
createMock()  : MockObject
Returns a mock object for the specified class.
createPartialMock()  : MockObject
Returns a partial mock object for the specified class.
createStub()  : Stub
Makes configurable stub for the specified class.
createTestProxy()  : MockObject
Returns a test proxy for the specified class.
getHeaderEmitted()  : string|null
Return first matching emitted header.
getMockClass()  : string
Mocks the specified class and returns the name of the mocked class.
getMockForAbstractClass()  : MockObject
Returns a mock object for the specified abstract class with all abstract methods of the class mocked. Concrete methods are not mocked by default.
getMockForTrait()  : MockObject
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()  : MockObject
Returns a mock object based on the given WSDL file.
getObjectForTrait()  : object
Returns an object for the specified trait.
iniSet()  : void
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.
migrateDatabase()  : mixed
Run migrations as defined by the class
mockCache()  : mixed
Injects the mock Cache driver to prevent filesystem collisions
mockEmail()  : mixed
Injects the mock email driver so no emails really send
mockSession()  : mixed
Injects the mock session driver into Services
onNotSuccessfulTest()  : void
This method is called when a test method did not execute successfully.
populateGlobals()  : Request
Populates the data of our Request with "global" data relevant to the request, like $_POST data.
prophesize()  : ObjectProphecy
recordDoubledType()  : void
regressDatabase()  : mixed
Regress migrations as defined by the class
resetFactories()  : mixed
Resets shared instanced for all Factories components
resetServices()  : mixed
Resets shared instanced for all Services
runSeeds()  : mixed
Run seeds as defined by the class
runTest()  : mixed
Override to run the test and assert its state.
setLocale()  : void
This method is a wrapper for the setlocale() function that automatically resets the locale to its original value after the test is run.
setRequestBody()  : Request
Set the request's body formatted according to the value in $this->bodyFormat.
setUp()  : void
This method is called before each test.
setUpDatabase()  : mixed
Runs the trait set up methods.
setupHeaders()  : IncomingRequest
Setup the custom request's headers
setUpMigrate()  : mixed
Migrate on setUp
setupRequest()  : IncomingRequest
Setup a Request object to use so that CodeIgniter won't try to auto-populate some of the items.
setUpSeed()  : mixed
Seed on setUp
tearDown()  : void
This method is called after each test.
tearDownDatabase()  : mixed
Runs the trait set up methods.
withRoutes()  : $this
Sets a RouteCollection that will override the application's route collection.
callTraitMethods()  : void
Checks for traits with corresponding methods for setUp or tearDown.
checkExceptionExpectations()  : bool
checkRequirements()  : void
cleanupIniSettings()  : void
cleanupLocaleSettings()  : void
compareGlobalStateSnapshotPart()  : void
compareGlobalStateSnapshots()  : void
createGlobalStateSnapshot()  : Snapshot
createMockObject()  : MockObject
createWarning()  : void
detectLocationHint()  : array<string|int, mixed>|null
getAccessibleRefProperty()  : ReflectionProperty
Find an accessible property.
getMockObjectGenerator()  : Generator
Get the mock object generator, creating it if it doesn't exist.
getProphet()  : Prophet
handleDependencies()  : bool
isCallableTestMethod()  : bool
isValidClassAttributeName()  : bool
isValidObjectAttributeName()  : bool
markSkippedForMissingDependency()  : void
markSkippedForNotSpecifyingDependency()  : void
markWarningForUncallableDependency()  : void
registerMockObjectsFromTestArguments()  : void
restoreGlobalState()  : void
runInSeparateProcess()  : bool
setDoesNotPerformAssertionsFromAnnotation()  : void
shouldInvocationMockerBeReset()  : bool
snapshotGlobalState()  : void
startOutputBuffering()  : void
stopOutputBuffering()  : void
unregisterCustomComparators()  : void
verifyMockObjects()  : void

Constants

LOCALE_CATEGORIES

private mixed LOCALE_CATEGORIES = [LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME]

Properties

$backupGlobals

protected bool|null $backupGlobals

$backupGlobalsBlacklist

protected array<string|int, string> $backupGlobalsBlacklist = []
Tags
deprecated

Use $backupGlobalsExcludeList instead

$backupGlobalsExcludeList

protected array<string|int, string> $backupGlobalsExcludeList = []

$backupStaticAttributes

protected bool $backupStaticAttributes

$backupStaticAttributesBlacklist

protected array<string, array<int, string>> $backupStaticAttributesBlacklist = []
Tags
deprecated

Use $backupStaticAttributesExcludeList instead

$backupStaticAttributesExcludeList

protected array<string, array<int, string>> $backupStaticAttributesExcludeList = []

$basePath

The path to the seeds directory.

protected string $basePath = SUPPORTPATH . 'Database'

Allows overriding the default application directories.

$bodyFormat

Allows for formatting the request body to what the controller is going to expect

protected string $bodyFormat = ''

$clean

Enabled auto clean op buffer after request call

protected bool $clean = true

$DBGroup

The name of the database group to connect to.

protected string $DBGroup = 'tests'

If not present, will use the defaultGroup.

$headers

Custom request's headers

protected array<string|int, mixed> $headers = []

$insertCache

Stores information needed to remove any rows inserted via $this->hasInDatabase();

protected array<string|int, mixed> $insertCache = []

$migrate

Should run db migration?

protected bool $migrate = true

$migrateOnce

Should run db migration only once?

protected bool $migrateOnce = false

$namespace

The namespace(s) to help us find the migration classes.

protected string|array<string|int, mixed>|null $namespace = 'Tests\Support'

Empty is equivalent to running spark migrate -all. Note that running "all" runs migrations in date order, but specifying namespaces runs them in namespace order (then date)

$preserveGlobalState

protected bool $preserveGlobalState = true

$providedTests

protected list<string|int, ExecutionOrderDependency> $providedTests = []

$refresh

Should the db be refreshed before test?

protected bool $refresh = true

$requestBody

Allows for directly setting the body to what it needs to be.

protected mixed $requestBody = ''

$runTestInSeparateProcess

protected bool $runTestInSeparateProcess

$seed

The seed file(s) used for all tests within this test case.

protected string|array<string|int, mixed> $seed = ''

Should be fully-namespaced or relative to $basePath

$seedOnce

Should run seeding only once?

protected bool $seedOnce = false

$session

Values to be set in the SESSION global before running the test.

protected array<string|int, mixed> $session = []

$setUpMethods

Methods to run during setUp.

protected array<string|int, mixed> $setUpMethods = ['resetFactories', 'mockCache', 'mockEmail', 'mockSession']

of methods

$tearDownMethods

Methods to run during tearDown.

protected array<string|int, mixed> $tearDownMethods = []

of methods

$beStrictAboutChangesToGlobalState

private bool $beStrictAboutChangesToGlobalState = false

$count

private static int $count = 0

$data

private array<string|int, mixed> $data

$dependencies

private list<string|int, ExecutionOrderDependency> $dependencies = []

$dependencyInput

private array<string|int, mixed> $dependencyInput = []

$doesNotPerformAssertions

private bool $doesNotPerformAssertions = false

$doneMigration

Is db migration done once or more than once?

private static bool $doneMigration = false

$doneSeed

Is seeding done once or more than once?

private static bool $doneSeed = false

$doubledTypes

private array<string|int, string> $doubledTypes = []

$expectedException

private null|string $expectedException

$expectedExceptionCode

private null|int|string $expectedExceptionCode

$expectedExceptionMessage

private null|string $expectedExceptionMessage

$expectedExceptionMessageRegExp

private null|string $expectedExceptionMessageRegExp

$groups

private array<string|int, string> $groups = []

$iniSettings

private array<string, string> $iniSettings = []

$inIsolation

private bool $inIsolation = false

$locale

private array<string|int, mixed> $locale = []

$mockObjectGenerator

private Generator $mockObjectGenerator

$numAssertions

private int $numAssertions = 0

$outputBufferingActive

private bool $outputBufferingActive = false

$outputBufferingLevel

private int $outputBufferingLevel

$outputCallback

private mixed $outputCallback = false

$outputExpectedRegex

private string|null $outputExpectedRegex

$outputExpectedString

private string|null $outputExpectedString

$outputRetrievedForAssertion

private bool $outputRetrievedForAssertion = false

$registerMockObjectsFromTestArgumentsRecursively

private bool $registerMockObjectsFromTestArgumentsRecursively = false

$runClassInSeparateProcess

private bool $runClassInSeparateProcess

$status

private int $status = PHPUnitRunnerBaseTestRunner::STATUS_UNKNOWN

$statusMessage

private string $statusMessage = ''

$traits

Store of identified traits.

private array<string|int, string>|null $traits

$warnings

private array<string|int, string> $warnings = []

Methods

any()

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

public static any() : AnyInvokedCount
Return values
AnyInvokedCount

assertArrayHasKey()

Asserts that an array has a specified key.

public static assertArrayHasKey(int|string $key, array<string|int, mixed>|ArrayAccess $array[, string $message = '' ]) : void
Parameters
$key : int|string
$array : array<string|int, mixed>|ArrayAccess
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
Return values
void

assertArrayNotHasKey()

Asserts that an array does not have a specified key.

public static assertArrayNotHasKey(int|string $key, array<string|int, mixed>|ArrayAccess $array[, string $message = '' ]) : void
Parameters
$key : int|string
$array : array<string|int, mixed>|ArrayAccess
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
Return values
void

assertClassHasAttribute()

Asserts that a class has a specified attribute.

public static assertClassHasAttribute(string $attributeName, string $className[, string $message = '' ]) : void
Parameters
$attributeName : string
$className : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
Return values
void

assertClassHasStaticAttribute()

Asserts that a class has a specified static attribute.

public static assertClassHasStaticAttribute(string $attributeName, string $className[, string $message = '' ]) : void
Parameters
$attributeName : string
$className : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
Return values
void

assertClassNotHasAttribute()

Asserts that a class does not have a specified attribute.

public static assertClassNotHasAttribute(string $attributeName, string $className[, string $message = '' ]) : void
Parameters
$attributeName : string
$className : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
Return values
void

assertClassNotHasStaticAttribute()

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

public static assertClassNotHasStaticAttribute(string $attributeName, string $className[, string $message = '' ]) : void
Parameters
$attributeName : string
$className : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
Return values
void

assertCloseEnough()

Custom function to test that two values are "close enough".

public assertCloseEnough(int $expected, mixed $actual[, string $message = '' ][, int $tolerance = 1 ]) : mixed

This is intended for extended execution time testing, where the result is close but not exactly equal to the expected time, for reasons beyond our control.

Parameters
$expected : int
$actual : mixed
$message : string = ''
$tolerance : int = 1
Tags
throws
Exception
Return values
mixed

assertCloseEnoughString()

Custom function to test that two values are "close enough".

public assertCloseEnoughString(mixed $expected, mixed $actual[, string $message = '' ][, int $tolerance = 1 ]) : void|bool

This is intended for extended execution time testing, where the result is close but not exactly equal to the expected time, for reasons beyond our control.

Parameters
$expected : mixed
$actual : mixed
$message : string = ''
$tolerance : int = 1
Tags
throws
Exception
Return values
void|bool

assertContains()

Asserts that a haystack contains a needle.

public static assertContains(mixed $needle, iteratable<string|int, mixed> $haystack[, string $message = '' ]) : void
Parameters
$needle : mixed
$haystack : iteratable<string|int, mixed>
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
Return values
void

assertContainsEquals()

public static assertContainsEquals(mixed $needle, iteratable<string|int, mixed> $haystack[, string $message = '' ]) : void
Parameters
$needle : mixed
$haystack : iteratable<string|int, mixed>
$message : string = ''
Return values
void

assertContainsOnly()

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

public static assertContainsOnly(string $type, iteratable<string|int, mixed> $haystack[, bool|null $isNativeType = null ][, string $message = '' ]) : void
Parameters
$type : string
$haystack : iteratable<string|int, mixed>
$isNativeType : bool|null = null
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertContainsOnlyInstancesOf()

Asserts that a haystack contains only instances of a given class name.

public static assertContainsOnlyInstancesOf(string $className, iteratable<string|int, mixed> $haystack[, string $message = '' ]) : void
Parameters
$className : string
$haystack : iteratable<string|int, mixed>
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertCount()

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

public static assertCount(int $expectedCount, Countable|iteratable<string|int, mixed> $haystack[, string $message = '' ]) : void
Parameters
$expectedCount : int
$haystack : Countable|iteratable<string|int, mixed>
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
Return values
void

assertDirectoryDoesNotExist()

Asserts that a directory does not exist.

public static assertDirectoryDoesNotExist(string $directory[, string $message = '' ]) : void
Parameters
$directory : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertDirectoryExists()

Asserts that a directory exists.

public static assertDirectoryExists(string $directory[, string $message = '' ]) : void
Parameters
$directory : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertDirectoryIsNotReadable()

Asserts that a directory exists and is not readable.

public static assertDirectoryIsNotReadable(string $directory[, string $message = '' ]) : void
Parameters
$directory : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertDirectoryIsNotWritable()

Asserts that a directory exists and is not writable.

public static assertDirectoryIsNotWritable(string $directory[, string $message = '' ]) : void
Parameters
$directory : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertDirectoryIsReadable()

Asserts that a directory exists and is readable.

public static assertDirectoryIsReadable(string $directory[, string $message = '' ]) : void
Parameters
$directory : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertDirectoryIsWritable()

Asserts that a directory exists and is writable.

public static assertDirectoryIsWritable(string $directory[, string $message = '' ]) : void
Parameters
$directory : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertDirectoryNotExists()

Asserts that a directory does not exist.

public static assertDirectoryNotExists(string $directory[, string $message = '' ]) : void
Parameters
$directory : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore
deprecated

https://github.com/sebastianbergmann/phpunit/issues/4068

Return values
void

assertDirectoryNotIsReadable()

Asserts that a directory exists and is not readable.

public static assertDirectoryNotIsReadable(string $directory[, string $message = '' ]) : void
Parameters
$directory : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore
deprecated

https://github.com/sebastianbergmann/phpunit/issues/4071

Return values
void

assertDirectoryNotIsWritable()

Asserts that a directory exists and is not writable.

public static assertDirectoryNotIsWritable(string $directory[, string $message = '' ]) : void
Parameters
$directory : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore
deprecated

https://github.com/sebastianbergmann/phpunit/issues/4074

Return values
void

assertDoesNotMatchRegularExpression()

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

public static assertDoesNotMatchRegularExpression(string $pattern, string $string[, string $message = '' ]) : void
Parameters
$pattern : string
$string : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertEmpty()

Asserts that a variable is empty.

public static assertEmpty(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

empty $actual

Return values
void

assertEquals()

Asserts that two variables are equal.

public static assertEquals(mixed $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertEqualsCanonicalizing()

Asserts that two variables are equal (canonicalizing).

public static assertEqualsCanonicalizing(mixed $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertEqualsIgnoringCase()

Asserts that two variables are equal (ignoring case).

public static assertEqualsIgnoringCase(mixed $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertEqualsWithDelta()

Asserts that two variables are equal (with delta).

public static assertEqualsWithDelta(mixed $expected, mixed $actual, float $delta[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$delta : float
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertEqualXMLStructure()

Asserts that a hierarchy of DOMElements matches.

public static assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement[, bool $checkAttributes = false ][, string $message = '' ]) : void
Parameters
$expectedElement : DOMElement
$actualElement : DOMElement
$checkAttributes : bool = false
$message : string = ''
Tags
throws
InvalidArgumentException
throws
AssertionFailedError
throws
ExpectationFailedException
codeCoverageIgnore
deprecated

https://github.com/sebastianbergmann/phpunit/issues/4091

Return values
void

assertEventTriggered()

Hooks into CodeIgniter's Events system to check if a specific event was triggered or not.

public assertEventTriggered(string $eventName) : bool
Parameters
$eventName : string
Tags
throws
Exception
Return values
bool

assertFalse()

Asserts that a condition is false.

public static assertFalse(mixed $condition[, string $message = '' ]) : void
Parameters
$condition : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

false $condition

Return values
void

assertFileDoesNotExist()

Asserts that a file does not exist.

public static assertFileDoesNotExist(string $filename[, string $message = '' ]) : void
Parameters
$filename : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertFileEquals()

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

public static assertFileEquals(string $expected, string $actual[, string $message = '' ]) : void
Parameters
$expected : string
$actual : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertFileEqualsCanonicalizing()

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

public static assertFileEqualsCanonicalizing(string $expected, string $actual[, string $message = '' ]) : void
Parameters
$expected : string
$actual : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertFileEqualsIgnoringCase()

Asserts that the contents of one file is equal to the contents of another file (ignoring case).

public static assertFileEqualsIgnoringCase(string $expected, string $actual[, string $message = '' ]) : void
Parameters
$expected : string
$actual : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertFileExists()

Asserts that a file exists.

public static assertFileExists(string $filename[, string $message = '' ]) : void
Parameters
$filename : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertFileIsNotReadable()

Asserts that a file exists and is not readable.

public static assertFileIsNotReadable(string $file[, string $message = '' ]) : void
Parameters
$file : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertFileIsNotWritable()

Asserts that a file exists and is not writable.

public static assertFileIsNotWritable(string $file[, string $message = '' ]) : void
Parameters
$file : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertFileIsReadable()

Asserts that a file exists and is readable.

public static assertFileIsReadable(string $file[, string $message = '' ]) : void
Parameters
$file : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertFileIsWritable()

Asserts that a file exists and is writable.

public static assertFileIsWritable(string $file[, string $message = '' ]) : void
Parameters
$file : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertFileNotEquals()

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

public static assertFileNotEquals(string $expected, string $actual[, string $message = '' ]) : void
Parameters
$expected : string
$actual : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertFileNotEqualsCanonicalizing()

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

public static assertFileNotEqualsCanonicalizing(string $expected, string $actual[, string $message = '' ]) : void
Parameters
$expected : string
$actual : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertFileNotEqualsIgnoringCase()

Asserts that the contents of one file is not equal to the contents of another file (ignoring case).

public static assertFileNotEqualsIgnoringCase(string $expected, string $actual[, string $message = '' ]) : void
Parameters
$expected : string
$actual : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertFileNotExists()

Asserts that a file does not exist.

public static assertFileNotExists(string $filename[, string $message = '' ]) : void
Parameters
$filename : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore
deprecated

https://github.com/sebastianbergmann/phpunit/issues/4077

Return values
void

assertFileNotIsReadable()

Asserts that a file exists and is not readable.

public static assertFileNotIsReadable(string $file[, string $message = '' ]) : void
Parameters
$file : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore
deprecated

https://github.com/sebastianbergmann/phpunit/issues/4080

Return values
void

assertFileNotIsWritable()

Asserts that a file exists and is not writable.

public static assertFileNotIsWritable(string $file[, string $message = '' ]) : void
Parameters
$file : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore
deprecated

https://github.com/sebastianbergmann/phpunit/issues/4083

Return values
void

assertFinite()

Asserts that a variable is finite.

public static assertFinite(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertGreaterThan()

Asserts that a value is greater than another value.

public static assertGreaterThan(mixed $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertGreaterThanOrEqual()

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

public static assertGreaterThanOrEqual(mixed $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertHeaderEmitted()

Hooks into xdebug's headers capture, looking for a specific header emitted

public assertHeaderEmitted(string $header[, bool $ignoreCase = false ]) : void
Parameters
$header : string

The leading portion of the header we are looking for

$ignoreCase : bool = false
Tags
throws
Exception
Return values
void

assertHeaderNotEmitted()

Hooks into xdebug's headers capture, looking for a specific header emitted

public assertHeaderNotEmitted(string $header[, bool $ignoreCase = false ]) : void
Parameters
$header : string

The leading portion of the header we don't want to find

$ignoreCase : bool = false
Tags
throws
Exception
Return values
void

assertInfinite()

Asserts that a variable is infinite.

public static assertInfinite(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertInstanceOf()

Asserts that a variable is of a given type.

public static assertInstanceOf(string $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : string
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
psalm-template

ExpectedType of object

psalm-param

class-string $expected

psalm-assert

=ExpectedType $actual

Return values
void

assertIsArray()

Asserts that a variable is of type array.

public static assertIsArray(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

array $actual

Return values
void

assertIsBool()

Asserts that a variable is of type bool.

public static assertIsBool(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

bool $actual

Return values
void

assertIsCallable()

Asserts that a variable is of type callable.

public static assertIsCallable(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

callable $actual

Return values
void

assertIsClosedResource()

Asserts that a variable is of type resource and is closed.

public static assertIsClosedResource(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

resource $actual

Return values
void

assertIsFloat()

Asserts that a variable is of type float.

public static assertIsFloat(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

float $actual

Return values
void

assertIsInt()

Asserts that a variable is of type int.

public static assertIsInt(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

int $actual

Return values
void

assertIsIterable()

Asserts that a variable is of type iterable.

public static assertIsIterable(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

iterable $actual

Return values
void

assertIsNotArray()

Asserts that a variable is not of type array.

public static assertIsNotArray(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!array $actual

Return values
void

assertIsNotBool()

Asserts that a variable is not of type bool.

public static assertIsNotBool(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!bool $actual

Return values
void

assertIsNotCallable()

Asserts that a variable is not of type callable.

public static assertIsNotCallable(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!callable $actual

Return values
void

assertIsNotClosedResource()

Asserts that a variable is not of type resource.

public static assertIsNotClosedResource(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!resource $actual

Return values
void

assertIsNotFloat()

Asserts that a variable is not of type float.

public static assertIsNotFloat(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!float $actual

Return values
void

assertIsNotInt()

Asserts that a variable is not of type int.

public static assertIsNotInt(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!int $actual

Return values
void

assertIsNotIterable()

Asserts that a variable is not of type iterable.

public static assertIsNotIterable(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!iterable $actual

Return values
void

assertIsNotNumeric()

Asserts that a variable is not of type numeric.

public static assertIsNotNumeric(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!numeric $actual

Return values
void

assertIsNotObject()

Asserts that a variable is not of type object.

public static assertIsNotObject(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!object $actual

Return values
void

assertIsNotReadable()

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

public static assertIsNotReadable(string $filename[, string $message = '' ]) : void
Parameters
$filename : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertIsNotResource()

Asserts that a variable is not of type resource.

public static assertIsNotResource(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!resource $actual

Return values
void

assertIsNotScalar()

Asserts that a variable is not of type scalar.

public static assertIsNotScalar(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!scalar $actual

Return values
void

assertIsNotString()

Asserts that a variable is not of type string.

public static assertIsNotString(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!string $actual

Return values
void

assertIsNotWritable()

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

public static assertIsNotWritable(string $filename[, string $message = '' ]) : void
Parameters
$filename : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertIsNumeric()

Asserts that a variable is of type numeric.

public static assertIsNumeric(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

numeric $actual

Return values
void

assertIsObject()

Asserts that a variable is of type object.

public static assertIsObject(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

object $actual

Return values
void

assertIsReadable()

Asserts that a file/dir is readable.

public static assertIsReadable(string $filename[, string $message = '' ]) : void
Parameters
$filename : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertIsResource()

Asserts that a variable is of type resource.

public static assertIsResource(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

resource $actual

Return values
void

assertIsScalar()

Asserts that a variable is of type scalar.

public static assertIsScalar(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

scalar $actual

Return values
void

assertIsString()

Asserts that a variable is of type string.

public static assertIsString(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

string $actual

Return values
void

assertIsWritable()

Asserts that a file/dir exists and is writable.

public static assertIsWritable(string $filename[, string $message = '' ]) : void
Parameters
$filename : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertJson()

Asserts that a string is a valid JSON string.

public static assertJson(string $actualJson[, string $message = '' ]) : void
Parameters
$actualJson : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertJsonFileEqualsJsonFile()

Asserts that two JSON files are equal.

public static assertJsonFileEqualsJsonFile(string $expectedFile, string $actualFile[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualFile : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertJsonFileNotEqualsJsonFile()

Asserts that two JSON files are not equal.

public static assertJsonFileNotEqualsJsonFile(string $expectedFile, string $actualFile[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualFile : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertJsonStringEqualsJsonFile()

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

public static assertJsonStringEqualsJsonFile(string $expectedFile, string $actualJson[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualJson : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertJsonStringEqualsJsonString()

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

public static assertJsonStringEqualsJsonString(string $expectedJson, string $actualJson[, string $message = '' ]) : void
Parameters
$expectedJson : string
$actualJson : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertJsonStringNotEqualsJsonFile()

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

public static assertJsonStringNotEqualsJsonFile(string $expectedFile, string $actualJson[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualJson : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertJsonStringNotEqualsJsonString()

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

public static assertJsonStringNotEqualsJsonString(string $expectedJson, string $actualJson[, string $message = '' ]) : void
Parameters
$expectedJson : string
$actualJson : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertLessThan()

Asserts that a value is smaller than another value.

public static assertLessThan(mixed $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertLessThanOrEqual()

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

public static assertLessThanOrEqual(mixed $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertLogged()

Custom function to hook into CodeIgniter's Logging mechanism to check if certain messages were logged during code execution.

public assertLogged(string $level[, string|null $expectedMessage = null ]) : bool
Parameters
$level : string
$expectedMessage : string|null = null
Tags
throws
Exception
Return values
bool

assertMatchesRegularExpression()

Asserts that a string matches a given regular expression.

public static assertMatchesRegularExpression(string $pattern, string $string[, string $message = '' ]) : void
Parameters
$pattern : string
$string : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertNan()

Asserts that a variable is nan.

public static assertNan(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertNotContains()

Asserts that a haystack does not contain a needle.

public static assertNotContains(mixed $needle, iteratable<string|int, mixed> $haystack[, string $message = '' ]) : void
Parameters
$needle : mixed
$haystack : iteratable<string|int, mixed>
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
Return values
void

assertNotContainsEquals()

public static assertNotContainsEquals(mixed $needle, iteratable<string|int, mixed> $haystack[, string $message = '' ]) : void
Parameters
$needle : mixed
$haystack : iteratable<string|int, mixed>
$message : string = ''
Return values
void

assertNotContainsOnly()

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

public static assertNotContainsOnly(string $type, iteratable<string|int, mixed> $haystack[, bool|null $isNativeType = null ][, string $message = '' ]) : void
Parameters
$type : string
$haystack : iteratable<string|int, mixed>
$isNativeType : bool|null = null
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertNotCount()

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

public static assertNotCount(int $expectedCount, Countable|iteratable<string|int, mixed> $haystack[, string $message = '' ]) : void
Parameters
$expectedCount : int
$haystack : Countable|iteratable<string|int, mixed>
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
Return values
void

assertNotEmpty()

Asserts that a variable is not empty.

public static assertNotEmpty(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!empty $actual

Return values
void

assertNotEquals()

Asserts that two variables are not equal.

public static assertNotEquals(mixed $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertNotEqualsCanonicalizing()

Asserts that two variables are not equal (canonicalizing).

public static assertNotEqualsCanonicalizing(mixed $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertNotEqualsIgnoringCase()

Asserts that two variables are not equal (ignoring case).

public static assertNotEqualsIgnoringCase(mixed $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertNotEqualsWithDelta()

Asserts that two variables are not equal (with delta).

public static assertNotEqualsWithDelta(mixed $expected, mixed $actual, float $delta[, string $message = '' ]) : void
Parameters
$expected : mixed
$actual : mixed
$delta : float
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertNotFalse()

Asserts that a condition is not false.

public static assertNotFalse(mixed $condition[, string $message = '' ]) : void
Parameters
$condition : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!false $condition

Return values
void

assertNotInstanceOf()

Asserts that a variable is not of a given type.

public static assertNotInstanceOf(string $expected, mixed $actual[, string $message = '' ]) : void
Parameters
$expected : string
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
psalm-template

ExpectedType of object

psalm-param

class-string $expected

psalm-assert

!ExpectedType $actual

Return values
void

assertNotIsReadable()

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

public static assertNotIsReadable(string $filename[, string $message = '' ]) : void
Parameters
$filename : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore
deprecated

https://github.com/sebastianbergmann/phpunit/issues/4062

Return values
void

assertNotIsWritable()

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

public static assertNotIsWritable(string $filename[, string $message = '' ]) : void
Parameters
$filename : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore
deprecated

https://github.com/sebastianbergmann/phpunit/issues/4065

Return values
void

assertNotNull()

Asserts that a variable is not null.

public static assertNotNull(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!null $actual

Return values
void

assertNotRegExp()

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

public static assertNotRegExp(string $pattern, string $string[, string $message = '' ]) : void
Parameters
$pattern : string
$string : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore
deprecated

https://github.com/sebastianbergmann/phpunit/issues/4089

Return values
void

assertNotSame()

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

public static assertNotSame(mixed $expected, mixed $actual[, string $message = '' ]) : void

Used on objects, it asserts that two variables do not reference the same object.

Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertNotSameSize()

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

public static assertNotSameSize(Countable|iteratable<string|int, mixed> $expected, Countable|iteratable<string|int, mixed> $actual[, string $message = '' ]) : void
Parameters
$expected : Countable|iteratable<string|int, mixed>
$actual : Countable|iteratable<string|int, mixed>
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
Return values
void

assertNotTrue()

Asserts that a condition is not true.

public static assertNotTrue(mixed $condition[, string $message = '' ]) : void
Parameters
$condition : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

!true $condition

Return values
void

assertNull()

Asserts that a variable is null.

public static assertNull(mixed $actual[, string $message = '' ]) : void
Parameters
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

null $actual

Return values
void

assertObjectEquals()

public static assertObjectEquals(object $expected, object $actual[, string $method = 'equals' ][, string $message = '' ]) : void
Parameters
$expected : object
$actual : object
$method : string = 'equals'
$message : string = ''
Tags
throws
ExpectationFailedException
Return values
void

assertObjectHasAttribute()

Asserts that an object has a specified attribute.

public static assertObjectHasAttribute(string $attributeName, object $object[, string $message = '' ]) : void
Parameters
$attributeName : string
$object : object
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
Return values
void

assertObjectNotHasAttribute()

Asserts that an object does not have a specified attribute.

public static assertObjectNotHasAttribute(string $attributeName, object $object[, string $message = '' ]) : void
Parameters
$attributeName : string
$object : object
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
Return values
void

assertRegExp()

Asserts that a string matches a given regular expression.

public static assertRegExp(string $pattern, string $string[, string $message = '' ]) : void
Parameters
$pattern : string
$string : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
codeCoverageIgnore
deprecated

https://github.com/sebastianbergmann/phpunit/issues/4086

Return values
void

assertSame()

Asserts that two variables have the same type and value.

public static assertSame(mixed $expected, mixed $actual[, string $message = '' ]) : void

Used on objects, it asserts that two variables reference the same object.

Parameters
$expected : mixed
$actual : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-template

ExpectedType

psalm-param

ExpectedType $expected

psalm-assert

=ExpectedType $actual

Return values
void

assertSameSize()

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

public static assertSameSize(Countable|iteratable<string|int, mixed> $expected, Countable|iteratable<string|int, mixed> $actual[, string $message = '' ]) : void
Parameters
$expected : Countable|iteratable<string|int, mixed>
$actual : Countable|iteratable<string|int, mixed>
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
Return values
void

assertStringContainsString()

public static assertStringContainsString(string $needle, string $haystack[, string $message = '' ]) : void
Parameters
$needle : string
$haystack : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertStringContainsStringIgnoringCase()

public static assertStringContainsStringIgnoringCase(string $needle, string $haystack[, string $message = '' ]) : void
Parameters
$needle : string
$haystack : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertStringEndsNotWith()

Asserts that a string ends not with a given suffix.

public static assertStringEndsNotWith(string $suffix, string $string[, string $message = '' ]) : void
Parameters
$suffix : string
$string : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertStringEndsWith()

Asserts that a string ends with a given suffix.

public static assertStringEndsWith(string $suffix, string $string[, string $message = '' ]) : void
Parameters
$suffix : string
$string : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertStringEqualsFile()

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

public static assertStringEqualsFile(string $expectedFile, string $actualString[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualString : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertStringEqualsFileCanonicalizing()

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

public static assertStringEqualsFileCanonicalizing(string $expectedFile, string $actualString[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualString : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertStringEqualsFileIgnoringCase()

Asserts that the contents of a string is equal to the contents of a file (ignoring case).

public static assertStringEqualsFileIgnoringCase(string $expectedFile, string $actualString[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualString : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertStringMatchesFormat()

Asserts that a string matches a given format string.

public static assertStringMatchesFormat(string $format, string $string[, string $message = '' ]) : void
Parameters
$format : string
$string : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertStringMatchesFormatFile()

Asserts that a string matches a given format file.

public static assertStringMatchesFormatFile(string $formatFile, string $string[, string $message = '' ]) : void
Parameters
$formatFile : string
$string : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertStringNotContainsString()

public static assertStringNotContainsString(string $needle, string $haystack[, string $message = '' ]) : void
Parameters
$needle : string
$haystack : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertStringNotContainsStringIgnoringCase()

public static assertStringNotContainsStringIgnoringCase(string $needle, string $haystack[, string $message = '' ]) : void
Parameters
$needle : string
$haystack : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertStringNotEqualsFile()

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

public static assertStringNotEqualsFile(string $expectedFile, string $actualString[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualString : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertStringNotEqualsFileCanonicalizing()

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

public static assertStringNotEqualsFileCanonicalizing(string $expectedFile, string $actualString[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualString : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertStringNotEqualsFileIgnoringCase()

Asserts that the contents of a string is not equal to the contents of a file (ignoring case).

public static assertStringNotEqualsFileIgnoringCase(string $expectedFile, string $actualString[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualString : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertStringNotMatchesFormat()

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

public static assertStringNotMatchesFormat(string $format, string $string[, string $message = '' ]) : void
Parameters
$format : string
$string : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertStringNotMatchesFormatFile()

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

public static assertStringNotMatchesFormatFile(string $formatFile, string $string[, string $message = '' ]) : void
Parameters
$formatFile : string
$string : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertStringStartsNotWith()

Asserts that a string starts not with a given prefix.

public static assertStringStartsNotWith(string $prefix, string $string[, string $message = '' ]) : void
Parameters
$prefix : string
$string : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertStringStartsWith()

Asserts that a string starts with a given prefix.

public static assertStringStartsWith(string $prefix, string $string[, string $message = '' ]) : void
Parameters
$prefix : string
$string : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertThat()

Evaluates a PHPUnit\Framework\Constraint matcher object.

public static assertThat(mixed $value, Constraint $constraint[, string $message = '' ]) : void
Parameters
$value : mixed
$constraint : Constraint
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertTrue()

Asserts that a condition is true.

public static assertTrue(mixed $condition[, string $message = '' ]) : void
Parameters
$condition : mixed
$message : string = ''
Tags
throws
InvalidArgumentException
throws
ExpectationFailedException
psalm-assert

true $condition

Return values
void

assertXmlFileEqualsXmlFile()

Asserts that two XML files are equal.

public static assertXmlFileEqualsXmlFile(string $expectedFile, string $actualFile[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualFile : string
$message : string = ''
Tags
throws
InvalidArgumentException
throws
Exception
throws
ExpectationFailedException
Return values
void

assertXmlFileNotEqualsXmlFile()

Asserts that two XML files are not equal.

public static assertXmlFileNotEqualsXmlFile(string $expectedFile, string $actualFile[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualFile : string
$message : string = ''
Tags
throws
Exception
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertXmlStringEqualsXmlFile()

Asserts that two XML documents are equal.

public static assertXmlStringEqualsXmlFile(string $expectedFile, DOMDocument|string $actualXml[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualXml : DOMDocument|string
$message : string = ''
Tags
throws
Exception
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertXmlStringEqualsXmlString()

Asserts that two XML documents are equal.

public static assertXmlStringEqualsXmlString(DOMDocument|string $expectedXml, DOMDocument|string $actualXml[, string $message = '' ]) : void
Parameters
$expectedXml : DOMDocument|string
$actualXml : DOMDocument|string
$message : string = ''
Tags
throws
Exception
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertXmlStringNotEqualsXmlFile()

Asserts that two XML documents are not equal.

public static assertXmlStringNotEqualsXmlFile(string $expectedFile, DOMDocument|string $actualXml[, string $message = '' ]) : void
Parameters
$expectedFile : string
$actualXml : DOMDocument|string
$message : string = ''
Tags
throws
Exception
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

assertXmlStringNotEqualsXmlString()

Asserts that two XML documents are not equal.

public static assertXmlStringNotEqualsXmlString(DOMDocument|string $expectedXml, DOMDocument|string $actualXml[, string $message = '' ]) : void
Parameters
$expectedXml : DOMDocument|string
$actualXml : DOMDocument|string
$message : string = ''
Tags
throws
Exception
throws
InvalidArgumentException
throws
ExpectationFailedException
Return values
void

at()

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

public static at(int $index) : InvokedAtIndex
Parameters
$index : int
Tags
deprecated

https://github.com/sebastianbergmann/phpunit/issues/4297

codeCoverageIgnore
Return values
InvokedAtIndex

atLeast()

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

public static atLeast(int $requiredInvocations) : InvokedAtLeastCount
Parameters
$requiredInvocations : int
Return values
InvokedAtLeastCount

atLeastOnce()

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

public static atLeastOnce() : InvokedAtLeastOnce
Return values
InvokedAtLeastOnce

atMost()

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

public static atMost(int $allowedInvocations) : InvokedAtMostCount
Parameters
$allowedInvocations : int
Return values
InvokedAtMostCount

call()

Calls a single URI, executes it, and returns a FeatureResponse instance that can be used to run many assertions against.

public call(string $method, string $path[, array<string|int, mixed>|null $params = null ]) : FeatureResponse
Parameters
$method : string
$path : string
$params : array<string|int, mixed>|null = null
Tags
throws
RedirectException
throws
Exception
Return values
FeatureResponse

callback()

public static callback(callable $callback) : Callback
Parameters
$callback : callable
Tags
psalm-template

CallbackInput of mixed

psalm-param

callable(CallbackInput $callback): bool $callback

psalm-return

Callback

Return values
Callback

count()

public count() : int
Return values
int

countOf()

public static countOf(int $count) : Count
Parameters
$count : int
Return values
Count

dontSeeInDatabase()

Asserts that records that match the conditions in $where do not exist in the database.

public dontSeeInDatabase(string $table, array<string|int, mixed> $where) : void
Parameters
$table : string
$where : array<string|int, mixed>
Return values
void

equalTo()

public static equalTo(mixed $value) : IsEqual
Parameters
$value : mixed
Return values
IsEqual

exactly()

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

public static exactly(int $count) : InvokedCount
Parameters
$count : int
Return values
InvokedCount

expectDeprecation()

public expectDeprecation() : void
Return values
void

expectDeprecationMessage()

public expectDeprecationMessage(string $message) : void
Parameters
$message : string
Return values
void

expectDeprecationMessageMatches()

public expectDeprecationMessageMatches(string $regularExpression) : void
Parameters
$regularExpression : string
Return values
void

expectError()

public expectError() : void
Return values
void

expectErrorMessage()

public expectErrorMessage(string $message) : void
Parameters
$message : string
Return values
void

expectErrorMessageMatches()

public expectErrorMessageMatches(string $regularExpression) : void
Parameters
$regularExpression : string
Return values
void

expectException()

public expectException(string $exception) : void
Parameters
$exception : string
Tags
psalm-param

class-string<\Throwable> $exception

Return values
void

expectExceptionCode()

public expectExceptionCode(int|string $code) : void
Parameters
$code : int|string
Return values
void

expectExceptionMessage()

public expectExceptionMessage(string $message) : void
Parameters
$message : string
Return values
void

expectExceptionMessageMatches()

public expectExceptionMessageMatches(string $regularExpression) : void
Parameters
$regularExpression : string
Return values
void

expectExceptionObject()

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

public expectExceptionObject(Exception $exception) : void

Information for expected exception class, expected exception message, and expected exception code are retrieved from a given Exception object.

Parameters
$exception : Exception
Return values
void

expectNotice()

public expectNotice() : void
Return values
void

expectNoticeMessage()

public expectNoticeMessage(string $message) : void
Parameters
$message : string
Return values
void

expectNoticeMessageMatches()

public expectNoticeMessageMatches(string $regularExpression) : void
Parameters
$regularExpression : string
Return values
void

expectNotToPerformAssertions()

public expectNotToPerformAssertions() : void
Return values
void

expectOutputRegex()

public expectOutputRegex(string $expectedRegex) : void
Parameters
$expectedRegex : string
Return values
void

expectOutputString()

public expectOutputString(string $expectedString) : void
Parameters
$expectedString : string
Return values
void

expectWarning()

public expectWarning() : void
Return values
void

expectWarningMessage()

public expectWarningMessage(string $message) : void
Parameters
$message : string
Return values
void

expectWarningMessageMatches()

public expectWarningMessageMatches(string $regularExpression) : void
Parameters
$regularExpression : string
Return values
void

fail()

Fails a test with the given message.

public static fail([string $message = '' ]) : void
Parameters
$message : string = ''
Tags
throws
AssertionFailedError
psalm-return

never-return

Return values
void

getActualOutputForAssertion()

public getActualOutputForAssertion() : string
Return values
string

getCount()

Return the current assertion count.

public static getCount() : int
Return values
int

getMockBuilder()

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

public getMockBuilder(string $className) : MockBuilder
Parameters
$className : string
Tags
psalm-template

RealInstanceType of object

psalm-param

class-string $className

psalm-return

MockBuilder

Return values
MockBuilder

getPrivateMethodInvoker()

Find a private method invoker.

public static getPrivateMethodInvoker(object|string $obj, string $method) : Closure
Parameters
$obj : object|string

object or class name

$method : string

method name

Tags
throws
ReflectionException
Return values
Closure

getPrivateProperty()

Retrieve a private property.

public static getPrivateProperty(object|string $obj, string $property) : mixed
Parameters
$obj : object|string

object or class name

$property : string

property name

Tags
throws
ReflectionException
Return values
mixed

value

getStatus()

public getStatus() : int
Return values
int

getStatusMessage()

public getStatusMessage() : string
Return values
string

grabFromDatabase()

Fetches a single column from a database row with criteria matching $where.

public grabFromDatabase(string $table, string $column, array<string|int, mixed> $where) : bool
Parameters
$table : string
$column : string
$where : array<string|int, mixed>
Tags
throws
DatabaseException
Return values
bool

greaterThanOrEqual()

public static greaterThanOrEqual(mixed $value) : LogicalOr
Parameters
$value : mixed
Return values
LogicalOr

hasFailed()

public hasFailed() : bool
Return values
bool

hasInDatabase()

Inserts a row into to the database. This row will be removed after the test has run.

public hasInDatabase(string $table, array<string|int, mixed> $data) : bool
Parameters
$table : string
$data : array<string|int, mixed>
Return values
bool

isType()

public static isType(string $type) : IsType
Parameters
$type : string
Return values
IsType

lessThan()

public static lessThan(mixed $value) : LessThan
Parameters
$value : mixed
Return values
LessThan

lessThanOrEqual()

public static lessThanOrEqual(mixed $value) : LogicalOr
Parameters
$value : mixed
Return values
LogicalOr

loadBuilder()

Loads the Builder class appropriate for the current database.

public loadBuilder(string $tableName) : BaseBuilder
Parameters
$tableName : string
Return values
BaseBuilder

loadDependencies()

Load any database test dependencies.

public loadDependencies() : mixed
Return values
mixed

markAsRisky()

public markAsRisky() : void
Return values
void

markTestIncomplete()

Mark the test as incomplete.

public static markTestIncomplete([string $message = '' ]) : void
Parameters
$message : string = ''
Tags
throws
IncompleteTestError
psalm-return

never-return

Return values
void

markTestSkipped()

Mark the test as skipped.

public static markTestSkipped([string $message = '' ]) : void
Parameters
$message : string = ''
Tags
throws
SkippedTestError
throws
SyntheticSkippedError
psalm-return

never-return

Return values
void

never()

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

public static never() : InvokedCount
Return values
InvokedCount

objectEquals()

public static objectEquals(object $object[, string $method = 'equals' ]) : ObjectEquals
Parameters
$object : object
$method : string = 'equals'
Return values
ObjectEquals

once()

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

public static once() : InvokedCount
Return values
InvokedCount

onConsecutiveCalls()

public static onConsecutiveCalls(mixed ...$args) : ConsecutiveCalls
Parameters
$args : mixed
Return values
ConsecutiveCalls

provides()

Returns the normalized test name as class::method.

public provides() : list<string|int, ExecutionOrderDependency>
Return values
list<string|int, ExecutionOrderDependency>

requires()

Returns a list of normalized dependency names, class::method.

public requires() : list<string|int, ExecutionOrderDependency>

This list can differ from the raw dependencies as the resolver has no need for the [!][shallow]clone prefix that is filtered out during normalization.

Return values
list<string|int, ExecutionOrderDependency>

resetCount()

Reset the assertion counter.

public static resetCount() : void
Return values
void

resetMigrationSeedCount()

Reset $doneMigration and $doneSeed

public static resetMigrationSeedCount() : mixed
Tags
afterClass
Return values
mixed

returnArgument()

public static returnArgument(int $argumentIndex) : ReturnArgument
Parameters
$argumentIndex : int
Return values
ReturnArgument

returnCallback()

public static returnCallback(mixed $callback) : ReturnCallback
Parameters
$callback : mixed
Return values
ReturnCallback

returnSelf()

Returns the current object.

public static returnSelf() : ReturnSelf

This method is useful when mocking a fluent interface.

Return values
ReturnSelf

returnValue()

public static returnValue(mixed $value) : ReturnStub
Parameters
$value : mixed
Return values
ReturnStub

returnValueMap()

public static returnValueMap(array<string|int, mixed> $valueMap) : ReturnValueMap
Parameters
$valueMap : array<string|int, mixed>
Return values
ReturnValueMap

seed()

Seeds that database with a specific seeder.

public seed(string $name) : void
Parameters
$name : string
Return values
void

seeInDatabase()

Asserts that records that match the conditions in $where DO exist in the database.

public seeInDatabase(string $table, array<string|int, mixed> $where) : void
Parameters
$table : string
$where : array<string|int, mixed>
Tags
throws
DatabaseException
Return values
void

seeNumRecords()

Asserts that the number of rows in the database that match $where is equal to $expected.

public seeNumRecords(int $expected, string $table, array<string|int, mixed> $where) : void
Parameters
$expected : int
$table : string
$where : array<string|int, mixed>
Tags
throws
DatabaseException
Return values
void

setPrivateProperty()

Set a private property.

public static setPrivateProperty(object|string $obj, string $property, mixed $value) : mixed
Parameters
$obj : object|string

object or class name

$property : string

property name

$value : mixed

value

Tags
throws
ReflectionException
Return values
mixed

setUpBeforeClass()

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

public static setUpBeforeClass() : void
Return values
void

skipEvents()

Don't run any events while running this test.

public skipEvents() : $this
Return values
$this

sortId()

public sortId() : string
Return values
string

stringContains()

public static stringContains(string $string[, bool $case = true ]) : StringContains
Parameters
$string : string
$case : bool = true
Return values
StringContains

tearDownAfterClass()

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

public static tearDownAfterClass() : void
Return values
void

throwException()

public static throwException(Throwable $exception) : Exception
Parameters
$exception : Throwable
Return values
Exception

toString()

Returns a string representation of the test case.

public toString() : string
Tags
throws
InvalidArgumentException
throws
Exception
Return values
string

withBody()

Set the raw body for the request

public withBody(mixed $body) : $this
Parameters
$body : mixed
Return values
$this

withBodyFormat()

Set the format the request's body should have.

public withBodyFormat(string $format) : $this
Parameters
$format : string

The desired format. Currently supported formats: xml, json

Return values
$this

withHeaders()

Set request's headers

public withHeaders([array<string|int, mixed> $headers = [] ]) : $this

Example of use withHeaders([ 'Authorization' => 'Token' ])

Parameters
$headers : array<string|int, mixed> = []

Array of headers

Return values
$this

withSession()

Sets any values that should exist during this session.

public withSession([array<string|int, mixed>|null $values = null ]) : $this
Parameters
$values : array<string|int, mixed>|null = null

Array of values, or null to use the current $_SESSION

Return values
$this

assertPostConditions()

Performs assertions shared by all tests of a test case.

protected assertPostConditions() : void

This method is called between test and tearDown().

Return values
void

assertPreConditions()

Performs assertions shared by all tests of a test case.

protected assertPreConditions() : void

This method is called between setUp() and test.

Return values
void

clearInsertCache()

Removes any rows inserted via $this->hasInDatabase()

protected clearInsertCache() : mixed
Return values
mixed

createConfiguredMock()

Returns a configured mock object for the specified class.

protected createConfiguredMock(string $originalClassName, array<string|int, mixed> $configuration) : MockObject
Parameters
$originalClassName : string
$configuration : array<string|int, mixed>
Tags
psalm-template

RealInstanceType of object

psalm-param

class-string $originalClassName

psalm-return

MockObject&RealInstanceType

Return values
MockObject

createMock()

Returns a mock object for the specified class.

protected createMock(string $originalClassName) : MockObject
Parameters
$originalClassName : string
Tags
psalm-template

RealInstanceType of object

psalm-param

class-string $originalClassName

psalm-return

MockObject&RealInstanceType

Return values
MockObject

createPartialMock()

Returns a partial mock object for the specified class.

protected createPartialMock(string $originalClassName, array<string|int, string> $methods) : MockObject
Parameters
$originalClassName : string
$methods : array<string|int, string>
Tags
psalm-template

RealInstanceType of object

psalm-param

class-string $originalClassName

psalm-return

MockObject&RealInstanceType

Return values
MockObject

createStub()

Makes configurable stub for the specified class.

protected createStub(string $originalClassName) : Stub
Parameters
$originalClassName : string
Tags
psalm-template

RealInstanceType of object

psalm-param

class-string $originalClassName

psalm-return

Stub&RealInstanceType

Return values
Stub

createTestProxy()

Returns a test proxy for the specified class.

protected createTestProxy(string $originalClassName[, array<string|int, mixed> $constructorArguments = [] ]) : MockObject
Parameters
$originalClassName : string
$constructorArguments : array<string|int, mixed> = []
Tags
psalm-template

RealInstanceType of object

psalm-param

class-string $originalClassName

psalm-return

MockObject&RealInstanceType

Return values
MockObject

getHeaderEmitted()

Return first matching emitted header.

protected getHeaderEmitted(string $header[, bool $ignoreCase = false ]) : string|null
Parameters
$header : string

Identifier of the header of interest

$ignoreCase : bool = false
Return values
string|null

The value of the header found, null if not found

getMockClass()

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

protected getMockClass(string $originalClassName[, null|array<string|int, mixed> $methods = [] ][, array<string|int, mixed> $arguments = [] ][, string $mockClassName = '' ][, bool $callOriginalConstructor = false ][, bool $callOriginalClone = true ][, bool $callAutoload = true ][, bool $cloneArguments = false ]) : string
Parameters
$originalClassName : string
$methods : null|array<string|int, mixed> = []

$methods

$arguments : array<string|int, mixed> = []
$mockClassName : string = ''
$callOriginalConstructor : bool = false
$callOriginalClone : bool = true
$callAutoload : bool = true
$cloneArguments : bool = false
Tags
psalm-template

RealInstanceType of object

psalm-param

class-string|string $originalClassName

psalm-return

class-string<MockObject&RealInstanceType>

Return values
string

getMockForAbstractClass()

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

protected getMockForAbstractClass(string $originalClassName[, array<string|int, mixed> $arguments = [] ][, string $mockClassName = '' ][, bool $callOriginalConstructor = true ][, bool $callOriginalClone = true ][, bool $callAutoload = true ][, array<string|int, mixed> $mockedMethods = [] ][, bool $cloneArguments = false ]) : MockObject

To mock concrete methods, use the 7th parameter ($mockedMethods).

Parameters
$originalClassName : string
$arguments : array<string|int, mixed> = []
$mockClassName : string = ''
$callOriginalConstructor : bool = true
$callOriginalClone : bool = true
$callAutoload : bool = true
$mockedMethods : array<string|int, mixed> = []
$cloneArguments : bool = false
Tags
psalm-template

RealInstanceType of object

psalm-param

class-string $originalClassName

psalm-return

MockObject&RealInstanceType

Return values
MockObject

getMockForTrait()

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.

protected getMockForTrait(string $traitName[, array<string|int, mixed> $arguments = [] ][, string $mockClassName = '' ][, bool $callOriginalConstructor = true ][, bool $callOriginalClone = true ][, bool $callAutoload = true ][, array<string|int, mixed> $mockedMethods = [] ][, bool $cloneArguments = false ]) : MockObject
Parameters
$traitName : string
$arguments : array<string|int, mixed> = []
$mockClassName : string = ''
$callOriginalConstructor : bool = true
$callOriginalClone : bool = true
$callAutoload : bool = true
$mockedMethods : array<string|int, mixed> = []
$cloneArguments : bool = false
Tags
psalm-param

trait-string $traitName

Return values
MockObject

getMockFromWsdl()

Returns a mock object based on the given WSDL file.

protected getMockFromWsdl(string $wsdlFile[, string $originalClassName = '' ][, string $mockClassName = '' ][, array<string|int, mixed> $methods = [] ][, bool $callOriginalConstructor = true ][, array<string|int, mixed> $options = [] ]) : MockObject
Parameters
$wsdlFile : string
$originalClassName : string = ''
$mockClassName : string = ''
$methods : array<string|int, mixed> = []
$callOriginalConstructor : bool = true
$options : array<string|int, mixed> = []
Tags
psalm-template

RealInstanceType of object

psalm-param

class-string|string $originalClassName

psalm-return

MockObject&RealInstanceType

Return values
MockObject

getObjectForTrait()

Returns an object for the specified trait.

protected getObjectForTrait(string $traitName[, array<string|int, mixed> $arguments = [] ][, string $traitClassName = '' ][, bool $callOriginalConstructor = true ][, bool $callOriginalClone = true ][, bool $callAutoload = true ]) : object
Parameters
$traitName : string
$arguments : array<string|int, mixed> = []
$traitClassName : string = ''
$callOriginalConstructor : bool = true
$callOriginalClone : bool = true
$callAutoload : bool = true
Tags
psalm-param

trait-string $traitName

Return values
object

iniSet()

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.

protected iniSet(string $varName, string $newValue) : void
Parameters
$varName : string
$newValue : string
Tags
throws
Exception
Return values
void

migrateDatabase()

Run migrations as defined by the class

protected migrateDatabase() : mixed
Return values
mixed

mockCache()

Injects the mock Cache driver to prevent filesystem collisions

protected mockCache() : mixed
Return values
mixed

mockEmail()

Injects the mock email driver so no emails really send

protected mockEmail() : mixed
Return values
mixed

mockSession()

Injects the mock session driver into Services

protected mockSession() : mixed
Return values
mixed

onNotSuccessfulTest()

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

protected onNotSuccessfulTest(Throwable $t) : void
Parameters
$t : Throwable
Tags
throws
Throwable
Return values
void

populateGlobals()

Populates the data of our Request with "global" data relevant to the request, like $_POST data.

protected populateGlobals(string $method, Request $request[, array<string|int, mixed>|null $params = null ]) : Request

Always populate the GET vars based on the URI.

Parameters
$method : string
$request : Request
$params : array<string|int, mixed>|null = null
Tags
throws
ReflectionException
Return values
Request

recordDoubledType()

protected recordDoubledType(string $originalClassName) : void
Parameters
$originalClassName : string
Return values
void

regressDatabase()

Regress migrations as defined by the class

protected regressDatabase() : mixed
Return values
mixed

resetFactories()

Resets shared instanced for all Factories components

protected resetFactories() : mixed
Return values
mixed

resetServices()

Resets shared instanced for all Services

protected resetServices() : mixed
Return values
mixed

runSeeds()

Run seeds as defined by the class

protected runSeeds() : mixed
Return values
mixed

runTest()

Override to run the test and assert its state.

protected runTest() : mixed
Tags
throws
InvalidArgumentException
throws
AssertionFailedError
throws
Exception
throws
ExpectationFailedException
throws
Throwable
Return values
mixed

setLocale()

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

protected setLocale(mixed ...$args) : void
Parameters
$args : mixed
Tags
throws
Exception
Return values
void

setRequestBody()

Set the request's body formatted according to the value in $this->bodyFormat.

protected setRequestBody(Request $request[, null|array<string|int, mixed> $params = null ]) : Request

This allows the body to be formatted in a way that the controller is going to expect as in the case of testing a JSON or XML API.

Parameters
$request : Request
$params : null|array<string|int, mixed> = null

The parameters to be formatted and put in the body. If this is empty, it will get the what has been loaded into the request global of the request class.

Return values
Request

setUp()

This method is called before each test.

protected setUp() : void
Return values
void

setUpDatabase()

Runs the trait set up methods.

protected setUpDatabase() : mixed
Return values
mixed

setUpMigrate()

Migrate on setUp

protected setUpMigrate() : mixed
Return values
mixed

setupRequest()

Setup a Request object to use so that CodeIgniter won't try to auto-populate some of the items.

protected setupRequest(string $method[, string|null $path = null ]) : IncomingRequest
Parameters
$method : string
$path : string|null = null
Return values
IncomingRequest

setUpSeed()

Seed on setUp

protected setUpSeed() : mixed
Return values
mixed

tearDown()

This method is called after each test.

protected tearDown() : void
Return values
void

tearDownDatabase()

Runs the trait set up methods.

protected tearDownDatabase() : mixed
Return values
mixed

withRoutes()

Sets a RouteCollection that will override the application's route collection.

protected withRoutes([array<string|int, mixed> $routes = null ]) : $this

Example routes: [ ['get', 'home', 'Home::index'] ]

Parameters
$routes : array<string|int, mixed> = null
Return values
$this

callTraitMethods()

Checks for traits with corresponding methods for setUp or tearDown.

private callTraitMethods(string $stage) : void
Parameters
$stage : string

'setUp' or 'tearDown'

Return values
void

checkExceptionExpectations()

private checkExceptionExpectations(Throwable $throwable) : bool
Parameters
$throwable : Throwable
Tags
throws
Exception
Return values
bool

checkRequirements()

private checkRequirements() : void
Tags
throws
SkippedTestError
throws
SyntheticSkippedError
throws
Warning
Return values
void

cleanupIniSettings()

private cleanupIniSettings() : void
Return values
void

cleanupLocaleSettings()

private cleanupLocaleSettings() : void
Return values
void

compareGlobalStateSnapshotPart()

private compareGlobalStateSnapshotPart(array<string|int, mixed> $before, array<string|int, mixed> $after, string $header) : void
Parameters
$before : array<string|int, mixed>
$after : array<string|int, mixed>
$header : string
Tags
throws
RiskyTestError
Return values
void

createGlobalStateSnapshot()

private createGlobalStateSnapshot(bool $backupGlobals) : Snapshot
Parameters
$backupGlobals : bool
Return values
Snapshot

createMockObject()

private createMockObject(string $originalClassName) : MockObject
Parameters
$originalClassName : string
Tags
psalm-template

RealInstanceType of object

psalm-param

class-string $originalClassName

psalm-return

MockObject&RealInstanceType

Return values
MockObject

createWarning()

private static createWarning(string $warning) : void
Parameters
$warning : string
Tags
codeCoverageIgnore
Return values
void

detectLocationHint()

private static detectLocationHint(string $message) : array<string|int, mixed>|null
Parameters
$message : string
Return values
array<string|int, mixed>|null

getAccessibleRefProperty()

Find an accessible property.

private static getAccessibleRefProperty(object|string $obj, string $property) : ReflectionProperty
Parameters
$obj : object|string
$property : string
Tags
throws
ReflectionException
Return values
ReflectionProperty

getMockObjectGenerator()

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

private getMockObjectGenerator() : Generator
Return values
Generator

handleDependencies()

private handleDependencies() : bool
Return values
bool

isCallableTestMethod()

private isCallableTestMethod(string $dependency) : bool
Parameters
$dependency : string
Return values
bool

isValidClassAttributeName()

private static isValidClassAttributeName(string $attributeName) : bool
Parameters
$attributeName : string
Return values
bool

isValidObjectAttributeName()

private static isValidObjectAttributeName(string $attributeName) : bool
Parameters
$attributeName : string
Return values
bool

markSkippedForMissingDependency()

private markSkippedForMissingDependency(ExecutionOrderDependency $dependency) : void
Parameters
$dependency : ExecutionOrderDependency
Return values
void

markSkippedForNotSpecifyingDependency()

private markSkippedForNotSpecifyingDependency() : void
Return values
void

markWarningForUncallableDependency()

private markWarningForUncallableDependency(ExecutionOrderDependency $dependency) : void
Parameters
$dependency : ExecutionOrderDependency
Return values
void

runInSeparateProcess()

private runInSeparateProcess() : bool
Return values
bool

setDoesNotPerformAssertionsFromAnnotation()

private setDoesNotPerformAssertionsFromAnnotation() : void
Return values
void

snapshotGlobalState()

private snapshotGlobalState() : void
Return values
void

startOutputBuffering()

private startOutputBuffering() : void
Return values
void

stopOutputBuffering()

private stopOutputBuffering() : void
Tags
throws
RiskyTestError
Return values
void

unregisterCustomComparators()

private unregisterCustomComparators() : void
Return values
void

verifyMockObjects()

private verifyMockObjects() : void
Tags
throws
Throwable
Return values
void

Search results