Use `::class` where possible.

parent ce439368
......@@ -13,6 +13,7 @@ namespace Longman\TelegramBot\Tests\Unit\Commands;
use Longman\TelegramBot\Telegram;
use Longman\TelegramBot\Tests\Unit\TestCase;
use Longman\TelegramBot\Tests\Unit\TestHelpers;
use Longman\TelegramBot\Commands\Command;
/**
* @package TelegramTest
......@@ -26,7 +27,7 @@ class CommandTest extends TestCase
/**
* @var string
*/
private $command_namespace = 'Longman\TelegramBot\Commands\Command';
private $command_namespace = Command::class;
/**
* @var \Longman\TelegramBot\Telegram
......
......@@ -34,7 +34,7 @@ class AudioTest extends TestCase
public function testInstance()
{
$audio = new Audio($this->record);
self::assertInstanceOf('Longman\TelegramBot\Entities\Audio', $audio);
self::assertInstanceOf(Audio::class, $audio);
}
public function testGetProperties()
......
......@@ -38,7 +38,7 @@ class FileTest extends TestCase
public function testBaseStageLocation()
{
$file = new File($this->data);
$this->assertInstanceOf('Longman\TelegramBot\Entities\File', $file);
$this->assertInstanceOf(File::class, $file);
}
public function testGetFileId()
......
......@@ -34,7 +34,7 @@ class LocationTest extends TestCase
public function testBaseStageLocation()
{
$location = new Location($this->coordinates);
$this->assertInstanceOf('Longman\TelegramBot\Entities\Location', $location);
$this->assertInstanceOf(Location::class, $location);
}
public function testGetLongitude()
......
......@@ -15,6 +15,12 @@ namespace Longman\TelegramBot\Tests\Unit;
use Longman\TelegramBot\Entities\Message;
use Longman\TelegramBot\Entities\ServerResponse;
use Longman\TelegramBot\Request;
use Longman\TelegramBot\Entities\Sticker;
use Longman\TelegramBot\Entities\StickerSet;
use Longman\TelegramBot\Entities\File;
use Longman\TelegramBot\Entities\PhotoSize;
use Longman\TelegramBot\Entities\UserProfilePhotos;
use Longman\TelegramBot\Entities\Update;
/**
* @package TelegramTest
......@@ -54,7 +60,7 @@ class ServerResponseTest extends TestCase
self::assertTrue($server->isOk());
self::assertNull($server->getErrorCode());
self::assertNull($server->getDescription());
self::assertInstanceOf('\Longman\TelegramBot\Entities\Message', $server_result);
self::assertInstanceOf(Message::class, $server_result);
//Message
self::assertEquals('1234', $server_result->getMessageId());
......@@ -181,7 +187,7 @@ class ServerResponseTest extends TestCase
$server = new ServerResponse(json_decode($result, true), 'testbot');
self::assertCount(4, $server->getResult());
self::assertInstanceOf('\Longman\TelegramBot\Entities\Update', $server->getResult()[0]);
self::assertInstanceOf(Update::class, $server->getResult()[0]);
}
public function getUpdatesEmpty()
......@@ -239,8 +245,8 @@ class ServerResponseTest extends TestCase
//Photo size count
self::assertCount(3, $photos[0]);
self::assertInstanceOf('\Longman\TelegramBot\Entities\UserProfilePhotos', $server_result);
self::assertInstanceOf('\Longman\TelegramBot\Entities\PhotoSize', $photos[0][0]);
self::assertInstanceOf(UserProfilePhotos::class, $server_result);
self::assertInstanceOf(PhotoSize::class, $photos[0][0]);
}
public function getFile()
......@@ -261,7 +267,7 @@ class ServerResponseTest extends TestCase
$result = $this->getFile();
$server = new ServerResponse(json_decode($result, true), 'testbot');
self::assertInstanceOf('\Longman\TelegramBot\Entities\File', $server->getResult());
self::assertInstanceOf(File::class, $server->getResult());
}
public function testSetGeneralTestFakeResponse()
......@@ -287,7 +293,7 @@ class ServerResponseTest extends TestCase
self::assertTrue($server->isOk());
self::assertNull($server->getErrorCode());
self::assertNull($server->getDescription());
self::assertInstanceOf('\Longman\TelegramBot\Entities\Message', $server_result);
self::assertInstanceOf(Message::class, $server_result);
//Message
self::assertEquals('1234', $server_result->getMessageId());
......@@ -365,13 +371,13 @@ class ServerResponseTest extends TestCase
$server_result = $server->getResult();
self::assertInstanceOf('\Longman\TelegramBot\Entities\StickerSet', $server_result);
self::assertInstanceOf(StickerSet::class, $server_result);
self::assertEquals('stickerset_name', $server_result->getName());
self::assertEquals('Some name', $server_result->getTitle());
self::assertFalse($server_result->getContainsMasks());
$stickers = $server_result->getStickers();
self::assertCount(4, $stickers);
self::assertInstanceOf('\Longman\TelegramBot\Entities\Sticker', $stickers[0]);
self::assertInstanceOf(Sticker::class, $stickers[0]);
}
}
......@@ -24,7 +24,7 @@ class UserTest extends TestCase
public function testInstance()
{
$user = new User(['id' => 1]);
self::assertInstanceOf('Longman\TelegramBot\Entities\User', $user);
self::assertInstanceOf(User::class, $user);
}
public function testGetId()
......
......@@ -42,7 +42,7 @@ class WebhookInfoTest extends TestCase
public function testBaseStageWebhookInfo()
{
$webhook = new WebhookInfo($this->data);
$this->assertInstanceOf('Longman\TelegramBot\Entities\WebhookInfo', $webhook);
$this->assertInstanceOf(WebhookInfo::class, $webhook);
}
public function testGetUrl()
......
......@@ -36,7 +36,7 @@ class TelegramLogTest extends TestCase
protected function setUp()
{
// Make sure no monolog instance is set before each test.
TestHelpers::setStaticProperty('Longman\TelegramBot\TelegramLog', 'monolog', null);
TestHelpers::setStaticProperty(TelegramLog::class, 'monolog', null);
}
protected function tearDown()
......
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