Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
More tests and phpunit fixes
- Loading branch information
Showing
4 changed files
with
61 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"ok":true,"result":true,"description":"Webhook was set"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
namespace tests\Telegram\Methods; | ||
|
||
use tests\Mock\MockTgLog; | ||
use unreal4u\Telegram\Methods\SetWebhook; | ||
|
||
class SetWebhookTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var MockTgLog | ||
*/ | ||
private $tgLog; | ||
|
||
/** | ||
* Prepares the environment before running a test. | ||
*/ | ||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
$this->tgLog = new MockTgLog('TEST-TEST'); | ||
} | ||
|
||
/** | ||
* Cleans up the environment after running a test. | ||
*/ | ||
protected function tearDown() | ||
{ | ||
$this->tgLog = null; | ||
parent::tearDown(); | ||
} | ||
|
||
/** | ||
* Asserts that the GetMe method ALWAYS load in a user type | ||
*/ | ||
public function testBindToObjectType() | ||
{ | ||
$type = SetWebhook::bindToObjectType(); | ||
$this->assertEquals('Custom\\ResultBoolean', $type); | ||
} | ||
|
||
/** | ||
* @depends testBindToObjectType | ||
*/ | ||
public function testSetWebhook() | ||
{ | ||
$setWebhook = new SetWebhook(); | ||
|
||
$result = $this->tgLog->performApiRequest($setWebhook); | ||
|
||
$this->assertInstanceOf('unreal4u\\Telegram\\Types\\Custom\\ResultBoolean', $result); | ||
$this->assertTrue($result->data); | ||
} | ||
} |