Skip to content

Commit c80a6ef

Browse files
authored
Add a way for JobExecution storage to be setup before used (#107)
* Add a way for JobExecution storage to be setup before used * Fixed code style * Test DoctrineDBALJobExecutionStorage::createSchema deprecated method * Fixed wrong usage of magic constants * Removed deprecation test * Proper test without deprecation
1 parent d9ca054 commit c80a6ef

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"php": "^8.0",
1515
"composer-runtime-api": "^2.0",
1616
"symfony/config": "^5.0|^6.0",
17+
"symfony/console": "^5.0|^6.0",
1718
"symfony/dependency-injection": "^5.0|^6.0",
1819
"symfony/http-kernel": "^5.0|^6.0",
1920
"symfony/framework-bundle": "^5.0|^6.0",

src/Resources/services/symfony/console/command.xml

+6
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,11 @@
1313
<argument type="service" id="yokai_batch.job_executor"/>
1414
<tag name="console.command"/>
1515
</service>
16+
17+
<service id="yokai_batch.cli.setup_storage_command"
18+
class="Yokai\Batch\Bridge\Symfony\Console\SetupStorageCommand">
19+
<argument type="service" id="Yokai\Batch\Storage\JobExecutionStorageInterface"/>
20+
<tag name="console.command"/>
21+
</service>
1622
</services>
1723
</container>

tests/CliTest.php

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Yokai\Batch\Tests\Bridge\Symfony\Framework;
6+
7+
use Symfony\Bundle\FrameworkBundle\Console\Application;
8+
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
9+
10+
final class CliTest extends KernelTestCase
11+
{
12+
public function testRegisteredCommands(): void
13+
{
14+
$names = \array_keys(
15+
(new Application(self::bootKernel()))->all('yokai'),
16+
);
17+
\sort($names);
18+
self::assertSame(
19+
[
20+
'yokai:batch:run',
21+
'yokai:batch:setup-storage',
22+
],
23+
$names,
24+
);
25+
}
26+
}

0 commit comments

Comments
 (0)