trait DbTestTrait

Class DbTestTrait

Methods

assertAttributesEquals($expectedValues, $actualValues, $message = NULL)

No description

assertDBState($daoName, $id, $match, bool $delete = FALSE)

Generic function to compare expected values after an api call to retrieved.

null|string
assertDBNotNull(string $daoName, $searchValue, $returnColumn, $searchColumn, $message)

Request a record from the DB by seachColumn+searchValue. Success if a record is found.

assertDBNull(string $daoName, $searchValue, $returnColumn, $searchColumn, $message)

Request a record from the DB by seachColumn+searchValue. Success if returnColumn value is NULL.

assertDBRowNotExist(string $daoName, int $id, null $message = NULL)

Request a record from the DB by id. Success if row not found.

assertDBRowExist(string $daoName, int $id, null $message = NULL)

Request a record from the DB by id. Success if row not found.

assertDBCompareValue(string $daoName, $searchValue, $returnColumn, $searchColumn, $expectedValue, $message)

Compare a single column value in a retrieved DB record to an expected value.

assertDBCompareValues(string $daoName, array $searchParams, $expectedValues)

Compare all values in a single retrieved DB record to an array of expected values.

assertDBQuery($expected, $query, array $params = array(), string $message = '')

Assert that a SQL query returns a given value.

Details

at line 13
abstract assertAttributesEquals($expectedValues, $actualValues, $message = NULL)

Parameters

$expectedValues
$actualValues
$message

at line 30
assertDBState($daoName, $id, $match, bool $delete = FALSE)

Generic function to compare expected values after an api call to retrieved.

DB values.

Parameters

$daoName
$id
$match
bool $delete

Exceptions

PHPUnit_Framework_AssertionFailedError

at line 85
null|string assertDBNotNull(string $daoName, $searchValue, $returnColumn, $searchColumn, $message)

Request a record from the DB by seachColumn+searchValue. Success if a record is found.

Parameters

string $daoName
$searchValue
$returnColumn
$searchColumn
$message

Return Value

null|string

Exceptions

PHPUnit_Framework_AssertionFailedError

at line 103
assertDBNull(string $daoName, $searchValue, $returnColumn, $searchColumn, $message)

Request a record from the DB by seachColumn+searchValue. Success if returnColumn value is NULL.

Parameters

string $daoName
$searchValue
$returnColumn
$searchColumn
$message

at line 114
assertDBRowNotExist(string $daoName, int $id, null $message = NULL)

Request a record from the DB by id. Success if row not found.

Parameters

string $daoName
int $id
null $message

at line 126
assertDBRowExist(string $daoName, int $id, null $message = NULL)

Request a record from the DB by id. Success if row not found.

Parameters

string $daoName
int $id
null $message

at line 141
assertDBCompareValue(string $daoName, $searchValue, $returnColumn, $searchColumn, $expectedValue, $message)

Compare a single column value in a retrieved DB record to an expected value.

Parameters

string $daoName
$searchValue
$returnColumn
$searchColumn
$expectedValue
$message

at line 155
assertDBCompareValues(string $daoName, array $searchParams, $expectedValues)

Compare all values in a single retrieved DB record to an array of expected values.

Parameters

string $daoName
array $searchParams
$expectedValues

at line 180
assertDBQuery($expected, $query, array $params = array(), string $message = '')

Assert that a SQL query returns a given value.

The first argument is an expected value. The remaining arguments are passed to CRM_Core_DAO::singleValueQuery

Example: $this->assertSql(2, 'select count(*) from foo where foo.bar like "%1"', array(1 => array("Whiz", "String")));

Parameters

$expected
$query
array $params
string $message

Exceptions

Exception