Remove all superfluous `@test` comments and rename functions to start with `test`.

parent 61cc1a44
...@@ -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);
......
...@@ -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()
{ {
......
...@@ -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
......
...@@ -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
......
...@@ -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 conversationThatDoesntExistWithCommand() public function testConversationThatDoesntExistWithCommand()
{ {
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');
......
...@@ -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));
......
...@@ -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
......
...@@ -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();
......
...@@ -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 = '
......
...@@ -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 newInstanceWithoutErrorPath() public function testNewInstanceWithoutErrorPath()
{ {
TelegramLog::initErrorLog(''); TelegramLog::initErrorLog('');
} }
/** /**
* @test
* @expectedException \Longman\TelegramBot\Exception\TelegramLogException * @expectedException \Longman\TelegramBot\Exception\TelegramLogException
*/ */
public function newInstanceWithoutDebugPath() public function testNewInstanceWithoutDebugPath()
{ {
TelegramLog::initDebugLog(''); TelegramLog::initDebugLog('');
} }
/** /**
* @test
* @expectedException \Longman\TelegramBot\Exception\TelegramLogException * @expectedException \Longman\TelegramBot\Exception\TelegramLogException
*/ */
public function newInstanceWithoutUpdatePath() public function testNewInstanceWithoutUpdatePath()
{ {
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'];
......
...@@ -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 newInstanceWithoutApiKeyParam() public function testNewInstanceWithoutApiKeyParam()
{ {
new Telegram(null, 'testbotname'); new Telegram(null, 'testbotname');
} }
/** /**
* @test
* @expectedException \Longman\TelegramBot\Exception\TelegramException * @expectedException \Longman\TelegramBot\Exception\TelegramException
*/ */
public function newInstanceWithoutBotNameParam() public function testNewInstanceWithoutBotNameParam()
{ {
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);
......
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