Skip to content

Commit a9251b8

Browse files
committed
Add DB init command.
1 parent 8d9ffb3 commit a9251b8

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/TestSuite/DriverSkipTrait.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ trait DriverSkipTrait {
1414
* @param string $message
1515
* @return void
1616
*/
17-
protected function skipIfNotDriver($type, $message) {
17+
protected function skipIfNotDriver(string $type, string $message = '') {
1818
$config = ConnectionManager::getConfig('test');
19-
$this->skipIf(strpos($config['driver'], $type) === false);
19+
$this->skipIf(strpos($config['driver'], $type) === false, $message);
2020
}
2121

2222
/**
2323
* @param string $type
2424
* @param string $message
2525
* @return void
2626
*/
27-
protected function skipIfDriver($type, $message) {
27+
protected function skipIfDriver(string $type, string $message = '') {
2828
$config = ConnectionManager::getConfig('test');
29-
$this->skipIf(strpos($config['driver'], $type) !== false);
29+
$this->skipIf(strpos($config['driver'], $type) !== false, $message);
3030
}
3131

3232
}

tests/TestCase/Command/DbInitCommandTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44

55
use Cake\Console\TestSuite\ConsoleIntegrationTestTrait;
66
use Cake\TestSuite\TestCase;
7+
use Setup\TestSuite\DriverSkipTrait;
78

89
/**
910
* UserUpdate command test
1011
*/
1112
class DbInitCommandTest extends TestCase {
1213

1314
use ConsoleIntegrationTestTrait;
15+
use DriverSkipTrait;
1416

1517
/**
1618
* @return void
@@ -23,6 +25,8 @@ public function setUp(): void {
2325
* @return void
2426
*/
2527
public function testInit() {
28+
$this->skipIfNotDriver('Sqlite');
29+
2630
$this->exec('db init');
2731

2832
$this->assertErrorContains('Using in-memory database, skipping');

0 commit comments

Comments
 (0)