-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added channel setter for tests #51
base: master
Are you sure you want to change the base?
Conversation
Currently, there is only one way to set recipient (channel) in tests by instantiating the `IncomingMessage` class: ```php $incoming1 = new IncomingMessage('hi', $sender, $recipient, ['foo' => 'bar']); $incoming2 = new IncomingMessage('good', $sender, $recipient, ['foo' => 'bar']); $this->bot ->setUser($sender) ->receivesRaw($incoming1) ->assertQuestion('How are you?') ->receivesRaw($incoming2); ``` This PR adds an ability to make it easier through a setter: ```php $this->bot ->setUser($sender) ->setChannel($channel) ->receives('hi', ['foo' => 'bar']) ->assertQuestion('How are you?') ->receives('good', ['foo' => 'bar']); ``` It's really useful in conversations. Otherwise, you should instantiate `IncomingMessage` for every message in a conversation.
Codecov ReportBase: 43.35% // Head: 43.88% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #51 +/- ##
============================================
+ Coverage 43.35% 43.88% +0.53%
- Complexity 75 76 +1
============================================
Files 11 11
Lines 316 319 +3
============================================
+ Hits 137 140 +3
Misses 179 179
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@crynobone @mpociot any chances to get this merged? |
@christophrumpel can this tiny fix be merged? |
Currently, there is only one way to set recipient (channel) in tests by instantiating the
IncomingMessage
class:This PR adds an ability to make it easier through a
setChannel
setter:It's really useful in conversations. Otherwise, you should instantiate
IncomingMessage
for every message in a conversation.Partially solves this issue botman/botman#1218