protected function UcAddressesEntityCase::assertEntityHookNotInvoked in Ubercart Addresses 7
Asserts if a certain hook is NOT invoked.
Parameters
string $hook: The hook that was invoked.
object $entity: The entity that was passed with the hook.
Return value
void
1 call to UcAddressesEntityCase::assertEntityHookNotInvoked()
- UcAddressesEntityCase::testHooks in tests/
uc_addresses.entity.test - Test if entity hooks are invoked when using the address book API.
File
- tests/
uc_addresses.entity.test, line 580 - Test cases address entity.
Class
- UcAddressesEntityCase
- Tests for Entity API integration.
Code
protected function assertEntityHookNotInvoked($hook, $entity_id, $message = NULL) {
if (is_null($message)) {
$message = t('The hook %hook was not invoked upon an uc_addresses entity with id %id', array(
'%hook' => $hook . '()',
'%id' => $entity_id,
));
}
// We can not use variable_get() here, because that returns the
// on runtime cached variables.
$serialized_value = db_select('variable')
->fields('variable', array(
'value',
))
->condition('name', 'uc_addresses_' . $hook)
->execute()
->fetchField();
if (!$serialized_value) {
$this
->pass($message);
return;
}
$value = unserialize($serialized_value);
$this
->verbose($value);
$this
->assertNotEqual($value, $entity_id, $message);
}