-
Notifications
You must be signed in to change notification settings - Fork 1
/
TestCommandTest.php
36 lines (27 loc) · 978 Bytes
/
TestCommandTest.php
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 Tests;
use Odesk\Phystrix;
class TestCommandTest extends TestCase
{
private Phystrix\CommandFactory $commandFactory;
protected function setUp(): void
{
parent::setUp();
$this->commandFactory = $this->app->make(Phystrix\CommandFactory::class);
}
public function testExecute(): void
{
/** @var Phystrix\AbstractCommand|TestCommand $command */
$command = $this->commandFactory->getCommand(TestCommand::class);
$this->assertInstanceOf(TestCommand::class, $command);
$this->assertEquals('run test', $command->execute());
}
public function testThrowException(): void
{
/** @var Phystrix\AbstractCommand|TestCommand $command */
$command = $this->commandFactory->getCommand(TestCommand::class, true);
$this->assertInstanceOf(TestCommand::class, $command);
$this->assertEquals('hi hello!!', $command->execute());
}
}