Clean up Entity tests.

parent b1cc1f06
......@@ -90,7 +90,7 @@ class InlineKeyboardTest extends TestCase
{
$keyboard = (new InlineKeyboard([
$this->getRandomButton('Button Text 1'),
$this->getRandomButton('Button Text 2')
$this->getRandomButton('Button Text 2'),
]))->getProperty('inline_keyboard');
self::assertSame('Button Text 1', $keyboard[0][0]->getText());
self::assertSame('Button Text 2', $keyboard[0][1]->getText());
......@@ -101,11 +101,11 @@ class InlineKeyboardTest extends TestCase
$keyboard = (new InlineKeyboard(
[
$this->getRandomButton('Button Text 1'),
$this->getRandomButton('Button Text 2')
$this->getRandomButton('Button Text 2'),
],
[
$this->getRandomButton('Button Text 3'),
$this->getRandomButton('Button Text 4')
$this->getRandomButton('Button Text 4'),
]
))->getProperty('inline_keyboard');
......
......@@ -12,7 +12,6 @@ namespace Longman\TelegramBot\Tests\Unit;
use Longman\TelegramBot\Entities\Keyboard;
use Longman\TelegramBot\Entities\KeyboardButton;
use Longman\TelegramBot\Exception\TelegramException;
/**
* @package TelegramTest
......
......@@ -10,7 +10,7 @@
namespace Longman\TelegramBot\Tests\Unit;
use \Longman\TelegramBot\Entities\Update;
use Longman\TelegramBot\Entities\Update;
/**
* @package TelegramTest
......@@ -21,29 +21,16 @@ use \Longman\TelegramBot\Entities\Update;
*/
class ReplyToMessageTest extends TestCase
{
/**
* @var \Longman\TelegramBot\Entities\Message
*/
private $reply_to_message;
/**
* @var \Longman\TelegramBot\Entities\Message
*/
private $message;
public function testChatType()
{
$json = '
{"update_id":137809335,
"message":{"message_id":4479,"from":{"id":123,"first_name":"John","username":"MJohn"},"chat":{"id":-123,"title":"MyChat","type":"group"},"date":1449092987,"reply_to_message":{"message_id":11,"from":{"id":121,"first_name":"Myname","username":"mybot"},"chat":{"id":-123,"title":"MyChat","type":"group"},"date":1449092984,"text":"type some text"},"text":"some text"}}
';
$struct = json_decode($json, true);
$update = new Update($struct, 'mybot');
$this->message = $update->getMessage();
$this->reply_to_message = $this->message->getReplyToMessage();
$this->assertNull($this->reply_to_message->getReplyToMessage());
$update = new Update(json_decode($json, true), 'mybot');
$reply_to_message = $update->getMessage()->getReplyToMessage();
self::assertNull($reply_to_message->getReplyToMessage());
}
}
This diff is collapsed.
......@@ -10,7 +10,7 @@
namespace Longman\TelegramBot\Tests\Unit;
use \Longman\TelegramBot\Entities\Update;
use Longman\TelegramBot\Entities\Update;
/**
* @package TelegramTest
......@@ -23,7 +23,7 @@ class UpdateTest extends TestCase
{
public function testUpdateCast()
{
$json = '
$json = '
{"update_id":137809336,
"message":{"message_id":4479,"from":{"id":123,"first_name":"John","username":"MJohn"},"chat":{"id":-123,"title":"MyChat","type":"group"},"date":1449092987,"reply_to_message":{"message_id":11,"from":{"id":121,"first_name":"Myname","username":"mybot"},"chat":{"id":-123,"title":"MyChat","type":"group"},"date":1449092984,"text":"type some text"},"text":"some text"}}
';
......@@ -31,6 +31,6 @@ class UpdateTest extends TestCase
$update = new Update($struct, 'mybot');
$array_string_after = json_decode($update->toJson(), true);
$this->assertEquals($struct, $array_string_after);
self::assertEquals($struct, $array_string_after);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment