Added unit tests for helpers and tests for commands

This commit is contained in:
Henry Whitaker
2020-08-25 18:26:21 +01:00
parent b30ec477f4
commit 94e4919b44
21 changed files with 927 additions and 1 deletions

View File

@@ -0,0 +1,33 @@
<?php
namespace Tests\Feature\Commands;
use App\Helpers\SettingsHelper;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
class SetTelegramOptionsCommandTest extends TestCase
{
use RefreshDatabase;
/**
* A basic feature test example.
*
* @return void
*/
public function testSetTelegramOptions()
{
SettingsHelper::set('telegram_bot_token', 'pre-test-bot');
SettingsHelper::set('telegram_chat_id', 'pre-test-bot');
$this->artisan('speedtest:telegram', [
'--bot' => 'test-bot',
'--chat' => 'test-chat'
])->expectsOutput('Telegram options updated')
->assertExitCode(0);
$this->assertEquals(SettingsHelper::get('telegram_bot_token')->value, 'test-bot');
$this->assertEquals(SettingsHelper::get('telegram_chat_id')->value, 'test-chat');
}
}