public function testEchoCommandExecuteWithParameter() { $text = $this->command->setUpdate(TestHelpers::getFakeUpdateCommandObject('/echo Message!'))->execute()->getResult()->getText(); $this->assertEquals('Message!', $text); }
public function testUpdateConversationNotes() { $info = TestHelpers::startFakeConversation(); $conversation = new Conversation($info['user_id'], $info['chat_id'], 'command'); $conversation->notes = 'newnote'; $conversation->update(); $conversation2 = new Conversation($info['user_id'], $info['chat_id'], 'command'); $this->assertSame('newnote', $conversation2->notes); $conversation3 = new Conversation($info['user_id'], $info['chat_id']); $this->assertSame('newnote', $conversation3->notes); }
public function testCommandSetUpdateAndMessage() { $stub = $this->command_stub; $this->assertSame($stub, $stub->setUpdate()); $this->assertEquals(null, $stub->getUpdate()); $this->assertEquals(null, $stub->getMessage()); $this->assertSame($stub, $stub->setUpdate(null)); $this->assertEquals(null, $stub->getUpdate()); $this->assertEquals(null, $stub->getMessage()); $update = TestHelpers::getFakeUpdateObject(); $message = $update->getMessage(); $stub->setUpdate($update); $this->assertAttributeEquals($update, 'update', $stub); $this->assertEquals($update, $stub->getUpdate()); $this->assertAttributeEquals($message, 'message', $stub); $this->assertEquals($message, $stub->getMessage()); }
/** * Set Up */ public function setUp() { $this->record = TestHelpers::getFakeRecordedAudio(); }
/** * setUp */ protected function setUp() { // Make sure no monolog instance is set before each test. TestHelpers::setStaticProperty('Longman\\TelegramBot\\TelegramLog', 'monolog', null); }
public function testHelpCommandExecuteWithParameterValidCommand() { $text = $this->command->setUpdate(TestHelpers::getFakeUpdateCommandObject('/help echo'))->execute()->getResult()->getText(); $this->assertContains("Description: Show text\nUsage: /echo <text>", $text); }