Commit b309418e authored by catch's avatar catch

Issue #2623232 by xjm, plach, benjy, penyaskito: Improve messages when...

Issue #2623232 by xjm, plach, benjy, penyaskito: Improve messages when entity/field mismatch happens
parent 974e3402
......@@ -53,15 +53,14 @@ public function getChangeSummary() {
// Process entity type definition changes.
if (!empty($change_list['entity_type'])) {
$entity_type = $this->entityManager->getDefinition($entity_type_id);
$t_args = array('%entity_type' => $entity_type->getLabel());
switch ($change_list['entity_type']) {
case static::DEFINITION_CREATED:
$summary[$entity_type_id][] = $this->t('Create the %entity_type entity type.', $t_args);
$summary[$entity_type_id][] = $this->t('The %entity_type entity type needs to be installed.', ['%entity_type' => $entity_type->getLabel()]);
break;
case static::DEFINITION_UPDATED:
$summary[$entity_type_id][] = $this->t('Update the %entity_type entity type.', $t_args);
$summary[$entity_type_id][] = $this->t('The %entity_type entity type needs to be updated.', ['%entity_type' => $entity_type->getLabel()]);
break;
}
}
......@@ -74,15 +73,15 @@ public function getChangeSummary() {
foreach ($change_list['field_storage_definitions'] as $field_name => $change) {
switch ($change) {
case static::DEFINITION_CREATED:
$summary[$entity_type_id][] = $this->t('Create the %field_name field.', array('%field_name' => $storage_definitions[$field_name]->getLabel()));
$summary[$entity_type_id][] = $this->t('The %field_name field needs to be installed.', ['%field_name' => $storage_definitions[$field_name]->getLabel()]);
break;
case static::DEFINITION_UPDATED:
$summary[$entity_type_id][] = $this->t('Update the %field_name field.', array('%field_name' => $storage_definitions[$field_name]->getLabel()));
$summary[$entity_type_id][] = $this->t('The %field_name field needs to be updated.', ['%field_name' => $storage_definitions[$field_name]->getLabel()]);
break;
case static::DEFINITION_DELETED:
$summary[$entity_type_id][] = $this->t('Delete the %field_name field.', array('%field_name' => $original_storage_definitions[$field_name]->getLabel()));
$summary[$entity_type_id][] = $this->t('The %field_name field needs to be uninstalled.', ['%field_name' => $original_storage_definitions[$field_name]->getLabel()]);
break;
}
}
......
......@@ -181,8 +181,8 @@ public function getLanguageSwitchLinks(Request $request, $type, Url $url) {
* \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationContentEntity::processOutbound().
*
* @return bool
* TRUE if the content entity language negotiator has higher priority than
* the url language negotiator, FALSE otherwise.
* TRUE if the the content entity language negotiator has higher priority
* than the url language negotiator, FALSE otherwise.
*/
protected function hasLowerLanguageNegotiationWeight() {
if (!isset($this->hasLowerLanguageNegotiationWeightResult)) {
......
......@@ -105,7 +105,7 @@ public function testEntityTypeUpdateWithoutData() {
$this->assertTrue($this->entityDefinitionUpdateManager->needsUpdates(), 'EntityDefinitionUpdateManager reports that updates are needed.');
$expected = array(
'entity_test_update' => array(
t('Update the %entity_type entity type.', array('%entity_type' => $this->entityManager->getDefinition('entity_test_update')->getLabel())),
t('The %entity_type entity type needs to be updated.', ['%entity_type' => $this->entityManager->getDefinition('entity_test_update')->getLabel()]),
),
);
$this->assertEqual($this->entityDefinitionUpdateManager->getChangeSummary(), $expected); //, 'EntityDefinitionUpdateManager reports the expected change summary.');
......@@ -144,7 +144,7 @@ public function testBaseFieldCreateUpdateDeleteWithoutData() {
$this->assertTrue($this->entityDefinitionUpdateManager->needsUpdates(), 'EntityDefinitionUpdateManager reports that updates are needed.');
$expected = array(
'entity_test_update' => array(
t('Create the %field_name field.', array('%field_name' => t('A new base field'))),
t('The %field_name field needs to be installed.', ['%field_name' => t('A new base field')]),
),
);
$this->assertEqual($this->entityDefinitionUpdateManager->getChangeSummary(), $expected, 'EntityDefinitionUpdateManager reports the expected change summary.');
......@@ -157,7 +157,7 @@ public function testBaseFieldCreateUpdateDeleteWithoutData() {
$this->assertTrue($this->entityDefinitionUpdateManager->needsUpdates(), 'EntityDefinitionUpdateManager reports that updates are needed.');
$expected = array(
'entity_test_update' => array(
t('Update the %field_name field.', array('%field_name' => t('A new base field'))),
t('The %field_name field needs to be updated.', ['%field_name' => t('A new base field')]),
),
);
$this->assertEqual($this->entityDefinitionUpdateManager->getChangeSummary(), $expected, 'EntityDefinitionUpdateManager reports the expected change summary.');
......@@ -170,7 +170,7 @@ public function testBaseFieldCreateUpdateDeleteWithoutData() {
$this->assertTrue($this->entityDefinitionUpdateManager->needsUpdates(), 'EntityDefinitionUpdateManager reports that updates are needed.');
$expected = array(
'entity_test_update' => array(
t('Update the %field_name field.', array('%field_name' => t('A new base field'))),
t('The %field_name field needs to be updated.', ['%field_name' => t('A new base field')]),
),
);
$this->assertEqual($this->entityDefinitionUpdateManager->getChangeSummary(), $expected, 'EntityDefinitionUpdateManager reports the expected change summary.');
......@@ -184,7 +184,7 @@ public function testBaseFieldCreateUpdateDeleteWithoutData() {
$this->assertTrue($this->entityDefinitionUpdateManager->needsUpdates(), 'EntityDefinitionUpdateManager reports that updates are needed.');
$expected = array(
'entity_test_update' => array(
t('Update the %field_name field.', array('%field_name' => t('A new base field'))),
t('The %field_name field needs to be updated.', ['%field_name' => t('A new base field')]),
),
);
$this->assertEqual($this->entityDefinitionUpdateManager->getChangeSummary(), $expected, 'EntityDefinitionUpdateManager reports the expected change summary.');
......@@ -199,7 +199,7 @@ public function testBaseFieldCreateUpdateDeleteWithoutData() {
$this->assertTrue($this->entityDefinitionUpdateManager->needsUpdates(), 'EntityDefinitionUpdateManager reports that updates are needed.');
$expected = array(
'entity_test_update' => array(
t('Delete the %field_name field.', array('%field_name' => t('A new base field'))),
t('The %field_name field needs to be uninstalled.', ['%field_name' => t('A new base field')]),
),
);
$this->assertEqual($this->entityDefinitionUpdateManager->getChangeSummary(), $expected, 'EntityDefinitionUpdateManager reports the expected change summary.');
......@@ -218,7 +218,7 @@ public function testBundleFieldCreateUpdateDeleteWithoutData() {
$this->assertTrue($this->entityDefinitionUpdateManager->needsUpdates(), 'EntityDefinitionUpdateManager reports that updates are needed.');
$expected = array(
'entity_test_update' => array(
t('Create the %field_name field.', array('%field_name' => t('A new bundle field'))),
t('The %field_name field needs to be installed.', ['%field_name' => t('A new bundle field')]),
),
);
$this->assertEqual($this->entityDefinitionUpdateManager->getChangeSummary(), $expected, 'EntityDefinitionUpdateManager reports the expected change summary.');
......@@ -231,9 +231,9 @@ public function testBundleFieldCreateUpdateDeleteWithoutData() {
$this->modifyBundleField();
$this->assertTrue($this->entityDefinitionUpdateManager->needsUpdates(), 'EntityDefinitionUpdateManager reports that updates are needed.');
$expected = array(
'entity_test_update' => array(
t('Update the %field_name field.', array('%field_name' => t('A new bundle field'))),
),
'entity_test_update' => [
t('The %field_name field needs to be updated.', ['%field_name' => t('A new bundle field')]),
],
);
$this->assertEqual($this->entityDefinitionUpdateManager->getChangeSummary(), $expected, 'EntityDefinitionUpdateManager reports the expected change summary.');
$this->entityDefinitionUpdateManager->applyUpdates();
......@@ -245,7 +245,7 @@ public function testBundleFieldCreateUpdateDeleteWithoutData() {
$this->assertTrue($this->entityDefinitionUpdateManager->needsUpdates(), 'EntityDefinitionUpdateManager reports that updates are needed.');
$expected = array(
'entity_test_update' => array(
t('Delete the %field_name field.', array('%field_name' => t('A new bundle field'))),
t('The %field_name field needs to be uninstalled.', ['%field_name' => t('A new bundle field')]),
),
);
$this->assertEqual($this->entityDefinitionUpdateManager->getChangeSummary(), $expected, 'EntityDefinitionUpdateManager reports the expected change summary.');
......@@ -487,7 +487,7 @@ public function testEntityIndexCreateDeleteWithoutData() {
$this->assertTrue($this->entityDefinitionUpdateManager->needsUpdates(), 'EntityDefinitionUpdateManager reports that updates are needed.');
$expected = array(
'entity_test_update' => array(
t('Update the %entity_type entity type.', array('%entity_type' => $this->entityManager->getDefinition('entity_test_update')->getLabel())),
t('The %entity_type entity type needs to be updated.', ['%entity_type' => $this->entityManager->getDefinition('entity_test_update')->getLabel()]),
),
);
$this->assertEqual($this->entityDefinitionUpdateManager->getChangeSummary(), $expected, 'EntityDefinitionUpdateManager reports the expected change summary.');
......@@ -502,7 +502,7 @@ public function testEntityIndexCreateDeleteWithoutData() {
$this->assertTrue($this->entityDefinitionUpdateManager->needsUpdates(), 'EntityDefinitionUpdateManager reports that updates are needed.');
$expected = array(
'entity_test_update' => array(
t('Update the %entity_type entity type.', array('%entity_type' => $this->entityManager->getDefinition('entity_test_update')->getLabel())),
t('The %entity_type entity type needs to be updated.', ['%entity_type' => $this->entityManager->getDefinition('entity_test_update')->getLabel()]),
),
);
$this->assertEqual($this->entityDefinitionUpdateManager->getChangeSummary(), $expected, 'EntityDefinitionUpdateManager reports the expected change summary.');
......
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