Closed poppabear8883 closed 4 years ago
As it turns-out, the last condition cannot be tested reliably because the SQLite PDO driver in PHP not only ignores an invalid (non-existent) column reference in ORDER BY ...
, (i.e., an exception is not thrown), but it actually returns all existing rows!
In other words, this returns all records in the table, even when the products.foo
column does not exist:
SELECT * from products ORDER BY foo;
There seems to be no valid explanation for this behavior beyond it being a glaring bug.
Testing
BaseEloquentRepository
is abstract so consider using$this->getMockForAbstractClass('AbstractClass');
Should include the following:
ascending
orderdesc
orderfail
when a random string is passed as the sort argumentIt shouldfail
when a random string is passed to the orderBy argumentShould also consider a test with passing no arguments and removing them from the repository specific tests ?