Closed (fixed)
Project:
Search API
Version:
8.x-1.x-dev
Component:
Tests
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
4 Dec 2017 at 13:23 UTC
Updated:
15 Jan 2018 at 20:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
borisson_This sounds like a great idea. Should this be a kernel test?
Comment #3
drunken monkeyYes, a Kernel test sounds most reasonable here. Without a DB connection, you won't get very far (and mocking that is bordering on the absurd), but there's no reason for going full Functional.
Comment #4
drunken monkeyOK, here it is, and I actually spotted a problem through this. And not even with the new LIFO option – on the contrary, something that's only a problem with FIFO:
Open question: Should we do the same for
trackAllItemsUpdated()? Or is that expected to update all items to the same "changed" timestamp, no matter whether they were indexed before?A second set of fails I had to fix (since I went a bit berserk and aimed for a 100% coverage) was that, while all the other methods took care to not let an exception escape (since the interface doesn't allow for exceptions), the ones for returning the various counts (and
getRemainingItems()) didn't. To be consistent, I addedtry/catchblocks for those, too.(The possible exceptions are, in all cases, just database exceptions that should only occur when the database suddenly goes away. Actually, hiding these exceptions and just carrying on seems a bit dangerous, but if the database connection is lost I don't really know what else we could do. Probably, whatever event we wanted to track in such a case would fail anyways.)
Comment #5
borisson_We can replace this with the following, so we don't have to add the @todo.
It also looks like the returncallback isn't used here. At least, when I replaced that locally all tests still passed.
This is the only thing I could find.
Comment #6
drunken monkeyThanks a lot for reviewing!
The callback ensures that a test fails if an exception occurs within a method. So, it's expected that the tests would still pass without this whole block. Maybe we should just add a comment to make that clearer? Patch attached.
I also actually like that we add the
@todo, since we don't have one in the code base for that issue yet anyways.I've never used this "prophecy" thing. Seems like modern nonsense. ;P Is it really better than a normal mock, or just different syntax?
So, is this RTBC with the addition of the comment?
Comment #7
borisson_Prophecy is another mocking framework that is shipped with phpunit, I think the facets unit tests are about 50/50 phpunit/prophecy. Its clear now. Great work!
Comment #9
drunken monkeyGreat to hear, thanks a lot again for reviewing!
Committed.