A little background: I am building an App on Laravel 5.6.33 (PHP 7.2 with sqlite 3).
So i have this weird case where in a test I am expecting an Exception but it never gets thrown. So I went digging and found that Laravel does not throw exceptions for invalid/non existent columns in where clause if the database driver is sqlite. The following code just returns an empty collection instead of throwing an exception.
\App\Tag::where('notAColumn', 'foo')->get();
Its weird and I checked all over the place to see if it was something wrong with my config and found nothing out of place. Debug is set to true etc. Im running this code for testing the app using an in memory sqlite database.
One other thing I noticed was that if I use whereRaw
instead of where
, exceptions are thrown as expected. so for example the following throws an exception.
\App\Tag::whereRaw('notAColumn = "foo"')->get();
Does anyone know why this maybe?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire