MaximusN
MaximusN

Reputation: 29

Laravel - spatie permissions delete permission issue inside phpunit

I am having some trouble with spatie/laravel permissions package.

The issue is with one of my tests failing for deleting a permission directly through testing. The same approach using postman works as expected.

The error i am getting is:

SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value: 'a259dc99655f' (SQL: delete from `user_permissions` where `model_id` = 49 and `model_type` = Spatie\Permission\Models\Permission)

Is this a known issue or am i missing something.

Upvotes: 0

Views: 1002

Answers (1)

MaximusN
MaximusN

Reputation: 29

I found the issue. It is a lumen issue with the latest version i think.

It was to do with db strict mode.

I added this <env name="DB_STRICT_MODE" value="false" force="true" /> to the phpunit test config.

I found it from this post https://laracasts.com/discuss/channels/general-discussion/disable-strict-mode-mysql-in-latest-lumen

Upvotes: 1

Related Questions