mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-25 14:59:16 +01:00
Added unit tests for helpers and tests for commands
This commit is contained in:
33
tests/Feature/Commands/SetTelegramOptionsCommandTest.php
Normal file
33
tests/Feature/Commands/SetTelegramOptionsCommandTest.php
Normal 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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user