botman / botman/studio-addons

ask() method with a string argument can't be tested with assertQuestion

Open
#52 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
76
Forks
60
PR merge metrics
No merged PRs in 30d

Description

If you ask a question by providing a simple string as a question the `assertQuestion` fails, but `assertReply` passes. So it looks like the `ask()` method produces replies (`BotMan\BotMan\Messages\Outgoing\OutgoingMessage`) instead of questions (`BotMan\BotMan\Messages\Outgoing\Question`) if you pass strings to it.

```php
// Conversation 1
$this->ask('How are you?', function (Answer $answer) {
// ...
});
```

```php
// Test
$this->bot->assertQuestion('How are you?'); // fails
$this->bot->assertReply('How are you?'); // passes
```

```php
// Conversation 2
$this->ask(Question::create('How are you?'), function (Answer $answer) {
// ...
});
```

```php
// Test
$this->bot->assertQuestion('How are you?'); // passes
$this->bot->assertReply('How are you?'); // fails
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.