Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Added channel setter for tests #51

wants to merge 3 commits into from

Commits on Nov 16, 2020

  1. Added channel setter for tests

    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.
    chimit authored Nov 16, 2020
    Configuration menu
    Copy the full SHA
    354351e View commit details
    Browse the repository at this point in the history
  2. Added tests for setChannel

    chimit committed Nov 16, 2020
    Configuration menu
    Copy the full SHA
    787c307 View commit details
    Browse the repository at this point in the history
  3. Styling

    chimit committed Nov 16, 2020
    Configuration menu
    Copy the full SHA
    a454ec0 View commit details
    Browse the repository at this point in the history