imap icon indicating copy to clipboard operation
imap copied to clipboard

Testing with ddeboer/imap

Open nedvice-sv opened this issue 1 year ago • 1 comments

I want to create a test where I mock the messages and what it should return since I'm running these tests in a pipeline and not with a real database.

I can't find an example of where to and how to test with the library. Every single class is final (Which is considered a bad practise as far as I know...)

The case I'm trying to create is: Test the Laravel command. The command is fetching the messages from the server. Test if the messages are being returned. Test if we can create the messages in the database. Test any other action that is used from the messages.

To actually test something I need to first parse the Messages, put the information in my own 'model' and test with that.. (it should be a more safer option but still was I wondering if there was another solution...)

Hopfully someone can help/give me some feedback on how to approach this.

Kind regards,

nedvice-sv avatar Nov 09 '24 17:11 nedvice-sv

I wrote a test to demonstrate every bit of this library is mockable, have a look there: https://github.com/ddeboer/imap/blob/1.21.0/tests/MockabilityTest.php

Slamdunk avatar Nov 11 '24 07:11 Slamdunk