assertCanSeeTableRecords() functions correctly?

Should this pass: "assertCanSeeTableRecords($records)" while $records->count() is zero? It does! Should this pass? "assertCanNotSeeTableRecords($records)"? It does too. Bug?
4 Replies
Dennis Koch
Dennis Koch2mo ago
Technically both are correct. Assert you don’t see anything and assert you see nothing
arichard123
arichard123OP2mo ago
I don't know. I don't think the language makes it obvious. I think the word "Records" implies there should be at least one record and that failure to pass a record means you've got invalid input to the function, and so it should fail. I also don't like logically that it can pass these opposite pointing functions. These functions feel more like <0 and >0 rather than >=0 and <=0. It did actually catch me out.
Dennis Koch
Dennis Koch2mo ago
Those functions require an argument, so it's "can see those records." I'd agree if they didn't need an argument. Also if those were called assertHasRecords and assertDoesNotHaveRecord
arichard123
arichard123OP2mo ago
Thanks for your engagement on this. I appreciate your perspective.

Did you find this page helpful?