Follow-up to #2642612: Create Entity Lookup & Generate process Base plugins

We need tests for the entity_lookup and entity_generate plugins.

Comments

mikeryan created an issue. See original summary.

heddn’s picture

Status: Active » Needs review
StatusFileSize
new6.83 KB

I created the beast, it is only fitting I provide even the most basic of tests.

heddn’s picture

I've added #2826636: Add non basic tests for entity lookup/generate plugins so we can start adding some more complex tests. Let's get a simple test case in first and start adding to that base.

mikeryan’s picture

Status: Needs review » Needs work
Issue tags: -Needs tests
  1. +++ b/tests/modules/migrate_plus_migration_test/migrate_plus_migration_test.info.yml
    @@ -0,0 +1,9 @@
    + - entity_reference_revisions
    

    Copypasta from an ERR test?

  2. +++ b/tests/modules/migrate_plus_migration_test/migration_templates/migrate_plus_migration_test.yml
    @@ -0,0 +1,17 @@
    +  plugin: migrate_plus_dummy
    

    We could use embedded_data and avoid creating a custom source plugin. For that matter, we could create the migration definition as an array within the test and avoid having a test module at all.

  3. +++ b/tests/src/Kernel/Plugin/migrate/process/EntityGenerateTest.php
    @@ -0,0 +1,151 @@
    + * Tests the migration plugin.
    

    s/migration/entity_generate/

+++ b/tests/src/Kernel/Plugin/migrate/process/EntityGenerateTest.php
@@ -0,0 +1,151 @@
+ * @group entity_reference_revisions

More ERR copypasta, I assume.

heddn’s picture

StatusFileSize
new5.34 KB
new6.83 KB
heddn’s picture

Status: Needs work » Needs review
james.williams’s picture

This is working for me, what's left to do here? The follow-up #2826636: Add non basic tests for entity lookup/generate plugins can cover edge cases (such as #2787219: Entity lookup plugin not able to guess config for entity types without bundle perhaps), so maybe the latest patch here can be committed?

heddn’s picture

@james.williams all we are looking for is RTBC. As a first step.

james.williams’s picture

Status: Needs review » Reviewed & tested by the community

Ah ok! I thought there might have been some further work required. As for the tests, they look like a good first step to me, just to show it the basic functionality works. I could well have missed something, but I'd be confident enough to say RTBC.

james.williams’s picture

Status: Reviewed & tested by the community » Needs work

Oh actually ... gosh how many times do you think of something just after pressing submit ... this test covers creating new entities, but not updating existing ones.

We currently test entity_generate for two rows, let's make one match an existing entity to show that gets updated (e.g. rather than created as a duplicate).

And then can we add another field to use entity_lookup on similarly - to match one existing term to get updated, and another that won't match that will therefore get passed over?

heddn’s picture

Status: Needs work » Needs review
StatusFileSize
new8.12 KB
new9.29 KB

I think this addresses the comments in #10.

Status: Needs review » Needs work

The last submitted patch, 11: 2760443-11.patch, failed testing.

heddn’s picture

Version: 8.x-2.x-dev » 8.x-3.x-dev
heddn’s picture

Status: Needs work » Needs review

Wrong branch selected. Tests now pass.

heddn’s picture

Issue tags: +Baltimore2017

  • mikeryan committed 586c617 on 8.x-3.x authored by heddn
    Issue #2760443 by heddn: Tests for entity lookup/generate plugins
    
mikeryan’s picture

Status: Needs review » Fixed

Committed, thanks!

  • mikeryan committed 586c617 on 8.x-4.x authored by heddn
    Issue #2760443 by heddn: Tests for entity lookup/generate plugins
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.