Just updated to Laravel 11.28. After running some tests in my application I noticed that this PR introduces an issue where empty arrays `[]` are treated as `null` when running the following assertion in PEST. It seems like the `enum_value` function is internally calling a `transform` function which then converts the `[]` value to `null`.
use Illuminate\Testing\Fluent\AssertableJson;
->assertJson(fn (AssertableJson $json) => $json->whereType('id', 'string')
->where('object', 'menu')
->where('name', 'Primary')
->where('handle', 'primary')
->has('items', 2)
->has('items.0', fn (AssertableJson $json) => $json->whereType('id', 'string')
->where('object', 'menu_item')
->where('label', 'Home')
->where('url', '/')
->where('active', true)
->where('opens_new_tab', false)
->where('items', []) // Issue occurs here
->where('order', 0)
->etc()
)
->has('items.1.items.0', fn (AssertableJson $json) => $json->whereType('id', 'string')
->where('object', 'menu_item')
->where('label', 'Payments')
->where('url', '/payments')
->where('active', true)
->where('opens_new_tab', false)
->where('items', []) // Issue occurs here
->where('order', 0)
->etc()
)
->etc()
);
Property [items.0.items] does not match the expected value.
Failed asserting that Array &0 [] is identical to null.