public function it_returns_the_syntax_error_as_the_response_in_bad_commands($language, SlashCommand $command) { $command->offsetGet('text')->willReturn('foo + 2'); $errorMessage = 'Variable "foo" is not valid around position 1.'; $error = new SyntaxError('Variable "foo" is not valid', 1); $language->evaluate('foo + 2', [])->willThrow($error); $this->execute($command)['text']->shouldBe($errorMessage); }
public function it_does_not_match_unmatched_names(SlashCommand $command) { $command->get('command')->willReturn('/bar'); $this->setCommandName('/foo')->matches($command)->shouldReturn(false); }