Commit 827b39b4 authored by alexpott's avatar alexpott

Issue #2384167 by tibbsa: Clean-up DateTime module test members — ensure...

Issue #2384167 by tibbsa: Clean-up DateTime module test members — ensure property definition and use of camelCase naming convention
parent e55610f8
...@@ -35,6 +35,13 @@ class DateTimeFieldTest extends WebTestBase { ...@@ -35,6 +35,13 @@ class DateTimeFieldTest extends WebTestBase {
*/ */
public static $modules = array('node', 'entity_test', 'datetime', 'field_ui'); public static $modules = array('node', 'entity_test', 'datetime', 'field_ui');
/**
* An array of display options to pass to entity_get_display()
*
* @var array
*/
protected $displayOptions;
/** /**
* A field storage to use in this test class. * A field storage to use in this test class.
* *
...@@ -83,13 +90,13 @@ protected function setUp() { ...@@ -83,13 +90,13 @@ protected function setUp() {
)) ))
->save(); ->save();
$this->display_options = array( $this->displayOptions = array(
'type' => 'datetime_default', 'type' => 'datetime_default',
'label' => 'hidden', 'label' => 'hidden',
'settings' => array('format_type' => 'medium'), 'settings' => array('format_type' => 'medium'),
); );
entity_get_display($this->field->entity_type, $this->field->bundle, 'full') entity_get_display($this->field->entity_type, $this->field->bundle, 'full')
->setComponent($field_name, $this->display_options) ->setComponent($field_name, $this->displayOptions)
->save(); ->save();
} }
...@@ -131,9 +138,9 @@ function testDateField() { ...@@ -131,9 +138,9 @@ function testDateField() {
foreach ($options as $setting => $values) { foreach ($options as $setting => $values) {
foreach ($values as $new_value) { foreach ($values as $new_value) {
// Update the entity display settings. // Update the entity display settings.
$this->display_options['settings'] = array($setting => $new_value); $this->displayOptions['settings'] = array($setting => $new_value);
entity_get_display($this->field->entity_type, $this->field->bundle, 'full') entity_get_display($this->field->entity_type, $this->field->bundle, 'full')
->setComponent($field_name, $this->display_options) ->setComponent($field_name, $this->displayOptions)
->save(); ->save();
$this->renderTestEntity($id); $this->renderTestEntity($id);
...@@ -149,10 +156,10 @@ function testDateField() { ...@@ -149,10 +156,10 @@ function testDateField() {
} }
// Verify that the plain formatter works. // Verify that the plain formatter works.
$this->display_options['type'] = 'datetime_plain'; $this->displayOptions['type'] = 'datetime_plain';
$this->display_options['settings'] = array(); $this->displayOptions['settings'] = array();
entity_get_display($this->field->entity_type, $this->field->bundle, 'full') entity_get_display($this->field->entity_type, $this->field->bundle, 'full')
->setComponent($field_name, $this->display_options) ->setComponent($field_name, $this->displayOptions)
->save(); ->save();
$expected = $date->format(DATETIME_DATE_STORAGE_FORMAT); $expected = $date->format(DATETIME_DATE_STORAGE_FORMAT);
$this->renderTestEntity($id); $this->renderTestEntity($id);
...@@ -197,9 +204,9 @@ function testDatetimeField() { ...@@ -197,9 +204,9 @@ function testDatetimeField() {
foreach ($options as $setting => $values) { foreach ($options as $setting => $values) {
foreach ($values as $new_value) { foreach ($values as $new_value) {
// Update the entity display settings. // Update the entity display settings.
$this->display_options['settings'] = array($setting => $new_value); $this->displayOptions['settings'] = array($setting => $new_value);
entity_get_display($this->field->entity_type, $this->field->bundle, 'full') entity_get_display($this->field->entity_type, $this->field->bundle, 'full')
->setComponent($field_name, $this->display_options) ->setComponent($field_name, $this->displayOptions)
->save(); ->save();
$this->renderTestEntity($id); $this->renderTestEntity($id);
...@@ -215,10 +222,10 @@ function testDatetimeField() { ...@@ -215,10 +222,10 @@ function testDatetimeField() {
} }
// Verify that the plain formatter works. // Verify that the plain formatter works.
$this->display_options['type'] = 'datetime_plain'; $this->displayOptions['type'] = 'datetime_plain';
$this->display_options['settings'] = array(); $this->displayOptions['settings'] = array();
entity_get_display($this->field->entity_type, $this->field->bundle, 'full') entity_get_display($this->field->entity_type, $this->field->bundle, 'full')
->setComponent($field_name, $this->display_options) ->setComponent($field_name, $this->displayOptions)
->save(); ->save();
$expected = $date->format(DATETIME_DATETIME_STORAGE_FORMAT); $expected = $date->format(DATETIME_DATETIME_STORAGE_FORMAT);
$this->renderTestEntity($id); $this->renderTestEntity($id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment