function DateRestrictionsBase::runTests in Date Restrictions 7
Tests a restrictions on every combination of field types and widget.
10 calls to DateRestrictionsBase::runTests()
- DateRestrictionsHostEntityMinMaxTestCase::testDateGreaterThanMax in modules/
minmax/ tests/ date_restrictions_minmax_host_entity.test - Fixed max date.
- DateRestrictionsHostEntityMinMaxTestCase::testDateLowerThanMin in modules/
minmax/ tests/ date_restrictions_minmax_host_entity.test - Fixed min date.
- DateRestrictionsHostEntityMinMaxTestCase::testIntervalGreaterThanMax in modules/
minmax/ tests/ date_restrictions_minmax_host_entity.test - Fixed max interval.
- DateRestrictionsHostEntityMinMaxTestCase::testIntervalLowerThanMin in modules/
minmax/ tests/ date_restrictions_minmax_host_entity.test - Fixed min interval.
- DateRestrictionsStaticMinMaxTestCase::testDateGreaterThanMax in modules/
minmax/ tests/ date_restrictions_minmax.test - Fixed max date.
File
- tests/
date_restrictions_base.test, line 50 - Tests for date_restrictions.module.
Class
- DateRestrictionsBase
- Base class for Date Restrictions tests.
Code
function runTests($restrictions, $restrictions2, $callback) {
foreach ($this->date_field_types as $field_type) {
foreach ($this->date_widget_types as $widget_type) {
$field_name = "field_{$field_type}";
// Set widget type and restrictions for field instance.
$instance = field_info_instance('node', $field_name, 'story');
$instance['widget']['type'] = $widget_type;
$instance['settings']['restrictions'] = $restrictions;
$instance['settings']['restrictions2'] = $restrictions2;
field_update_instance($instance);
$context = array(
'field_name' => $field_name,
'field_type' => $field_type,
'widget_type' => $widget_type,
'restrictions' => $restrictions,
'restrictions2' => $restrictions2,
);
call_user_func($callback, $context);
// Unset restrictions.
$instance = field_info_instance('node', $field_name, 'story');
unset($instance['settings']['restrictions']);
unset($instance['settings']['restriction2']);
field_update_instance($instance);
}
}
}