-
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathRunCommandTest.php
More file actions
36 lines (29 loc) · 1.18 KB
/
RunCommandTest.php
File metadata and controls
36 lines (29 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
declare(strict_types=1);
namespace Yiisoft\Yii\Queue\Tests\Unit\Command;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\OutputInterface;
use Yiisoft\Yii\Queue\Command\RunCommand;
use Yiisoft\Yii\Queue\QueueFactoryInterface;
use Yiisoft\Yii\Queue\QueueInterface;
final class RunCommandTest extends TestCase
{
public function testConfigure(): void
{
$command = new RunCommand($this->createMock(QueueFactoryInterface::class));
$channelArgument = $command->getNativeDefinition()->getArgument('channel');
$this->assertEquals('channel', $channelArgument->getName());
}
public function testExecute(): void
{
$queue = $this->createMock(QueueInterface::class);
$queue->expects($this->once())->method('run');
$queueFactory = $this->createMock(QueueFactoryInterface::class);
$queueFactory->method('get')->willReturn($queue);
$input = new StringInput('channel');
$command = new RunCommand($queueFactory);
$exitCode = $command->run($input, $this->createMock(OutputInterface::class));
$this->assertSame(0, $exitCode);
}
}