Added channel setter for tests#51
Open
chimit wants to merge 3 commits intobotman:masterfrom
chimit:patch-1
Open
Added channel setter for tests#51chimit wants to merge 3 commits intobotman:masterfrom chimit:patch-1
chimit wants to merge 3 commits intobotman:masterfrom
chimit:patch-1
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. |
Author
|
@crynobone @mpociot any chances to get this merged? |
Author
|
@christophrumpel can this tiny fix be merged? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, there is only one way to set recipient (channel) in tests by instantiating the
IncomingMessageclass:This PR adds an ability to make it easier through a
setChannelsetter:It's really useful in conversations. Otherwise, you should instantiate
IncomingMessagefor every message in a conversation.Partially solves this issue botman/botman#1218