From c0aafe958e7b42be247005c5f27b8a29767d872c Mon Sep 17 00:00:00 2001 From: Jonathan Shaw Date: Mon, 2 Jan 2017 14:36:43 +0000 Subject: [PATCH] Fix some test fails, add hook calls --- features/bootstrap/FeatureContext.php | 2 +- features/entity.feature | 15 +++++------ .../Hook/Call/AfterEntityCreate.php | 25 ++++++++++++++++++ .../Hook/Call/BeforeEntityCreate.php | 26 +++++++++++++++++++ 4 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 src/Drupal/DrupalExtension/Hook/Call/AfterEntityCreate.php create mode 100644 src/Drupal/DrupalExtension/Hook/Call/BeforeEntityCreate.php diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php index e00119e4..73bb7158 100644 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -68,7 +68,7 @@ public static function alterUserParameters(EntityScope $scope) { } /** - * Hook into user creation to test `@beforeUserCreate` + * Hook into user creation to test `@beforeEntityCreate` * * @beforeEntityCreate */ diff --git a/features/entity.feature b/features/entity.feature index 7d5f7750..ae55b2a1 100644 --- a/features/entity.feature +++ b/features/entity.feature @@ -16,14 +16,12 @@ Feature: EntityContext | fredbloggs | fredbloggs@example.com | When I am at "admin/people" Then I should see "johndoe" - When I click "johndoe" - And I click "Edit" + When I click "Edit" in the "johndoe" row Then the "mail" field should contain "johndoe@example.com" When I am at "admin/people" Then I should see "fredbloggs" - When I click "fredbloggs" - And I click "Edit" - Then the "mail" field should contain "fredbloggs@example.com" + When I click "Edit" in the "fredbloggs" row + Then the "mail" field should contain "fredbloggs@example.com" Scenario: Test entities have been cleaned up after previous scenario When I am at "admin/people" @@ -36,8 +34,7 @@ Feature: EntityContext | johndoe | johndoe@example.com | When I am at "admin/people" Then I should see "johndoe" - When I click "johndoe" - And I click "Edit" + When I click "Edit" in the "johndoe" row Then the "mail" field should contain "johndoe@example.com" Scenario: Test single bundled entity in "Given a :bundle :entity_type entity" @@ -122,7 +119,9 @@ Feature: EntityContext | name | johndoe | | mail | johndoe@example.com | Then I should see "johndoe" in the ".page-title" element - When I click "Edit" + When I am at "admin/people" + Then I should see "johndoe" + When I click "Edit" in the "johndoe" row Then the "mail" field should contain "johndoe@example.com" Scenario: Test bundled entity in "Given I am viewing a :bundle :entity_type entity:" diff --git a/src/Drupal/DrupalExtension/Hook/Call/AfterEntityCreate.php b/src/Drupal/DrupalExtension/Hook/Call/AfterEntityCreate.php new file mode 100644 index 00000000..61f1af49 --- /dev/null +++ b/src/Drupal/DrupalExtension/Hook/Call/AfterEntityCreate.php @@ -0,0 +1,25 @@ +