update core to 7.36

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-19 19:33:23 +02:00
parent 6de56c702c
commit 802ec0c6f3
271 changed files with 4111 additions and 1227 deletions

View File

@@ -484,6 +484,66 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
$this->assertEqual($entity->{$this->field_name}[$langcode], $values, 'Insert: missing field results in default value saved');
}
/**
* Test field_has_data().
*/
function testFieldHasData() {
$entity_type = 'test_entity';
$langcode = LANGUAGE_NONE;
$field_name = 'field_1';
$field = array('field_name' => $field_name, 'type' => 'test_field');
$field = field_create_field($field);
$this->assertFalse(field_has_data($field), "No data should be detected.");
$instance = array(
'field_name' => $field_name,
'entity_type' => 'test_entity',
'bundle' => 'test_bundle'
);
$instance = field_create_instance($instance);
$table = _field_sql_storage_tablename($field);
$revision_table = _field_sql_storage_revision_tablename($field);
$columns = array('entity_type', 'entity_id', 'revision_id', 'delta', 'language', $field_name . '_value');
$eid = 0;
// Insert values into the field revision table.
$query = db_insert($revision_table)->fields($columns);
$query->values(array($entity_type, $eid, 0, 0, $langcode, 1));
$query->execute();
$this->assertTrue(field_has_data($field), "Revision data only should be detected.");
$field_name = 'field_2';
$field = array('field_name' => $field_name, 'type' => 'test_field');
$field = field_create_field($field);
$this->assertFalse(field_has_data($field), "No data should be detected.");
$instance = array(
'field_name' => $field_name,
'entity_type' => 'test_entity',
'bundle' => 'test_bundle'
);
$instance = field_create_instance($instance);
$table = _field_sql_storage_tablename($field);
$revision_table = _field_sql_storage_revision_tablename($field);
$columns = array('entity_type', 'entity_id', 'revision_id', 'delta', 'language', $field_name . '_value');
$eid = 1;
// Insert values into the field table.
$query = db_insert($table)->fields($columns);
$query->values(array($entity_type, $eid, 0, 0, $langcode, 1));
$query->execute();
$this->assertTrue(field_has_data($field), "Values only in field table should be detected.");
}
/**
* Test field_attach_delete().
*/
@@ -2146,11 +2206,12 @@ class FieldDisplayAPITestCase extends FieldTestCase {
'alter' => TRUE,
),
);
$output = field_view_field('test_entity', $this->entity, $this->field_name, $display);
$output = field_view_field('test_entity', $this->entity, $this->field_name, $display, LANGUAGE_NONE);
$this->drupalSetContent(drupal_render($output));
$setting = $display['settings']['test_formatter_setting_multiple'];
$this->assertNoText($this->label, 'Label was not displayed.');
$this->assertText('field_test_field_attach_view_alter', 'Alter fired, display passed.');
$this->assertText('field language is ' . LANGUAGE_NONE, 'Language is placed onto the context.');
$array = array();
foreach ($this->values as $delta => $value) {
$array[] = $delta . ':' . $value['value'];

View File

@@ -6,8 +6,8 @@ files[] = field_test.entity.inc
version = VERSION
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -220,6 +220,10 @@ function field_test_field_attach_view_alter(&$output, $context) {
if (!empty($context['display']['settings']['alter'])) {
$output['test_field'][] = array('#markup' => 'field_test_field_attach_view_alter');
}
if (isset($output['test_field'])) {
$output['test_field'][] = array('#markup' => 'field language is ' . $context['language']);
}
}
/**
@@ -267,3 +271,14 @@ function field_test_query_efq_table_prefixing_test_alter(&$query) {
// exception if the EFQ does not properly prefix the base table.
$query->join('test_entity','te2','%alias.ftid = test_entity.ftid');
}
/**
* Implements hook_query_TAG_alter() for tag 'store_global_test_query'.
*/
function field_test_query_store_global_test_query_alter($query) {
// Save the query in a global variable so that it can be examined by tests.
// This can be used by any test which needs to check a query, but see
// FieldSqlStorageTestCase::testFieldSqlStorageMultipleConditionsSameColumn()
// for an example.
$GLOBALS['test_query'] = $query;
}