Tests admin-defined formats in format_date().
function testAdminDefinedFormatDate() {
// Create an admin user.
$this->admin_user = $this
->drupalCreateUser(array(
'administer site configuration',
));
$this
->drupalLogin($this->admin_user);
// Add new date format.
$edit = array(
'date_format_id' => 'example_style',
'date_format_name' => 'Example Style',
'date_format_pattern' => 'j M y',
);
$this
->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
$timestamp = strtotime('2007-03-10T00:00:00+00:00');
$this
->assertIdentical(format_date($timestamp, 'example_style', '', 'America/Los_Angeles'), '9 Mar 07', 'Test format_date() using an admin-defined date type.');
$this
->assertIdentical(format_date($timestamp, 'undefined_style'), format_date($timestamp, 'medium'), 'Test format_date() defaulting to medium when $type not found.');
}