Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TelegramBot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
TelegramBot
Commits
9af785f8
Commit
9af785f8
authored
Aug 23, 2016
by
Armando Lüscher
Committed by
GitHub
Aug 23, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #283 from noplanman/improve_command_contructor_test
Improve command constructor test
parents
a7113c99
bba116ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
CommandTest.php
tests/Unit/Commands/CommandTest.php
+8
-3
No files found.
tests/Unit/Commands/CommandTest.php
View file @
9af785f8
...
...
@@ -65,25 +65,30 @@ class CommandTest extends TestCase
$this
->
command_stub_with_config
->
__construct
(
$this
->
telegram_with_config
);
}
// Test idea from here: http://stackoverflow.com/a/4371606
public
function
testCommandConstructorNeedsTelegramObject
()
{
$e
rror_message
=
'must be an instance of Longman\TelegramBot\Telegram'
;
$e
xception_count
=
0
;
$params_to_test
=
[
[],
[
null
],
[
12345
],
[
'something'
],
[
new
\stdClass
],
[
$this
->
telegram
],
// only this one is valid
];
foreach
(
$params_to_test
as
$param
)
{
try
{
$this
->
getMockForAbstractClass
(
$this
->
command_namespace
,
$param
);
}
catch
(
\Exception
$e
)
{
$
this
->
assertContains
(
$error_message
,
$e
->
getMessage
())
;
$
exception_count
++
;
}
catch
(
\Throwable
$e
)
{
//For PHP7
$
this
->
assertContains
(
$error_message
,
$e
->
getMessage
())
;
$
exception_count
++
;
}
}
$this
->
assertEquals
(
5
,
$exception_count
);
}
public
function
testCommandHasCorrectTelegramObject
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment