本文整理汇总了PHP中Longman\TelegramBot\Request::generateGeneralFakeServerResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::generateGeneralFakeServerResponse方法的具体用法?PHP Request::generateGeneralFakeServerResponse怎么用?PHP Request::generateGeneralFakeServerResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Longman\TelegramBot\Request
的用法示例。
在下文中一共展示了Request::generateGeneralFakeServerResponse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetGeneralTestFakeResponse
/**
* @test
*/
public function testSetGeneralTestFakeResponse()
{
//setWebhook ok
$fake_response = Request::generateGeneralFakeServerResponse();
$this->server = new ServerResponse($fake_response, 'testbot');
$this->assertTrue($this->server->isOk());
$this->assertTrue($this->server->getResult());
$this->assertNull($this->server->getErrorCode());
$this->assertEquals('', $this->server->getDescription());
//sendMessage ok
$fake_response = Request::generateGeneralFakeServerResponse(['chat_id' => 123456789, 'text' => 'hello']);
$this->server = new ServerResponse($fake_response, 'testbot');
$this->assertTrue($this->server->isOk());
$this->assertInstanceOf('\\Longman\\TelegramBot\\Entities\\Message', $this->server->getResult());
$this->assertNull($this->server->getErrorCode());
$this->assertNull($this->server->getDescription());
//Message
$this->assertEquals('1234', $this->server->getResult()->getMessageId());
$this->assertEquals('1441378360', $this->server->getResult()->getDate());
$this->assertEquals('hello', $this->server->getResult()->getText());
//Message //User
$this->assertEquals('123456789', $this->server->getResult()->getFrom()->getId());
$this->assertEquals('botname', $this->server->getResult()->getFrom()->getFirstName());
$this->assertEquals('namebot', $this->server->getResult()->getFrom()->getUserName());
//Message //Chat
$this->assertEquals('123456789', $this->server->getResult()->getChat()->getId());
$this->assertEquals('', $this->server->getResult()->getChat()->getFirstName());
$this->assertEquals('', $this->server->getResult()->getChat()->getUserName());
//... they are not finished...
}