Skip to content

Commit b81a943

Browse files
Extend assertSameJsonObject to V2WorkflowTest JSON column assertions
Apply the same treatment as 414843a to the remaining assertSame calls in V2WorkflowTest that compare array literals to MySQL JSON columns: - signal-repair task payload (two locations) - visibility_labels and memo on WorkflowInstance, WorkflowRun, WorkflowRunSummary, WorkflowHistoryEvent payload, RunDetailView output, HistoryExport output These tests pass under SQLite (TEXT storage preserves PHP encoding order) but MySQL's binary JSON storage normalizes object key order by length then alphabetically, so the order-sensitive assertSame fails even though the key-value set is identical. Refs #399 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 414843a commit b81a943

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

tests/Feature/V2/V2WorkflowTest.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,11 +2403,11 @@ public function testStartOptionsPersistVisibilityFieldsOnRunSummaryAndStartHisto
24032403
$this->assertTrue($result->accepted());
24042404
$this->assertIsString($runId);
24052405
$this->assertSame('order-123', $workflow->businessKey());
2406-
$this->assertSame([
2406+
$this->assertSameJsonObject([
24072407
'region' => 'us-east',
24082408
'tenant' => 'acme',
24092409
], $workflow->visibilityLabels());
2410-
$this->assertSame([
2410+
$this->assertSameJsonObject([
24112411
'customer' => [
24122412
'name' => 'Taylor',
24132413
'vip' => true,
@@ -2428,40 +2428,40 @@ public function testStartOptionsPersistVisibilityFieldsOnRunSummaryAndStartHisto
24282428
->firstOrFail();
24292429

24302430
$this->assertSame('order-123', $instance->business_key);
2431-
$this->assertSame([
2431+
$this->assertSameJsonObject([
24322432
'region' => 'us-east',
24332433
'tenant' => 'acme',
24342434
], $instance->visibility_labels);
2435-
$this->assertSame([
2435+
$this->assertSameJsonObject([
24362436
'customer' => [
24372437
'name' => 'Taylor',
24382438
'vip' => true,
24392439
],
24402440
'line_items' => [123, 456],
24412441
], $instance->memo);
24422442
$this->assertSame('order-123', $run->business_key);
2443-
$this->assertSame([
2443+
$this->assertSameJsonObject([
24442444
'region' => 'us-east',
24452445
'tenant' => 'acme',
24462446
], $run->visibility_labels);
2447-
$this->assertSame([
2447+
$this->assertSameJsonObject([
24482448
'customer' => [
24492449
'name' => 'Taylor',
24502450
'vip' => true,
24512451
],
24522452
'line_items' => [123, 456],
24532453
], $run->memo);
24542454
$this->assertSame('order-123', $summary->business_key);
2455-
$this->assertSame([
2455+
$this->assertSameJsonObject([
24562456
'region' => 'us-east',
24572457
'tenant' => 'acme',
24582458
], $summary->visibility_labels);
24592459
$this->assertSame('order-123', $started->payload['business_key'] ?? null);
2460-
$this->assertSame([
2460+
$this->assertSameJsonObject([
24612461
'region' => 'us-east',
24622462
'tenant' => 'acme',
24632463
], $started->payload['visibility_labels'] ?? null);
2464-
$this->assertSame([
2464+
$this->assertSameJsonObject([
24652465
'customer' => [
24662466
'name' => 'Taylor',
24672467
'vip' => true,
@@ -2473,31 +2473,31 @@ public function testStartOptionsPersistVisibilityFieldsOnRunSummaryAndStartHisto
24732473
$export = $workflow->historyExport();
24742474

24752475
$this->assertSame('order-123', $detail['business_key']);
2476-
$this->assertSame([
2476+
$this->assertSameJsonObject([
24772477
'region' => 'us-east',
24782478
'tenant' => 'acme',
24792479
], $detail['visibility_labels']);
2480-
$this->assertSame([
2480+
$this->assertSameJsonObject([
24812481
'customer' => [
24822482
'name' => 'Taylor',
24832483
'vip' => true,
24842484
],
24852485
'line_items' => [123, 456],
24862486
], $detail['memo']);
24872487
$this->assertSame('order-123', $export['workflow']['business_key']);
2488-
$this->assertSame([
2488+
$this->assertSameJsonObject([
24892489
'region' => 'us-east',
24902490
'tenant' => 'acme',
24912491
], $export['workflow']['visibility_labels']);
2492-
$this->assertSame([
2492+
$this->assertSameJsonObject([
24932493
'customer' => [
24942494
'name' => 'Taylor',
24952495
'vip' => true,
24962496
],
24972497
'line_items' => [123, 456],
24982498
], $export['workflow']['memo']);
24992499
$this->assertSame('order-123', $export['summary']['business_key']);
2500-
$this->assertSame([
2500+
$this->assertSameJsonObject([
25012501
'region' => 'us-east',
25022502
'tenant' => 'acme',
25032503
], $export['summary']['visibility_labels']);
@@ -5597,7 +5597,7 @@ public function testRepairRecreatesMissingWorkflowTaskAfterSignalIsReceived(): v
55975597
->where('status', TaskStatus::Ready->value)
55985598
->sole();
55995599

5600-
$this->assertSame([
5600+
$this->assertSameJsonObject([
56015601
'workflow_wait_kind' => 'signal',
56025602
'open_wait_id' => 'signal-application:' . $signalRecord->id,
56035603
'resume_source_kind' => 'workflow_signal',
@@ -5688,7 +5688,7 @@ public function testTaskWatchdogRecreatesMissingWorkflowTaskAfterSignalIsReceive
56885688
->where('status', TaskStatus::Ready->value)
56895689
->sole();
56905690

5691-
$this->assertSame([
5691+
$this->assertSameJsonObject([
56925692
'workflow_wait_kind' => 'signal',
56935693
'open_wait_id' => 'signal-application:' . $signalRecord->id,
56945694
'resume_source_kind' => 'workflow_signal',

0 commit comments

Comments
 (0)