Class CIDatabaseTestCase

Summary

Fully Qualified Name: CodeIgniter\Test\CIDatabaseTestCase
Extends: CIUnitTestCase

Description

CIDatabaseTestCase

Methods

Name Description Defined By
assertCloseEnough() Custom function to test that two values are "close enough". CIUnitTestCase
assertCloseEnoughString() Custom function to test that two values are "close enough". CIUnitTestCase
assertEventTriggered() Hooks into CodeIgniter's Events system to check if a specific event was triggered or not. CIUnitTestCase
assertHeaderEmitted() Hooks into xdebug's headers capture, looking for a specific header emitted CIUnitTestCase
assertHeaderNotEmitted() Hooks into xdebug's headers capture, looking for a specific header emitted CIUnitTestCase
assertLogged() Custom function to hook into CodeIgniter's Logging mechanism to check if certain messages were logged during code execution. CIUnitTestCase
dontSeeInDatabase() Asserts that records that match the conditions in $where do not exist in the database. CIDatabaseTestCase
grabFromDatabase() Fetches a single column from a database row with criteria matching $where. CIDatabaseTestCase
hasInDatabase() Inserts a row into to the database. This row will be removed after the test has run. CIDatabaseTestCase
loadDependencies() Load any database test dependencies. CIDatabaseTestCase
seeInDatabase() Asserts that records that match the conditions in $where DO exist in the database. CIDatabaseTestCase
seeNumRecords() Asserts that the number of rows in the database that match $where is equal to $expected. CIDatabaseTestCase
seed() Seeds that database with a specific seeder. CIDatabaseTestCase

Method Details

assertCloseEnough()

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

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.

Parameter Name Type Description
$expected int
$actual mixed
$message string
$tolerance int

Returns:

assertCloseEnoughString()

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

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.

Parameter Name Type Description
$expected mixed
$actual mixed
$message string
$tolerance int

Returns: bool

assertEventTriggered()

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

Parameter Name Type Description
$eventName string

Returns: bool

assertHeaderEmitted()

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

Parameter Name Type Description
$header string The
$ignoreCase bool

Returns:

assertHeaderNotEmitted()

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

Parameter Name Type Description
$header string The
$ignoreCase bool

Returns:

assertLogged()

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

Parameter Name Type Description
$level string
$expectedMessage null

Returns: bool

dontSeeInDatabase()

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

Parameter Name Type Description
$table string
$where array

Returns: bool

grabFromDatabase()

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

Parameter Name Type Description
$table string
$column string
$where array

Returns: bool

hasInDatabase()

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

Parameter Name Type Description
$table string
$data array

Returns: bool

loadDependencies()

Load any database test dependencies.

Returns:

seeInDatabase()

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

Parameter Name Type Description
$table string
$where array

Returns: bool

seeNumRecords()

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

Parameter Name Type Description
$expected int
$table string
$where array

Returns: bool

seed()

Seeds that database with a specific seeder.

Parameter Name Type Description
$name string

Returns:

Top