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
e4fcfa79
Unverified
Commit
e4fcfa79
authored
Jun 13, 2019
by
Armando Lüscher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `::class` where possible.
parent
ce439368
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
22 additions
and
15 deletions
+22
-15
CommandTest.php
tests/unit/Commands/CommandTest.php
+2
-1
AudioTest.php
tests/unit/Entities/AudioTest.php
+1
-1
FileTest.php
tests/unit/Entities/FileTest.php
+1
-1
LocationTest.php
tests/unit/Entities/LocationTest.php
+1
-1
ServerResponseTest.php
tests/unit/Entities/ServerResponseTest.php
+14
-8
UserTest.php
tests/unit/Entities/UserTest.php
+1
-1
WebhookInfoTest.php
tests/unit/Entities/WebhookInfoTest.php
+1
-1
TelegramLogTest.php
tests/unit/TelegramLogTest.php
+1
-1
No files found.
tests/unit/Commands/CommandTest.php
View file @
e4fcfa79
...
...
@@ -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
...
...
tests/unit/Entities/AudioTest.php
View file @
e4fcfa79
...
...
@@ -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
()
...
...
tests/unit/Entities/FileTest.php
View file @
e4fcfa79
...
...
@@ -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
()
...
...
tests/unit/Entities/LocationTest.php
View file @
e4fcfa79
...
...
@@ -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
()
...
...
tests/unit/Entities/ServerResponseTest.php
View file @
e4fcfa79
...
...
@@ -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
]);
}
}
tests/unit/Entities/UserTest.php
View file @
e4fcfa79
...
...
@@ -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
()
...
...
tests/unit/Entities/WebhookInfoTest.php
View file @
e4fcfa79
...
...
@@ -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
()
...
...
tests/unit/TelegramLogTest.php
View file @
e4fcfa79
...
...
@@ -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
()
...
...
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