drupalextension icon indicating copy to clipboard operation
drupalextension copied to clipboard

Create EntityContext

Open jonathanjfshaw opened this issue 8 years ago • 10 comments

Basic features work locally, let's see what Travis says about the before/after hooks.

jonathanjfshaw avatar Aug 07 '16 14:08 jonathanjfshaw

Fixes #194.

jonathanjfshaw avatar Aug 07 '16 14:08 jonathanjfshaw

Relies on parallel PR https://github.com/jhedstrom/DrupalDriver/pull/101

jonathanjfshaw avatar Aug 07 '16 14:08 jonathanjfshaw

Heh, I think it's only failing because Drupal.org changed their layout and some of the tests are checking regions. The new design launched in September but those tests are likely from before then. Core drupalextension is failing too. https://travis-ci.org/jhedstrom/drupalextension

Looks good though, I tested this PR against https://github.com/jhedstrom/DrupalDriver/pull/113/ and was able to add entities, view them, and have them cleaned up in D7.

djdevin avatar Oct 13 '16 21:10 djdevin

Great, very good to know. #310 is the issue to fix the tests for drupalextension to resolve the drupal.org issue.

jonathanjfshaw avatar Oct 13 '16 21:10 jonathanjfshaw

We need to add make sure the tests this PR adds are tagged for D7 and pass with your PR.

@djdevin Could you try the new tests from this PR make a PR to my repo (source of this PR) with any needed changes?

features/entity.feature is the file; I suggest you add the @d7 tag to any test that should pass in D7. You may want to add/modify some tests if some of the current ones are fundamentally incompatible with D7.

Some of the tests use a comment type defined in fixtures/drupal8/modules/behat_test/config/install/comment.type.user_comments.yml. That will obviously fail unless an equivalent D7 fixture is created.

jonathanjfshaw avatar Oct 19 '16 11:10 jonathanjfshaw

I thought these should pass now the blackbox tests have been fixed, but there is a failing test.

The FeatureContext function tagged @beforeEntityCreate hook is not firing - the whole function is not being invoked - and so the scenario I created to test it fails. I can't figure out the cause; it needs someone with either a better understanding of the Behat hook system or a better debugging setup than I have.

I couldn't copy the Node/User/Term hooks exactly because they extend an already existing EntityScope, so I had to name mine OtherEntityScope; perhaps somewhere here lies the root of the problem. In particular, I don't know if it matters what constants are used:

abstract class OtherEntityScope extends BaseEntityScope {

  const BEFORE = 'otherentity.create.before';
  const AFTER = 'otherentity.create.after';

}

Perhaps @jhedstrom or @pfrenssen can give a pointer.

jonathanjfshaw avatar Jan 02 '17 16:01 jonathanjfshaw

I'm currently treating this as postponed on #337 .

jonathanjfshaw avatar Jan 19 '17 12:01 jonathanjfshaw

Rebased

jonathanjfshaw avatar Feb 11 '18 21:02 jonathanjfshaw

This would seem like a critical improvement - we can't yet create Media entities in Drupal 8 with the Extension. Anything we are waiting on here?

brooke-heaton avatar Jan 20 '22 02:01 brooke-heaton

Agree with @brooke-heaton .

We have used this patch extensively on several D8/D9 projects. With the update to D10 and the module update to v5.0.0rc1, the patch no longer applies, impacting many of our behat tests. Is there a chance the patch will be integrated, or should we bring it in as custom code?

Edit: sorry, didn't catch this issue before, following there (and thanks for the effort!).

noemi-mancini avatar Nov 22 '23 08:11 noemi-mancini