diff -u b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php --- b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php @@ -108,27 +108,2 @@ } - - /** - * {@inheritdoc} - */ - protected function actions(array $form, array &$form_state) { - $actions = parent::actions($form, $form_state); - $actions['delete'] = array( - '#type' => 'submit', - '#value' => $this->t('Delete'), - '#submit' => array( - array($this, 'delete'), - ), - ); - return $actions; - } - - /** - * Overrides Drupal\Core\Entity\EntityFormController::delete(). - */ - public function delete(array $form, array &$form_state) { - $entity = $this->entity; - $entity->delete(); - drupal_set_message(t('%entity_type @id has been deleted.', array('@id' => $entity->id(), '%entity_type' => $entity->getEntityTypeId()))); - $form_state['redirect_route']['route_name'] = ''; - } } only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFormTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFormTest.php @@ -84,7 +84,9 @@ protected function assertFormCRUD($entity_type) { $this->assertTrue($entity, format_string('%entity_type: Modified entity found in the database.', array('%entity_type' => $entity_type))); $this->assertNotEqual($entity->name->value, $name1, format_string('%entity_type: The entity name has been modified.', array('%entity_type' => $entity_type))); - $this->drupalPostForm($entity_type . '/manage/' . $entity->id(), array(), t('Delete')); + $this->drupalGet($entity_type . '/manage/' . $entity->id()); + $this->clickLink(t('Delete')); + $this->drupalPostForm(NULL, array(), t('Confirm')); $entity = $this->loadEntityByName($entity_type, $name2); $this->assertFalse($entity, format_string('%entity_type: Entity not found in the database.', array('%entity_type' => $entity_type))); } only in patch2: unchanged: --- a/core/modules/system/tests/modules/entity_test/entity_test.routing.yml +++ b/core/modules/system/tests/modules/entity_test/entity_test.routing.yml @@ -5,6 +5,34 @@ entity_test.render: requirements: _access: 'TRUE' +entity_test.delete_entity_test: + path: '/entity_test/delete/entity_test/{entity_test}' + defaults: + _entity_form: entity_test.delete + requirements: + _access: 'TRUE' + +entity_test.delete_entity_test_mul: + path: '/entity_test/delete/entity_test_mul/{entity_test_mul}' + defaults: + _entity_form: entity_test_mul.delete + requirements: + _access: 'TRUE' + +entity_test.delete_entity_test_mulrev: + path: '/entity_test/delete/entity_test_mulrev/{entity_test_mulrev}' + defaults: + _entity_form: entity_test_mulrev.delete + requirements: + _access: 'TRUE' + +entity_test.delete_entity_test_rev: + path: '/entity_test/delete/entity_test_rev/{entity_test_rev}' + defaults: + _entity_form: entity_test_rev.delete + requirements: + _access: 'TRUE' + entity_test.render_options: path: '/entity_test_converter/{foo}' options: only in patch2: unchanged: --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTest.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTest.php @@ -25,7 +25,8 @@ * "view_builder" = "Drupal\entity_test\EntityTestViewBuilder", * "access" = "Drupal\entity_test\EntityTestAccessController", * "form" = { - * "default" = "Drupal\entity_test\EntityTestFormController" + * "default" = "Drupal\entity_test\EntityTestFormController", + * "delete" = "Drupal\entity_test\EntityTestDeleteFormController" * }, * "translation" = "Drupal\content_translation\ContentTranslationHandler" * }, @@ -41,6 +42,7 @@ * links = { * "canonical" = "entity_test.render", * "edit-form" = "entity_test.edit_entity_test", + * "delete-form" = "entity_test.delete_entity_test", * "admin-form" = "entity_test.admin_entity_test" * } * ) only in patch2: unchanged: --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMul.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMul.php @@ -21,7 +21,8 @@ * "view_builder" = "Drupal\entity_test\EntityTestViewBuilder", * "access" = "Drupal\entity_test\EntityTestAccessController", * "form" = { - * "default" = "Drupal\entity_test\EntityTestFormController" + * "default" = "Drupal\entity_test\EntityTestFormController", + * "delete" = "Drupal\entity_test\EntityTestDeleteFormController" * }, * "translation" = "Drupal\content_translation\ContentTranslationHandler" * }, @@ -38,6 +39,7 @@ * links = { * "canonical" = "entity_test.edit_entity_test_mul", * "edit-form" = "entity_test.edit_entity_test_mul", + * "delete-form" = "entity_test.delete_entity_test_mul", * "admin-form" = "entity_test.admin_entity_test_mul" * } * ) only in patch2: unchanged: --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php @@ -20,7 +20,8 @@ * controllers = { * "access" = "Drupal\entity_test\EntityTestAccessController", * "form" = { - * "default" = "Drupal\entity_test\EntityTestFormController" + * "default" = "Drupal\entity_test\EntityTestFormController", + * "delete" = "Drupal\entity_test\EntityTestDeleteFormController" * }, * "translation" = "Drupal\content_translation\ContentTranslationHandler" * }, @@ -38,6 +39,7 @@ * }, * links = { * "canonical" = "entity_test.edit_entity_test_mulrev", + * "delete-form" = "entity_test.delete_entity_test_mulrev", * "edit-form" = "entity_test.edit_entity_test_mulrev" * } * ) only in patch2: unchanged: --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php @@ -20,7 +20,8 @@ * controllers = { * "access" = "Drupal\entity_test\EntityTestAccessController", * "form" = { - * "default" = "Drupal\entity_test\EntityTestFormController" + * "default" = "Drupal\entity_test\EntityTestFormController", + * "delete" = "Drupal\entity_test\EntityTestDeleteFormController" * }, * "translation" = "Drupal\content_translation\ContentTranslationHandler" * }, @@ -36,6 +37,7 @@ * }, * links = { * "canonical" = "entity_test.edit_entity_test_rev", + * "delete-form" = "entity_test.delete_entity_test_rev", * "edit-form" = "entity_test.edit_entity_test_rev" * } * ) only in patch2: unchanged: --- /dev/null +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestDeleteFormController.php @@ -0,0 +1,45 @@ + '', + ); + } + + /** + * {@inheritdoc} + */ + public function getQuestion() { + $entity_type = $this->entity->getEntityType(); + return t('Are you sure you want to delete the %label @entity-type?', array('%label' => $this->entity->label(), '@entity-type' => $entity_type->getLowercaseLabel())); + } + + /** + * {@inheritdoc} + */ + public function submit(array $form, array &$form_state) { + parent::submit($form, $form_state); + $entity = $this->entity; + $entity->delete(); + drupal_set_message(t('%entity_type @id has been deleted.', array('@id' => $entity->id(), '%entity_type' => $entity->getEntityTypeId()))); + $form_state['redirect_route']['route_name'] = ''; + } + +}