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
054a73dc
Commit
054a73dc
authored
Sep 30, 2016
by
Monster3D
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error importing class TestHelpers
parent
911d2661
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
126 additions
and
0 deletions
+126
-0
AudioTest.php
tests/unit/Entities/AudioTest.php
+126
-0
No files found.
tests/unit/Entities/AudioTest.php
0 → 100644
View file @
054a73dc
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Longman\TelegramBot\Tests\Unit
;
use
Longman\TelegramBot\Entities\Audio
;
use
Longman\TelegramBot\Exception\TelegramException
;
use
Longman\TelegramBot\Tests\Unit\TestHelpers
;
/**
* @package TelegramTest
* @author Baev Nikolay <gametester3d@gmail.com>
* @copyright Avtandil Kikabidze <akalongman@gmail.com>
* @license http://opensource.org/licenses/mit-license.php The MIT License (MIT)
* @link http://www.github.com/akalongman/php-telegram-bot
*/
class
AudioTest
extends
TestCase
{
/**
* @var array
*/
private
$record
;
/**
* Set Up
*/
public
function
setUp
()
{
$this
->
record
=
TestHelpers
::
getFakeRecordedAudio
();
}
/**
* Testing base stage with data object creating
*/
public
function
testBaseStageAudio
()
{
$audio
=
new
Audio
(
$this
->
record
);
$this
->
assertInstanceOf
(
'Longman\TelegramBot\Entities\Audio'
,
$audio
);
}
/**
* Test base stage without duration property
*
* @expectedException Longman\TelegramBot\Exception\TelegramException
*/
public
function
testBaseStageWithoutDuration
()
{
$this
->
record
[
'duration'
]
=
null
;
new
Audio
(
$this
->
record
);
}
/**
* Test base stage without duration property
*
* @expectedException Longman\TelegramBot\Exception\TelegramException
*/
public
function
testBaseStageWithoutFileId
()
{
$this
->
record
[
'duration'
]
=
null
;
new
Audio
(
$this
->
record
);
}
/**
* Test get file id
*/
public
function
testGetFileId
()
{
$audio
=
new
Audio
(
$this
->
record
);
$file_id
=
$audio
->
getFileId
();
$this
->
assertEquals
(
$this
->
record
[
'file_id'
],
$file_id
);
}
/**
* Test get duration track
*/
public
function
testGetDuration
()
{
$audio
=
new
Audio
(
$this
->
record
);
$duration
=
$audio
->
getDuration
();
$this
->
assertEquals
(
$this
->
record
[
'duration'
],
$duration
);
}
/**
* Test get performer track
*/
public
function
testGetPerformer
()
{
$audio
=
new
Audio
(
$this
->
record
);
$performer
=
$audio
->
getPerformer
();
$this
->
assertEquals
(
$this
->
record
[
'performer'
],
$performer
);
}
/**
* Test get title track
*/
public
function
testGetTitle
()
{
$audio
=
new
Audio
(
$this
->
record
);
$title
=
$audio
->
getTitle
();
$this
->
assertEquals
(
$this
->
record
[
'title'
],
$title
);
}
/**
* Test get mime type file
*/
public
function
testGetMimeType
()
{
$audio
=
new
Audio
(
$this
->
record
);
$mime_type
=
$audio
->
getMimeType
();
$this
->
assertEquals
(
$this
->
record
[
'mime_type'
],
$mime_type
);
}
/**
* Test get file size
*/
public
function
testGetFileSize
()
{
$audio
=
new
Audio
(
$this
->
record
);
$file_size
=
$audio
->
getFileSize
();
$this
->
assertEquals
(
$this
->
record
[
'file_size'
],
$file_size
);
}
}
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