-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathMeilisearchDeleteCommandTest.php
67 lines (51 loc) · 1.74 KB
/
MeilisearchDeleteCommandTest.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
declare(strict_types=1);
namespace Meilisearch\Bundle\Tests\Integration\Command;
use Meilisearch\Bundle\Tests\BaseKernelTestCase;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
final class MeilisearchDeleteCommandTest extends BaseKernelTestCase
{
protected Application $application;
protected function setUp(): void
{
parent::setUp();
$this->application = new Application(self::createKernel());
}
public function testDeleteWithoutIndices(): void
{
$clearCommand = $this->application->find('meilisearch:delete');
$clearCommandTester = new CommandTester($clearCommand);
$clearCommandTester->execute([]);
$clearOutput = $clearCommandTester->getDisplay();
$this->assertSame(<<<'EOD'
Deleted sf_phpunit__posts
Deleted sf_phpunit__comments
Deleted sf_phpunit__aggregated
Deleted sf_phpunit__tags
Deleted sf_phpunit__discriminator_map
Deleted sf_phpunit__pages
Deleted sf_phpunit__self_normalizable
Deleted sf_phpunit__dummy_custom_groups
Deleted sf_phpunit__dynamic_settings
Deleted sf_phpunit__tickets
Done!
EOD, $clearOutput);
}
public function testDeleteWithIndices(): void
{
$clearCommand = $this->application->find('meilisearch:delete');
$clearCommandTester = new CommandTester($clearCommand);
$clearCommandTester->execute(['--indices' => 'posts']);
$clearOutput = $clearCommandTester->getDisplay();
$this->assertSame(<<<'EOD'
Deleted sf_phpunit__posts
Done!
EOD, $clearOutput);
}
public function testAlias(): void
{
$command = $this->application->find('meilisearch:delete');
self::assertSame(['meili:delete'], $command->getAliases());
}
}