inertia-laravel
inertia-laravel copied to clipboard
Inertia + PHPUnit + GitHub actions = Failing assert that '1' is identical to 1
Hey everyone!
This is the link to my question on stackoverflow, no answers for now.
I'm trying to make "continues integration" pipeline and run tests on github actions server after push to master. Major part of tests work fine, but there are some curious things.
This is my test, which works fine on my local machine:
// some code before assetion
$this->actingAs($user)
->get(route('profile.index'))
->assertStatus(200)
->assertInertia(fn(AssertableInertia $page) => $page
->component('User::Profile', false)
// other assertions
->has('discounts')
->count('discounts', $user->discounts()->whereDiscountableType('pump_series')->count())
->has('discounts.0', fn(AssertableInertia $page) => $page
->has('key')
->has('discountable_id')
->has('discountable_type')
->where('user_id', $user->id) // <---- here I get the exception
->has('name')
->has('value')
// other assertions
)
);
And I get the exception when this test runs on Github-actions server:

As I understand, value is correct, but somehow (idk why) expected value is '1' (string) and given is 1 (int). Obviously it must be int. And there are some more places like this where I get such errors.
I I can assume that this is due to about operation system but I'm not really sure and I don't know what to do with this information. I use mac, github-actions "uses" ubuntu (obviously).
I tried to do: ->where('user_id', (string)$user->id) and test fails on my local machine. So there is no any background conversions.
Any ideas? Thanks