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

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