Problem/Motivation

ProductVariationTest::testTimestamps in the commerce submodule only contains two assertions on the time fields for product variation 1. Tests on the product variation migration entity should be done all together after a migration not split into two tests.

Ideally, the assertions on the time value should be in the assertProductVariationEntity in the test trait. But the time stamps can be changed by other migrations, #2754787: d6_term_node migration overwrites node changed timestamps. So, let's not go for a complete solution that works for every source.

Proposed resolution

Move the time stamp assertions to method testProductVariation.

Remaining tasks

Doit

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Comments

quietone created an issue. See original summary.

pbrown063’s picture

StatusFileSize
new1.24 KB

If I am understanding you correctly and not overthinking this should meet your aims.

Regarding your saying that:

Tests on the product variation migration entity should be done all together after a migration not split into two tests.

Should product titles follow the same rule? I have a specific example available if this is the place for that discussion.

quietone’s picture

Issue summary: View changes
Status: Active » Needs work

@pbrown063, thanks for the patch! But I think you weren't working from HEAD, which is on d.o The change is to the tests in the submodule, commerce. That could probably be clearer in the IS, which I have updated.

Should product titles follow the same rule?

Yes, post a migration we should check as many aspects of an entity in one test. What is your example?

quietone’s picture

Status: Needs work » Needs review
Issue tags: -Novice
StatusFileSize
new12.74 KB

Moved the timestamps tests to assertProductVariationEntity. That required changes to both the ubercart and commerce versions of ProductVariationTest.php, particularly the ubercart version. That was doing both the product variation migration followed by the product migration. The latter mmigration saves the product and modifies the changed timestamp to the current time, making the test fail. But this test is testing the product variation migration and should only be executing dependent migrations. So, changed that so it just executes the product_variation_type and then product_variation. But with those changes, the title and the product_id are no longer migrated. The title is a field and can be migrated when a deriver is used. Need to think about the product id.

Because the product migration modifies the changed time, NULL is used to avoid the assertion in the test.

Status: Needs review » Needs work

The last submitted patch, 4: 2904289-4.patch, failed testing. View results

quietone’s picture

Status: Needs work » Needs review
StatusFileSize
new13.04 KB

Oops, had a test version of the test file in the patch.

quietone’s picture

And the product id is NULL until filled in by the product migration. So this is good to go and the existing product variation migrations will behave and be tested the same.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

  • heddn committed ea5a775 on 8.x-2.x authored by quietone
    Issue #2904289 by quietone, pbrown063, heddn: Move timestamp test to...
heddn’s picture

Status: Reviewed & tested by the community » Fixed

  • heddn committed 061694b on 8.x-2.x
    Revert "Issue #2904289 by quietone, pbrown063, heddn: Move timestamp...
heddn’s picture

Status: Fixed » Needs work

This caused HEAD to fail. It might just be we need a re-roll. https://www.drupal.org/pift-ci-job/795001

heddn’s picture

Status: Needs work » Needs review
StatusFileSize
new13.45 KB

Here's a re-roll.

Status: Needs review » Needs work

The last submitted patch, 13: 2904289-13.patch, failed testing. View results

heddn’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new13.56 KB

Let's get this re-roll right, ok?

  • heddn committed 092118f on 8.x-2.x
    Issue #2904289 by quietone, heddn, pbrown063: Move timestamp test to...
heddn’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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