Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More tests and phpunit fixes
  • Loading branch information
unreal4u committed Jan 23, 2016
1 parent 87739ce commit 62be2a8
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 6 deletions.
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion phpunit.xml.dist
@@ -1,7 +1,7 @@
<phpunit colors="true" bootstrap="vendor/autoload.php" strict="true">
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src/unreal4u/</directory>
<directory suffix=".php">./src/</directory>
</whitelist>
<blacklist>
<directory suffix=".php">./vendor</directory>
Expand Down
1 change: 1 addition & 0 deletions tests/Mock/MockData/setWebhook.txt
@@ -0,0 +1 @@
{"ok":true,"result":true,"description":"Webhook was set"}
54 changes: 54 additions & 0 deletions tests/Telegram/Methods/SetWebhookTest.php
@@ -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);
}
}

0 comments on commit 62be2a8

Please sign in to comment.