Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F630556
KeyboardButtonTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
KeyboardButtonTest.php
View Options
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Longman
\
TelegramBot
\
Tests
\
Unit
\
Entities
;
use
Longman
\
TelegramBot
\
Entities
\
KeyboardButton
;
use
Longman
\
TelegramBot
\
Entities
\
KeyboardButtonPollType
;
use
Longman
\
TelegramBot
\
Entities
\
KeyboardButtonRequestChat
;
use
Longman
\
TelegramBot
\
Entities
\
KeyboardButtonRequestUsers
;
use
Longman
\
TelegramBot
\
Entities
\
WebAppInfo
;
use
Longman
\
TelegramBot
\
Exception
\
TelegramException
;
use
Longman
\
TelegramBot
\
Tests
\
Unit
\
TestCase
;
/**
* @link https://github.com/php-telegram-bot/core
* @author Avtandil Kikabidze <akalongman@gmail.com>
* @copyright Avtandil Kikabidze <akalongman@gmail.com>
* @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
* @package TelegramTest
*/
class
KeyboardButtonTest
extends
TestCase
{
public
function
testKeyboardButtonSuccess
(
)
:
void
{
new
KeyboardButton
(
[
'text'
=>
'message'
]
)
;
new
KeyboardButton
(
[
'text'
=>
'message'
,
'request_users'
=>
new
KeyboardButtonRequestUsers
(
[
]
)
]
)
;
new
KeyboardButton
(
[
'text'
=>
'message'
,
'request_chat'
=>
new
KeyboardButtonRequestChat
(
[
]
)
]
)
;
new
KeyboardButton
(
[
'text'
=>
'message'
,
'request_contact'
=>
true
]
)
;
new
KeyboardButton
(
[
'text'
=>
'message'
,
'request_location'
=>
true
]
)
;
new
KeyboardButton
(
[
'text'
=>
'message'
,
'request_poll'
=>
new
KeyboardButtonPollType
(
[
]
)
]
)
;
new
KeyboardButton
(
[
'text'
=>
'message'
,
'web_app'
=>
new
WebAppInfo
(
[
]
)
]
)
;
self
::
assertTrue
(
true
)
;
}
public
function
testInlineKeyboardButtonCouldBe
(
)
:
void
{
self
::
assertTrue
(
KeyboardButton
::
couldBe
(
[
'text'
=>
'message'
]
)
)
;
self
::
assertFalse
(
KeyboardButton
::
couldBe
(
[
'no_text'
=>
'message'
]
)
)
;
}
public
function
testReturnsSubentitiesOnArray
(
)
{
$button
=
new
KeyboardButton
(
'message'
)
;
$button
->
request_users
=
[
]
;
$this
->
assertInstanceOf
(
KeyboardButtonRequestUsers
::
class
,
$button
->
getRequestUsers
(
)
)
;
$button
=
new
KeyboardButton
(
'message'
)
;
$button
->
request_chat
=
[
]
;
$this
->
assertInstanceOf
(
KeyboardButtonRequestChat
::
class
,
$button
->
getRequestChat
(
)
)
;
$button
=
new
KeyboardButton
(
'message'
)
;
$button
->
request_poll
=
[
]
;
$this
->
assertInstanceOf
(
KeyboardButtonPollType
::
class
,
$button
->
getRequestPoll
(
)
)
;
$button
=
new
KeyboardButton
(
'message'
)
;
$button
->
web_app
=
[
]
;
$this
->
assertInstanceOf
(
WebAppInfo
::
class
,
$button
->
getWebApp
(
)
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 15, 9:47 AM (5 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
151392
Default Alt Text
KeyboardButtonTest.php (2 KB)
Attached To
Mode
R123 php-telegram-bot
Attached
Detach File
Event Timeline