Skip to content

Commit c9bf044

Browse files
committed
Tweak handlers, add test for Relations live
1 parent 619eb2b commit c9bf044

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

bin/Schemas.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Schemas extends \Tatter\Schemas\Config\Schemas
1717

1818
// Default handlers used to generate a schema
1919
// (Probably shouldn't change this unless you really know what you're doing)
20-
public $defaultHandlers = ['database', 'model'];
20+
public $defaultHandlers = ['database', 'model', 'file'];
2121

2222
// Whether to ignore the migrations table
2323
public $ignoreMigrationsTable = true;

src/Config/Schemas.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Schemas extends BaseConfig
99

1010
// Default handlers used to generate a schema
1111
// (Probably shouldn't change this unless you really know what you're doing)
12-
public $defaultHandlers = ['database', 'model'];
12+
public $defaultHandlers = ['database', 'model', 'file'];
1313

1414
// Whether to ignore the migrations table
1515
public $ignoreMigrationsTable = true;

tests/service/LiveTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use Tatter\Schemas\Handlers\CacheHandler;
44
use Tatter\Schemas\Handlers\DatabaseHandler;
55
use Tatter\Schemas\Handlers\FileHandler;
6+
use Tatter\Schemas\Handlers\ModelHandler;
67

78
class LiveTest extends CIModuleTests\Support\DatabaseTestCase
89
{
@@ -33,4 +34,17 @@ public function testDatabaseMergeFile()
3334
$this->assertObjectHasAttribute('products', $schema->tables);
3435
$this->assertCount(2, $schema->tables->workers->relations);
3536
}
37+
38+
public function testMergeAllHandlers()
39+
{
40+
$databaseHandler = new DatabaseHandler($this->config, 'tests');
41+
$modelHandler = new ModelHandler($this->config);
42+
$fileHandler = new FileHandler($this->config);
43+
44+
$schema = $this->schemas->import([$databaseHandler, $modelHandler, $fileHandler])->get();
45+
46+
$this->assertObjectHasAttribute('products', $schema->tables);
47+
$this->assertEquals('CIModuleTests\Support\Models\FactoryModel', $schema->tables->factories->model);
48+
$this->assertCount(2, $schema->tables->workers->relations);
49+
}
3650
}

0 commit comments

Comments
 (0)