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
a00e6914
Unverified
Commit
a00e6914
authored
Jul 06, 2016
by
Armando Lüscher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove all superfluous `@test` comments and rename functions to start with `test`.
parent
61cc1a44
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
21 additions
and
197 deletions
+21
-197
CommandTest.php
tests/Unit/Commands/CommandTest.php
+0
-39
CommandTestCase.php
tests/Unit/Commands/CommandTestCase.php
+0
-2
EchoCommandTest.php
tests/Unit/Commands/UserCommands/EchoCommandTest.php
+0
-9
HelpCommandTest.php
tests/Unit/Commands/UserCommands/HelpCommandTest.php
+0
-12
ConversationTest.php
tests/Unit/ConversationTest.php
+9
-34
ChatTest.php
tests/Unit/Entities/ChatTest.php
+1
-5
MessageTest.php
tests/Unit/Entities/MessageTest.php
+0
-3
ServerResponseTest.php
tests/Unit/Entities/ServerResponseTest.php
+0
-43
UpdateTest.php
tests/Unit/Entities/UpdateTest.php
+0
-4
TelegramLogTest.php
tests/Unit/TelegramLogTest.php
+3
-18
TelegramTest.php
tests/Unit/TelegramTest.php
+8
-28
No files found.
tests/Unit/Commands/CommandTest.php
View file @
a00e6914
...
@@ -48,9 +48,6 @@ class CommandTest extends TestCase
...
@@ -48,9 +48,6 @@ class CommandTest extends TestCase
$this
->
command_stub_with_config
->
__construct
(
$this
->
telegram_with_config
);
$this
->
command_stub_with_config
->
__construct
(
$this
->
telegram_with_config
);
}
}
/**
* @test
*/
public
function
testCommandConstructorNeedsTelegramObject
()
public
function
testCommandConstructorNeedsTelegramObject
()
{
{
$error_message
=
'must be an instance of Longman\TelegramBot\Telegram'
;
$error_message
=
'must be an instance of Longman\TelegramBot\Telegram'
;
...
@@ -72,87 +69,57 @@ class CommandTest extends TestCase
...
@@ -72,87 +69,57 @@ class CommandTest extends TestCase
}
}
}
}
/**
* @test
*/
public
function
testCommandHasCorrectTelegramObject
()
public
function
testCommandHasCorrectTelegramObject
()
{
{
$this
->
assertAttributeEquals
(
$this
->
telegram
,
'telegram'
,
$this
->
command_stub
);
$this
->
assertAttributeEquals
(
$this
->
telegram
,
'telegram'
,
$this
->
command_stub
);
$this
->
assertSame
(
$this
->
telegram
,
$this
->
command_stub
->
getTelegram
());
$this
->
assertSame
(
$this
->
telegram
,
$this
->
command_stub
->
getTelegram
());
}
}
/**
* @test
*/
public
function
testDefaultCommandName
()
public
function
testDefaultCommandName
()
{
{
$this
->
assertAttributeEquals
(
''
,
'name'
,
$this
->
command_stub
);
$this
->
assertAttributeEquals
(
''
,
'name'
,
$this
->
command_stub
);
$this
->
assertEmpty
(
$this
->
command_stub
->
getName
());
$this
->
assertEmpty
(
$this
->
command_stub
->
getName
());
}
}
/**
* @test
*/
public
function
testDefaultCommandDescription
()
public
function
testDefaultCommandDescription
()
{
{
$this
->
assertAttributeEquals
(
'Command description'
,
'description'
,
$this
->
command_stub
);
$this
->
assertAttributeEquals
(
'Command description'
,
'description'
,
$this
->
command_stub
);
$this
->
assertEquals
(
'Command description'
,
$this
->
command_stub
->
getDescription
());
$this
->
assertEquals
(
'Command description'
,
$this
->
command_stub
->
getDescription
());
}
}
/**
* @test
*/
public
function
testDefaultCommandUsage
()
public
function
testDefaultCommandUsage
()
{
{
$this
->
assertAttributeEquals
(
'Command usage'
,
'usage'
,
$this
->
command_stub
);
$this
->
assertAttributeEquals
(
'Command usage'
,
'usage'
,
$this
->
command_stub
);
$this
->
assertEquals
(
'Command usage'
,
$this
->
command_stub
->
getUsage
());
$this
->
assertEquals
(
'Command usage'
,
$this
->
command_stub
->
getUsage
());
}
}
/**
* @test
*/
public
function
testDefaultCommandVersion
()
public
function
testDefaultCommandVersion
()
{
{
$this
->
assertAttributeEquals
(
'1.0.0'
,
'version'
,
$this
->
command_stub
);
$this
->
assertAttributeEquals
(
'1.0.0'
,
'version'
,
$this
->
command_stub
);
$this
->
assertEquals
(
'1.0.0'
,
$this
->
command_stub
->
getVersion
());
$this
->
assertEquals
(
'1.0.0'
,
$this
->
command_stub
->
getVersion
());
}
}
/**
* @test
*/
public
function
testDefaultCommandIsEnabled
()
public
function
testDefaultCommandIsEnabled
()
{
{
$this
->
assertAttributeEquals
(
true
,
'enabled'
,
$this
->
command_stub
);
$this
->
assertAttributeEquals
(
true
,
'enabled'
,
$this
->
command_stub
);
$this
->
assertTrue
(
$this
->
command_stub
->
isEnabled
());
$this
->
assertTrue
(
$this
->
command_stub
->
isEnabled
());
}
}
/**
* @test
*/
public
function
testDefaultCommandNeedsMysql
()
public
function
testDefaultCommandNeedsMysql
()
{
{
$this
->
assertAttributeEquals
(
false
,
'need_mysql'
,
$this
->
command_stub
);
$this
->
assertAttributeEquals
(
false
,
'need_mysql'
,
$this
->
command_stub
);
}
}
/**
* @test
*/
public
function
testDefaultCommandEmptyConfig
()
public
function
testDefaultCommandEmptyConfig
()
{
{
$this
->
assertAttributeEquals
([],
'config'
,
$this
->
command_stub
);
$this
->
assertAttributeEquals
([],
'config'
,
$this
->
command_stub
);
}
}
/**
* @test
*/
public
function
testDefaultCommandUpdateNull
()
public
function
testDefaultCommandUpdateNull
()
{
{
$this
->
assertAttributeEquals
(
null
,
'update'
,
$this
->
command_stub
);
$this
->
assertAttributeEquals
(
null
,
'update'
,
$this
->
command_stub
);
}
}
/**
* @test
*/
public
function
testCommandSetUpdateAndMessage
()
public
function
testCommandSetUpdateAndMessage
()
{
{
$stub
=
$this
->
command_stub
;
$stub
=
$this
->
command_stub
;
...
@@ -174,17 +141,11 @@ class CommandTest extends TestCase
...
@@ -174,17 +141,11 @@ class CommandTest extends TestCase
$this
->
assertEquals
(
$message
,
$stub
->
getMessage
());
$this
->
assertEquals
(
$message
,
$stub
->
getMessage
());
}
}
/**
* @test
*/
public
function
testCommandWithConfigNotEmptyConfig
()
public
function
testCommandWithConfigNotEmptyConfig
()
{
{
$this
->
assertAttributeNotEmpty
(
'config'
,
$this
->
command_stub_with_config
);
$this
->
assertAttributeNotEmpty
(
'config'
,
$this
->
command_stub_with_config
);
}
}
/**
* @test
*/
public
function
testCommandWithConfigCorrectConfig
()
public
function
testCommandWithConfigCorrectConfig
()
{
{
$this
->
assertAttributeEquals
([
'config_key'
=>
'config_value'
],
'config'
,
$this
->
command_stub_with_config
);
$this
->
assertAttributeEquals
([
'config_key'
=>
'config_value'
],
'config'
,
$this
->
command_stub_with_config
);
...
...
tests/Unit/Commands/CommandTestCase.php
View file @
a00e6914
...
@@ -34,8 +34,6 @@ class CommandTestCase extends TestCase
...
@@ -34,8 +34,6 @@ class CommandTestCase extends TestCase
/**
/**
* Make sure the version number is in the format x.x.x, x.x or x
* Make sure the version number is in the format x.x.x, x.x or x
*
* @test
*/
*/
public
function
testVersionNumberFormat
()
public
function
testVersionNumberFormat
()
{
{
...
...
tests/Unit/Commands/UserCommands/EchoCommandTest.php
View file @
a00e6914
...
@@ -30,9 +30,6 @@ class EchoCommandTest extends CommandTestCase
...
@@ -30,9 +30,6 @@ class EchoCommandTest extends CommandTestCase
$this
->
command
=
new
EchoCommand
(
$this
->
telegram
);
$this
->
command
=
new
EchoCommand
(
$this
->
telegram
);
}
}
/**
* @test
*/
public
function
testEchoCommandProperties
()
public
function
testEchoCommandProperties
()
{
{
$this
->
assertAttributeEquals
(
'echo'
,
'name'
,
$this
->
command
);
$this
->
assertAttributeEquals
(
'echo'
,
'name'
,
$this
->
command
);
...
@@ -40,9 +37,6 @@ class EchoCommandTest extends CommandTestCase
...
@@ -40,9 +37,6 @@ class EchoCommandTest extends CommandTestCase
$this
->
assertAttributeEquals
(
'/echo <text>'
,
'usage'
,
$this
->
command
);
$this
->
assertAttributeEquals
(
'/echo <text>'
,
'usage'
,
$this
->
command
);
}
}
/**
* @test
*/
public
function
testEchoCommandExecuteWithoutParameter
()
public
function
testEchoCommandExecuteWithoutParameter
()
{
{
$text
=
$this
->
command
$text
=
$this
->
command
...
@@ -60,9 +54,6 @@ class EchoCommandTest extends CommandTestCase
...
@@ -60,9 +54,6 @@ class EchoCommandTest extends CommandTestCase
$this
->
assertEquals
(
'Command usage: /echo <text>'
,
$text
);
$this
->
assertEquals
(
'Command usage: /echo <text>'
,
$text
);
}
}
/**
* @test
*/
public
function
testEchoCommandExecuteWithParameter
()
public
function
testEchoCommandExecuteWithParameter
()
{
{
$text
=
$this
->
command
$text
=
$this
->
command
...
...
tests/Unit/Commands/UserCommands/HelpCommandTest.php
View file @
a00e6914
...
@@ -29,9 +29,6 @@ class HelpCommandTest extends CommandTestCase
...
@@ -29,9 +29,6 @@ class HelpCommandTest extends CommandTestCase
$this
->
command
=
new
HelpCommand
(
$this
->
telegram
);
$this
->
command
=
new
HelpCommand
(
$this
->
telegram
);
}
}
/**
* @test
*/
public
function
testHelpCommandProperties
()
public
function
testHelpCommandProperties
()
{
{
$this
->
assertAttributeEquals
(
'help'
,
'name'
,
$this
->
command
);
$this
->
assertAttributeEquals
(
'help'
,
'name'
,
$this
->
command
);
...
@@ -39,9 +36,6 @@ class HelpCommandTest extends CommandTestCase
...
@@ -39,9 +36,6 @@ class HelpCommandTest extends CommandTestCase
$this
->
assertAttributeEquals
(
'/help or /help <command>'
,
'usage'
,
$this
->
command
);
$this
->
assertAttributeEquals
(
'/help or /help <command>'
,
'usage'
,
$this
->
command
);
}
}
/**
* @test
*/
public
function
testHelpCommandExecuteWithoutParameter
()
public
function
testHelpCommandExecuteWithoutParameter
()
{
{
$text
=
$this
->
command
$text
=
$this
->
command
...
@@ -55,9 +49,6 @@ class HelpCommandTest extends CommandTestCase
...
@@ -55,9 +49,6 @@ class HelpCommandTest extends CommandTestCase
);
);
}
}
/**
* @test
*/
public
function
testHelpCommandExecuteWithParameterInvalidCommand
()
public
function
testHelpCommandExecuteWithParameterInvalidCommand
()
{
{
$text
=
$this
->
command
$text
=
$this
->
command
...
@@ -68,9 +59,6 @@ class HelpCommandTest extends CommandTestCase
...
@@ -68,9 +59,6 @@ class HelpCommandTest extends CommandTestCase
$this
->
assertEquals
(
'No help available: Command /invalidcommand not found'
,
$text
);
$this
->
assertEquals
(
'No help available: Command /invalidcommand not found'
,
$text
);
}
}
/**
* @test
*/
public
function
testHelpCommandExecuteWithParameterValidCommand
()
public
function
testHelpCommandExecuteWithParameterValidCommand
()
{
{
$text
=
$this
->
command
$text
=
$this
->
command
...
...
tests/Unit/ConversationTest.php
View file @
a00e6914
...
@@ -47,10 +47,7 @@ class ConversationTest extends TestCase
...
@@ -47,10 +47,7 @@ class ConversationTest extends TestCase
TestHelpers
::
emptyDB
(
$credentials
);
TestHelpers
::
emptyDB
(
$credentials
);
}
}
/**
public
function
testConversationThatDoesntExistPropertiesSetCorrectly
()
* @test
*/
public
function
conversationThatDoesntExistPropertiesSetCorrectly
()
{
{
$conversation
=
new
Conversation
(
123
,
456
);
$conversation
=
new
Conversation
(
123
,
456
);
$this
->
assertAttributeEquals
(
123
,
'user_id'
,
$conversation
);
$this
->
assertAttributeEquals
(
123
,
'user_id'
,
$conversation
);
...
@@ -58,10 +55,7 @@ class ConversationTest extends TestCase
...
@@ -58,10 +55,7 @@ class ConversationTest extends TestCase
$this
->
assertAttributeEquals
(
null
,
'command'
,
$conversation
);
$this
->
assertAttributeEquals
(
null
,
'command'
,
$conversation
);
}
}
/**
public
function
testConversationThatExistsPropertiesSetCorrectly
()
* @test
*/
public
function
conversationThatExistsPropertiesSetCorrectly
()
{
{
$info
=
TestHelpers
::
startFakeConversation
(
'command'
);
$info
=
TestHelpers
::
startFakeConversation
(
'command'
);
$conversation
=
new
Conversation
(
$info
[
'user_id'
],
$info
[
'chat_id'
],
'command'
);
$conversation
=
new
Conversation
(
$info
[
'user_id'
],
$info
[
'chat_id'
],
'command'
);
...
@@ -70,10 +64,7 @@ class ConversationTest extends TestCase
...
@@ -70,10 +64,7 @@ class ConversationTest extends TestCase
$this
->
assertAttributeEquals
(
'command'
,
'command'
,
$conversation
);
$this
->
assertAttributeEquals
(
'command'
,
'command'
,
$conversation
);
}
}
/**
public
function
testConversationThatDoesntExistWithoutCommand
()
* @test
*/
public
function
conversationThatDoesntExistWithoutCommand
()
{
{
$conversation
=
new
Conversation
(
1
,
1
);
$conversation
=
new
Conversation
(
1
,
1
);
$this
->
assertFalse
(
$conversation
->
exists
());
$this
->
assertFalse
(
$conversation
->
exists
());
...
@@ -81,18 +72,14 @@ class ConversationTest extends TestCase
...
@@ -81,18 +72,14 @@ class ConversationTest extends TestCase
}
}
/**
/**
* @test
* @expectedException \Longman\TelegramBot\Exception\TelegramException
* @expectedException \Longman\TelegramBot\Exception\TelegramException
*/
*/
public
function
c
onversationThatDoesntExistWithCommand
()
public
function
testC
onversationThatDoesntExistWithCommand
()
{
{
new
Conversation
(
1
,
1
,
'command'
);
new
Conversation
(
1
,
1
,
'command'
);
}
}
/**
public
function
testNewConversationThatWontExistWithoutCommand
()
* @test
*/
public
function
newConversationThatWontExistWithoutCommand
()
{
{
TestHelpers
::
startFakeConversation
(
null
);
TestHelpers
::
startFakeConversation
(
null
);
$conversation
=
new
Conversation
(
0
,
0
);
$conversation
=
new
Conversation
(
0
,
0
);
...
@@ -100,10 +87,7 @@ class ConversationTest extends TestCase
...
@@ -100,10 +87,7 @@ class ConversationTest extends TestCase
$this
->
assertNull
(
$conversation
->
getCommand
());
$this
->
assertNull
(
$conversation
->
getCommand
());
}
}
/**
public
function
testNewConversationThatWillExistWithCommand
()
* @test
*/
public
function
newConversationThatWillExistWithCommand
()
{
{
$info
=
TestHelpers
::
startFakeConversation
(
'command'
);
$info
=
TestHelpers
::
startFakeConversation
(
'command'
);
$conversation
=
new
Conversation
(
$info
[
'user_id'
],
$info
[
'chat_id'
],
'command'
);
$conversation
=
new
Conversation
(
$info
[
'user_id'
],
$info
[
'chat_id'
],
'command'
);
...
@@ -111,10 +95,7 @@ class ConversationTest extends TestCase
...
@@ -111,10 +95,7 @@ class ConversationTest extends TestCase
$this
->
assertEquals
(
'command'
,
$conversation
->
getCommand
());
$this
->
assertEquals
(
'command'
,
$conversation
->
getCommand
());
}
}
/**
public
function
testStopConversation
()
* @test
*/
public
function
stopConversation
()
{
{
$info
=
TestHelpers
::
startFakeConversation
(
'command'
);
$info
=
TestHelpers
::
startFakeConversation
(
'command'
);
$conversation
=
new
Conversation
(
$info
[
'user_id'
],
$info
[
'chat_id'
],
'command'
);
$conversation
=
new
Conversation
(
$info
[
'user_id'
],
$info
[
'chat_id'
],
'command'
);
...
@@ -125,10 +106,7 @@ class ConversationTest extends TestCase
...
@@ -125,10 +106,7 @@ class ConversationTest extends TestCase
$this
->
assertFalse
(
$conversation2
->
exists
());
$this
->
assertFalse
(
$conversation2
->
exists
());
}
}
/**
public
function
testCancelConversation
()
* @test
*/
public
function
cancelConversation
()
{
{
$info
=
TestHelpers
::
startFakeConversation
(
'command'
);
$info
=
TestHelpers
::
startFakeConversation
(
'command'
);
$conversation
=
new
Conversation
(
$info
[
'user_id'
],
$info
[
'chat_id'
],
'command'
);
$conversation
=
new
Conversation
(
$info
[
'user_id'
],
$info
[
'chat_id'
],
'command'
);
...
@@ -139,10 +117,7 @@ class ConversationTest extends TestCase
...
@@ -139,10 +117,7 @@ class ConversationTest extends TestCase
$this
->
assertFalse
(
$conversation2
->
exists
());
$this
->
assertFalse
(
$conversation2
->
exists
());
}
}
/**
public
function
testUpdateConversationNotes
()
* @test
*/
public
function
updateConversationNotes
()
{
{
$info
=
TestHelpers
::
startFakeConversation
(
'command'
);
$info
=
TestHelpers
::
startFakeConversation
(
'command'
);
$conversation
=
new
Conversation
(
$info
[
'user_id'
],
$info
[
'chat_id'
],
'command'
);
$conversation
=
new
Conversation
(
$info
[
'user_id'
],
$info
[
'chat_id'
],
'command'
);
...
...
tests/Unit/Entities/ChatTest.php
View file @
a00e6914
...
@@ -33,11 +33,7 @@ class ChatTest extends TestCase
...
@@ -33,11 +33,7 @@ class ChatTest extends TestCase
{
{
}
}
/**
public
function
testChatType
()
* @test
*/
public
function
testChatType
()
{
{
$this
->
chat
=
new
Chat
(
json_decode
(
'{"id":123,"title":null,"first_name":"john","last_name":null,"username":"null"}'
,
true
));
$this
->
chat
=
new
Chat
(
json_decode
(
'{"id":123,"title":null,"first_name":"john","last_name":null,"username":"null"}'
,
true
));
...
...
tests/Unit/Entities/MessageTest.php
View file @
a00e6914
...
@@ -40,9 +40,6 @@ class MessageTest extends TestCase
...
@@ -40,9 +40,6 @@ class MessageTest extends TestCase
//$json = utf8_encode($json);
//$json = utf8_encode($json);
return
json_decode
(
$json
,
true
);
return
json_decode
(
$json
,
true
);
}
}
/**
* @test
*/
public
function
testTextAndCommandRecognise
()
{
public
function
testTextAndCommandRecognise
()
{
// /command
// /command
...
...
tests/Unit/Entities/ServerResponseTest.php
View file @
a00e6914
...
@@ -37,10 +37,6 @@ class ServerResponseTest extends TestCase
...
@@ -37,10 +37,6 @@ class ServerResponseTest extends TestCase
{
{
}
}
/**
* @test
*/
public
function
sendMessageOk
()
public
function
sendMessageOk
()
{
{
return
'{
return
'{
...
@@ -80,10 +76,6 @@ class ServerResponseTest extends TestCase
...
@@ -80,10 +76,6 @@ class ServerResponseTest extends TestCase
}
}
/**
* @test
*/
public
function
sendMessageFail
()
public
function
sendMessageFail
()
{
{
return
'{
return
'{
...
@@ -105,10 +97,6 @@ class ServerResponseTest extends TestCase
...
@@ -105,10 +97,6 @@ class ServerResponseTest extends TestCase
$this
->
assertEquals
(
'Error: Bad Request: wrong chat id'
,
$this
->
server
->
getDescription
());
$this
->
assertEquals
(
'Error: Bad Request: wrong chat id'
,
$this
->
server
->
getDescription
());
}
}
/**
* @test
*/
public
function
setWebHookOk
()
public
function
setWebHookOk
()
{
{
return
'{"ok":true,"result":true,"description":"Webhook was set"}'
;
return
'{"ok":true,"result":true,"description":"Webhook was set"}'
;
...
@@ -126,10 +114,6 @@ class ServerResponseTest extends TestCase
...
@@ -126,10 +114,6 @@ class ServerResponseTest extends TestCase
$this
->
assertEquals
(
'Webhook was set'
,
$this
->
server
->
getDescription
());
$this
->
assertEquals
(
'Webhook was set'
,
$this
->
server
->
getDescription
());
}
}
/**
* @test
*/
public
function
setWebHookFail
()
public
function
setWebHookFail
()
{
{
return
'{
return
'{
...
@@ -152,12 +136,6 @@ class ServerResponseTest extends TestCase
...
@@ -152,12 +136,6 @@ class ServerResponseTest extends TestCase
$this
->
assertEquals
(
"Error: Bad request: htttps://domain.host.org/dir/hook.php"
,
$this
->
server
->
getDescription
());
$this
->
assertEquals
(
"Error: Bad request: htttps://domain.host.org/dir/hook.php"
,
$this
->
server
->
getDescription
());
}
}
/**
* @test
*/
public
function
getUpdatesArray
()
public
function
getUpdatesArray
()
{
{
return
'{
return
'{
...
@@ -210,10 +188,6 @@ class ServerResponseTest extends TestCase
...
@@ -210,10 +188,6 @@ class ServerResponseTest extends TestCase
$this
->
assertInstanceOf
(
'\Longman\TelegramBot\Entities\Update'
,
$this
->
server
->
getResult
()[
0
]);
$this
->
assertInstanceOf
(
'\Longman\TelegramBot\Entities\Update'
,
$this
->
server
->
getResult
()[
0
]);
}
}
/**
* @test
*/
public
function
getUpdatesEmpty
()
public
function
getUpdatesEmpty
()
{
{
return
'{"ok":true,"result":[]}'
;
return
'{"ok":true,"result":[]}'
;
...
@@ -226,12 +200,6 @@ class ServerResponseTest extends TestCase
...
@@ -226,12 +200,6 @@ class ServerResponseTest extends TestCase
$this
->
assertNull
(
$this
->
server
->
getResult
());
$this
->
assertNull
(
$this
->
server
->
getResult
());
}
}
/**
* @test
*/
public
function
getUserProfilePhotos
()
public
function
getUserProfilePhotos
()
{
{
return
'{
return
'{
...
@@ -273,12 +241,6 @@ class ServerResponseTest extends TestCase
...
@@ -273,12 +241,6 @@ class ServerResponseTest extends TestCase
}
}
/**
* @test
*/
public
function
getFile
()
public
function
getFile
()
{
{
return
'{
return
'{
...
@@ -303,11 +265,6 @@ class ServerResponseTest extends TestCase
...
@@ -303,11 +265,6 @@ class ServerResponseTest extends TestCase
}
}
/**
* @test
*/
public
function
testSetGeneralTestFakeResponse
()
{
public
function
testSetGeneralTestFakeResponse
()
{
//setWebhook ok
//setWebhook ok
$fake_response
=
Request
::
generateGeneralFakeServerResponse
();
$fake_response
=
Request
::
generateGeneralFakeServerResponse
();
...
...
tests/Unit/Entities/UpdateTest.php
View file @
a00e6914
...
@@ -26,10 +26,6 @@ class UpdateTest extends TestCase
...
@@ -26,10 +26,6 @@ class UpdateTest extends TestCase
*/
*/
private
$update
;
private
$update
;
/**
* @test
*/
public
function
testUpdateCast
()
public
function
testUpdateCast
()
{
{
$json
=
'
$json
=
'
...
...
tests/Unit/TelegramLogTest.php
View file @
a00e6914
...
@@ -56,35 +56,29 @@ class TelegramLogTest extends TestCase
...
@@ -56,35 +56,29 @@ class TelegramLogTest extends TestCase
}
}
/**
/**
* @test
* @expectedException \Longman\TelegramBot\Exception\TelegramLogException
* @expectedException \Longman\TelegramBot\Exception\TelegramLogException
*/
*/
public
function
n
ewInstanceWithoutErrorPath
()
public
function
testN
ewInstanceWithoutErrorPath
()
{
{
TelegramLog
::
initErrorLog
(
''
);
TelegramLog
::
initErrorLog
(
''
);
}
}
/**
/**
* @test
* @expectedException \Longman\TelegramBot\Exception\TelegramLogException
* @expectedException \Longman\TelegramBot\Exception\TelegramLogException
*/
*/
public
function
n
ewInstanceWithoutDebugPath
()
public
function
testN
ewInstanceWithoutDebugPath
()
{
{
TelegramLog
::
initDebugLog
(
''
);
TelegramLog
::
initDebugLog
(
''
);
}
}
/**
/**
* @test
* @expectedException \Longman\TelegramBot\Exception\TelegramLogException
* @expectedException \Longman\TelegramBot\Exception\TelegramLogException
*/
*/
public
function
n
ewInstanceWithoutUpdatePath
()
public
function
testN
ewInstanceWithoutUpdatePath
()
{
{
TelegramLog
::
initUpdateLog
(
''
);
TelegramLog
::
initUpdateLog
(
''
);
}
}
/**
* @test
*/
public
function
testErrorStream
()
public
function
testErrorStream
()
{
{
$file
=
$this
->
logfiles
[
'error'
];
$file
=
$this
->
logfiles
[
'error'
];
...
@@ -95,9 +89,6 @@ class TelegramLogTest extends TestCase
...
@@ -95,9 +89,6 @@ class TelegramLogTest extends TestCase
$this
->
assertContains
(
'bot_log.ERROR: my error'
,
file_get_contents
(
$file
));
$this
->
assertContains
(
'bot_log.ERROR: my error'
,
file_get_contents
(
$file
));
}
}
/**
* @test
*/
public
function
testDebugStream
()
public
function
testDebugStream
()
{
{
$file
=
$this
->
logfiles
[
'debug'
];
$file
=
$this
->
logfiles
[
'debug'
];
...
@@ -108,9 +99,6 @@ class TelegramLogTest extends TestCase
...
@@ -108,9 +99,6 @@ class TelegramLogTest extends TestCase
$this
->
assertContains
(
'bot_log.DEBUG: my debug'
,
file_get_contents
(
$file
));
$this
->
assertContains
(
'bot_log.DEBUG: my debug'
,
file_get_contents
(
$file
));
}
}
/**
* @test
*/
public
function
testUpdateStream
()
public
function
testUpdateStream
()
{
{
$file
=
$this
->
logfiles
[
'update'
];
$file
=
$this
->
logfiles
[
'update'
];
...
@@ -121,9 +109,6 @@ class TelegramLogTest extends TestCase
...
@@ -121,9 +109,6 @@ class TelegramLogTest extends TestCase
$this
->
assertContains
(
'my update'
,
file_get_contents
(
$file
));
$this
->
assertContains
(
'my update'
,
file_get_contents
(
$file
));
}
}
/**
* @test
*/
public
function
testExternalStream
()
public
function
testExternalStream
()
{
{
$file
=
$this
->
logfiles
[
'external'
];
$file
=
$this
->
logfiles
[
'external'
];
...
...
tests/Unit/TelegramTest.php
View file @
a00e6914
...
@@ -60,43 +60,32 @@ class TelegramTest extends TestCase
...
@@ -60,43 +60,32 @@ class TelegramTest extends TestCase
}
}
/**
/**
* @test
* @expectedException \Longman\TelegramBot\Exception\TelegramException
* @expectedException \Longman\TelegramBot\Exception\TelegramException
*/
*/
public
function
n
ewInstanceWithoutApiKeyParam
()
public
function
testN
ewInstanceWithoutApiKeyParam
()
{
{
new
Telegram
(
null
,
'testbotname'
);
new
Telegram
(
null
,
'testbotname'
);
}
}
/**
/**
* @test
* @expectedException \Longman\TelegramBot\Exception\TelegramException
* @expectedException \Longman\TelegramBot\Exception\TelegramException
*/
*/
public
function
n
ewInstanceWithoutBotNameParam
()
public
function
testN
ewInstanceWithoutBotNameParam
()
{
{
new
Telegram
(
'testapikey'
,
null
);
new
Telegram
(
'testapikey'
,
null
);
}
}
/**
public
function
testGetApiKey
()
* @test
*/
public
function
getApiKey
()
{
{
$this
->
assertEquals
(
'testapikey'
,
$this
->
telegram
->
getApiKey
());
$this
->
assertEquals
(
'testapikey'
,
$this
->
telegram
->
getApiKey
());
}
}
/**
public
function
testGetBotName
()
* @test
*/
public
function
getBotName
()
{
{
$this
->
assertEquals
(
'testbotname'
,
$this
->
telegram
->
getBotName
());
$this
->
assertEquals
(
'testbotname'
,
$this
->
telegram
->
getBotName
());
}
}
/**
public
function
testEnableAdmins
()
* @test
*/
public
function
enableAdmins
()
{
{
$tg
=
&
$this
->
telegram
;
$tg
=
&
$this
->
telegram
;
...
@@ -115,10 +104,7 @@ class TelegramTest extends TestCase
...
@@ -115,10 +104,7 @@ class TelegramTest extends TestCase
$this
->
assertCount
(
3
,
$tg
->
getAdminList
());
$this
->
assertCount
(
3
,
$tg
->
getAdminList
());
}
}
/**
public
function
testAddCustomCommandsPaths
()
* @test
*/
public
function
addCustomCommandsPaths
()
{
{
$tg
=
&
$this
->
telegram
;
$tg
=
&
$this
->
telegram
;
...
@@ -140,20 +126,14 @@ class TelegramTest extends TestCase
...
@@ -140,20 +126,14 @@ class TelegramTest extends TestCase
$this
->
assertAttributeCount
(
4
,
'commands_paths'
,
$tg
);
$this
->
assertAttributeCount
(
4
,
'commands_paths'
,
$tg
);
}
}
/**
public
function
testGetCommandsList
()
* @test
*/
public
function
getCommandsList
()
{
{
$commands
=
$this
->
telegram
->
getCommandsList
();
$commands
=
$this
->
telegram
->
getCommandsList
();
$this
->
assertInternalType
(
'array'
,
$commands
);
$this
->
assertInternalType
(
'array'
,
$commands
);
$this
->
assertNotCount
(
0
,
$commands
);
$this
->
assertNotCount
(
0
,
$commands
);
}
}
/**
public
function
testGetHelpCommandObject
()
* @test
*/
public
function
getHelpCommandObject
()
{
{
$command
=
$this
->
telegram
->
getCommandObject
(
'help'
);
$command
=
$this
->
telegram
->
getCommandObject
(
'help'
);
$this
->
assertInstanceOf
(
'Longman\TelegramBot\Commands\UserCommands\HelpCommand'
,
$command
);
$this
->
assertInstanceOf
(
'Longman\TelegramBot\Commands\UserCommands\HelpCommand'
,
$command
);
...
...
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