Skip to content

Commit

Permalink
New tests
Browse files Browse the repository at this point in the history
  • Loading branch information
unreal4u committed Nov 29, 2016
1 parent 9262ba0 commit 72a35f9
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/Mock/MockData/Types/InlineKeyboardMarkup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"update_id":758442029,"callback_query":{"id":"47054498280709335","from":{"id":10955729,"first_name":"Camilo","last_name":"Sperberg","username":"unreal4u"},"message":{"message_id":57,"from":{"id":155349290,"first_name":"uptimeMonitorBot","username":"uptimeMonitorBot"},"chat":{"id":10955729,"first_name":"Camilo","last_name":"Sperberg","username":"unreal4u","type":"private"},"date":1480374178,"reply_to_message":{"message_id":56,"from":{"id":10955729,"first_name":"Camilo","last_name":"Sperberg","username":"unreal4u"},"chat":{"id":10955729,"first_name":"Camilo","last_name":"Sperberg","username":"unreal4u","type":"private"},"date":1480374178,"text":"/setup","entities":[{"type":"bot_command","offset":0,"length":6}]},"text":"Welcome! Let's get you up and running. Open up this url and create a free account\n\nHave you created the account?","entities":[{"type":"text_link","offset":39,"length":16,"url":"https://uptimerobot.com/"}]},"chat_instance":"-5438169858624920681","data":"setup-S2"}}
44 changes: 44 additions & 0 deletions tests/Telegram/Types/InlineKeyboardMarkupTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

namespace unreal4u\TelegramAPI\tests\Telegram\Types;

use PHPUnit_Framework_TestCase as TestCase;
#use PHPUnit\Framework\TestCase;
use unreal4u\TelegramAPI\Telegram\Types\CallbackQuery;
use unreal4u\TelegramAPI\Telegram\Types\Update;
use unreal4u\TelegramAPI\tests\Mock\MockTgLog;

class InlineKeyboardMarkupTest extends TestCase
{
/**
* @var MockTgLog
*/
private $tgLog;

/**
* Prepares the environment before running a test.
*/
protected function setUp()
{
parent::setUp();
$this->tgLog = new MockTgLog('TEST-TEST');
}

/**
* Cleans up the environment after running a test.
*/
protected function tearDown()
{
$this->tgLog = null;
parent::tearDown();
}

public function testIncomingUpdate()
{
$postData = $this->tgLog->getTestTypeResponse('InlineKeyboardMarkup');
$update = new Update($postData);

$this->assertInstanceOf(CallbackQuery::class, $update->callback_query);
#var_dump($update);
}
}

0 comments on commit 72a35f9

Please sign in to comment.