Skip to content

fix: strict change detection in TableTestState - #291

Merged
DenTray merged 5 commits into
masterfrom
strict-change-detection-in-TableTestState
Jun 15, 2026
Merged

fix: strict change detection in TableTestState#291
DenTray merged 5 commits into
masterfrom
strict-change-detection-in-TableTestState

Conversation

@AZabolotnikov

Copy link
Copy Markdown
Contributor

refs: #290

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the TableTestState::getChanges() method which previously used array_diff_assoc() for change detection. That function performs loose comparison after string casting, so transitions like nullfalse, null0, or null"" were not detected as changes. The fix replaces it with array_filter using strict (!==) comparison, and adds a test plus fixtures to cover the regression.

Changes:

  • Replace array_diff_assoc with strict per-key comparison in getChanges().
  • Add testAssertChangesCompareStrict to validate detection of null ↔ falsy transitions.
  • Add input/expected fixtures for the new test case.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Testing/TableTestState.php Use array_filter with !== for strict change detection.
tests/TableTestStateTest.php New test case covering strict comparison behavior.
tests/fixtures/TableTestStateTest/compare_not_strict_fields/initial_dataset.json Initial dataset with null fields.
tests/fixtures/TableTestStateTest/compare_not_strict_fields/changed_dataset.json Updated dataset with falsy non-null fields.
tests/fixtures/TableTestStateTest/db_changes/test_models/assertion_compare_strict_fields.json Expected diff output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@DenTray
DenTray merged commit 44b397b into master Jun 15, 2026
12 checks passed
@DenTray
DenTray deleted the strict-change-detection-in-TableTestState branch June 15, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants