indiehd / velkart

An extensible shopping cart, order management, and payment processing system built upon clean-coding principles and designed for Laravel.
GNU Affero General Public License v3.0
1 stars 4 forks source link

Repository List Method Tests #11

Closed poppabear8883 closed 4 years ago

poppabear8883 commented 4 years ago

Testing BaseEloquentRepository is abstract so consider using $this->getMockForAbstractClass('AbstractClass');

Should include the following:

Should also consider a test with passing no arguments and removing them from the repository specific tests ?

cbj4074 commented 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.