-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRegisterCommandsTest.php
More file actions
48 lines (37 loc) · 1.22 KB
/
RegisterCommandsTest.php
File metadata and controls
48 lines (37 loc) · 1.22 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
37
38
39
40
41
42
43
44
45
46
47
48
<?php
namespace Rareloop\Hatchet\Test;
use Mockery;
use PHPUnit\Framework\TestCase;
use Rareloop\Hatchet\Commands\Command;
use Rareloop\Hatchet\Hatchet;
use Rareloop\Hatchet\RegisterCommands;
use Rareloop\Lumberjack\Application;
use Rareloop\Lumberjack\Config;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class RegisterCommandsTest extends TestCase
{
use \Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
/** @test */
public function additional_commands_are_registered_from_config()
{
$config = new Config;
$config->set('hatchet.commands', [
AnotherTestCommand::class,
]);
$app = new Application;
$app->bind(Config::class, $config);
$kernal = new Hatchet($app);
$bootstrapper = new RegisterCommands($config);
$bootstrapper->bootstrap($app, $config, $kernal);
$this->assertTrue($kernal->console()->has((new AnotherTestCommand($app))->getName()));
}
}
class AnotherTestCommand extends Command
{
protected function configure()
{
$this->setName('test:command');
}
protected function execute(InputInterface $input, OutputInterface $output): int {}
}