You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 15, 2022. It is now read-only.
During CI, we're often running into the following failure:
CLITest::test_migrate_output_when_items_were_skipped
Expected to only see two orders in the custom table.
Failed asserting that 1 matches expected 2.
/home/travis/build/liquidweb/woocommerce-custom-orders-table/tests/test-cli.php:267
Unfortunately, we're only seeing the issue occasionally — re-running the CI job often enables the test to pass. That means this test may be behaving improperly, which needs adjusted.
The text was updated successfully, but these errors were encountered:
When a test creates multiple test orders within the same second, the resulting products cause MySQL to try to guess which order should come first rather than — as I had assumed — falling back to sorting by ID. As a result, ordering products by p.post_date alone cannot reliably keep two orders sorted the same way, since MySQL may decide to give precedence to any one of the rows with matching timestamps. Further details are [available in MySQL's "ORDER BY Optimization" documentation](https://dev.mysql.com/doc/refman/5.5/en/order-by-optimization.html).
This commit ensures that the `migrate` command explicitly falls back to sorting by `wp_posts.ID` in descending order, which matches the intent of "migrate the most recent orders (which are presumably more likely to be active) first, working backwards historically".
Additionally, this commit cleans up instances where tests were passing integers instead of arrays to `TestCase::count_orders_in_table_with_ids()`, relying on type coercion.
Fixes#83.
During CI, we're often running into the following failure:
Unfortunately, we're only seeing the issue occasionally — re-running the CI job often enables the test to pass. That means this test may be behaving improperly, which needs adjusted.
The text was updated successfully, but these errors were encountered: