samedi 12 novembre 2016

Testing Facade multiple functions

Currently I am trying to test a Facade call. I am sending slack notifications to notify me of something, however I don't want this to happen every time I run my test.

I am using the following: http://ift.tt/1n4EzHg. This enables me to do the following:

Slack::to('aChannel')->attach('someData')->send('moreData');

I'm trying to test this by doing the following:

Slack::shouldReceive('to')->once();

Now I think this is working, however the code is giving an error now since I can't do ->attach(.. Error: Call to a member function attach() on null

I think this is happening since I mock the object, it's null. I can't call the function.

Does anyone have experience with this situation and knows how I might be able to test this?

Aucun commentaire:

Enregistrer un commentaire