function BreakpointsTestCase::verifyBreakpoint in Breakpoints 7
Verify that a breakpoint is properly stored.
2 calls to BreakpointsTestCase::verifyBreakpoint()
- BreakpointsAdminTestCase::testBreakpointExportImport in ./
breakpoints.test - Test breakpoint export/import functionality.
- BreakpointsCRUDTestCase::testBreakpointsCRUD in ./
breakpoints.test - Test CRUD operations for breakpoints.
File
- ./
breakpoints.test, line 24 - Tests for breakpoints.module
Class
- BreakpointsTestCase
- Base class for Breakpoint tests.
Code
function verifyBreakpoint($breakpoint, $in_database = TRUE) {
$t_args = array(
'%breakpoint' => $breakpoint->name,
);
$properties = array(
'name',
'breakpoint',
'source',
'source_type',
'status',
'weight',
'multipliers',
);
if ($in_database) {
$properties[] = 'id';
}
$assert_group = t('Breakpoints API');
// Verify text format database record.
$db_breakpoint = db_select('breakpoints', 'b')
->fields('b')
->condition('machine_name', $breakpoint->machine_name)
->execute()
->fetchObject();
$db_breakpoint->multipliers = unserialize($db_breakpoint->multipliers);
foreach ($properties as $property) {
$this
->assertEqual($db_breakpoint->{$property}, $breakpoint->{$property}, t('Database: Proper ' . $property . ' for breakpoint %breakpoint.', $t_args), $assert_group);
}
// Verify breakpoints_breakpoint_load_by_fullkey().
$load_breakpoint = breakpoints_breakpoint_load_by_fullkey($breakpoint->machine_name);
foreach ($properties as $property) {
$this
->assertEqual($load_breakpoint->{$property}, $breakpoint->{$property}, t('breakpoints_breakpoint_load_by_fullkey: Proper ' . $property . ' for breakpoint %breakpoint.', $t_args), $assert_group);
}
}