fedi-feed-router/tests/Feature/Http/Console/Commands/SyncChannelPostsCommandTest.php
myrmidex 6784af2ff6
Some checks failed
CI / ci (push) Failing after 4m31s
25 - Fix all PHPStan errors and add mockery extension
2026-03-08 14:18:28 +01:00

55 lines
1.8 KiB
PHP

<?php
namespace Tests\Feature\Http\Console\Commands;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Testing\PendingCommand;
use Tests\TestCase;
class SyncChannelPostsCommandTest extends TestCase
{
use RefreshDatabase;
public function test_command_fails_with_unsupported_platform(): void
{
// Act
/** @var PendingCommand $exitCode */
$exitCode = $this->artisan('channel:sync unsupported');
// Assert
$exitCode->assertFailed();
$exitCode->expectsOutput('Unsupported platform: unsupported');
}
public function test_command_returns_failure_exit_code_for_unsupported_platform(): void
{
// Act
/** @var PendingCommand $exitCode */
$exitCode = $this->artisan('channel:sync invalid');
// Assert
$exitCode->assertExitCode(1);
}
public function test_command_accepts_lemmy_platform_argument(): void
{
// Act - Test that the command accepts lemmy as a valid platform argument
/** @var PendingCommand $exitCode */
$exitCode = $this->artisan('channel:sync lemmy');
// Assert - Command should succeed (not fail with argument validation error)
$exitCode->assertSuccessful();
$exitCode->expectsOutput('Successfully dispatched sync jobs for all active Lemmy channels');
}
public function test_command_handles_default_platform(): void
{
// Act - Test that the command works with default platform (should be lemmy)
/** @var PendingCommand $exitCode */
$exitCode = $this->artisan('channel:sync');
// Assert - Command should succeed with default platform
$exitCode->assertSuccessful();
$exitCode->expectsOutput('Successfully dispatched sync jobs for all active Lemmy channels');
}
}