Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Jun 28, 2024
1 parent 660b6ce commit 41bb713
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/Method/DeleteChatStickerSetTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

namespace Vjik\TelegramBot\Api\Tests\Method;

use PHPUnit\Framework\TestCase;
use Vjik\TelegramBot\Api\Method\DeleteChatStickerSet;
use Vjik\TelegramBot\Api\Request\HttpMethod;

final class DeleteChatStickerSetTest extends TestCase
{
public function testBase(): void
{
$method = new DeleteChatStickerSet(1);

$this->assertSame(HttpMethod::POST, $method->getHttpMethod());
$this->assertSame('deleteChatStickerSet', $method->getApiMethod());
$this->assertSame(
[
'chat_id' => 1,
],
$method->getData(),
);
}

public function testPrepareResult(): void
{
$method = new DeleteChatStickerSet(1);

$preparedResult = $method->prepareResult(true);

$this->assertTrue($preparedResult);
}
}
36 changes: 36 additions & 0 deletions tests/Method/SetChatStickerSetTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

namespace Vjik\TelegramBot\Api\Tests\Method;

use PHPUnit\Framework\TestCase;
use Vjik\TelegramBot\Api\Method\SetChatStickerSet;
use Vjik\TelegramBot\Api\Request\HttpMethod;

final class SetChatStickerSetTest extends TestCase
{
public function testBase(): void
{
$method = new SetChatStickerSet(1, 'animals_by_bot');

$this->assertSame(HttpMethod::POST, $method->getHttpMethod());
$this->assertSame('setChatStickerSet', $method->getApiMethod());
$this->assertSame(
[
'chat_id' => 1,
'sticker_set_name' => 'animals_by_bot',
],
$method->getData(),
);
}

public function testPrepareResult(): void
{
$method = new SetChatStickerSet(1, 'animals_by_bot');

$preparedResult = $method->prepareResult(true);

$this->assertTrue($preparedResult);
}
}
24 changes: 24 additions & 0 deletions tests/TelegramBotApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,18 @@ public function testDeleteChatPhoto(): void
$this->assertTrue($result);
}

public function testDeleteChatStickerSet(): void
{
$api = $this->createApi([
'ok' => true,
'result' => true,
]);

$result = $api->deleteChatStickerSet(1);

$this->assertTrue($result);
}

public function testDeleteMyCommands(): void
{
$api = $this->createApi([
Expand Down Expand Up @@ -1180,6 +1192,18 @@ public function testSetChatPhoto(): void
$this->assertTrue($result);
}

public function testSetChatStickerSet(): void
{
$api = $this->createApi([
'ok' => true,
'result' => true,
]);

$result = $api->setChatStickerSet(1, 'animals_by_bot');

$this->assertTrue($result);
}

public function testSetChatTitle(): void
{
$api = $this->createApi([
Expand Down

0 comments on commit 41bb713

Please sign in to comment.