4
4
require __DIR__ .'/bootstrap.php ' ;
5
5
6
6
// Prepare the DB
7
- require __DIR__ . ' /tests/BaumTest.php ' ;
8
- BaumTest:: setUpBeforeClass ();
7
+ with ( new CategoryMigrator )-> up () ;
8
+ with ( new ClusterMigrator )-> up ();
9
9
10
10
// Seed the database with some data
11
- ScopedCategory::unguard ();
12
-
13
- $ root1 = ScopedCategory::create (array ('id ' => 1 , 'company_id ' => 1 , 'name ' => 'Root 1 ' , 'lft ' => 1 , 'rgt ' => 10 , 'depth ' => 0 ));
14
- $ child1 = ScopedCategory::create (array ('id ' => 2 , 'company_id ' => 1 , 'name ' => 'Child 1 ' , 'lft ' => 2 , 'rgt ' => 3 , 'depth ' => 1 , 'parent_id ' => 1 ));
15
- $ child2 = ScopedCategory::create (array ('id ' => 3 , 'company_id ' => 1 , 'name ' => 'Child 2 ' , 'lft ' => 4 , 'rgt ' => 7 , 'depth ' => 1 , 'parent_id ' => 1 ));
16
- $ child21 = ScopedCategory::create (array ('id ' => 4 , 'company_id ' => 1 , 'name ' => 'Child 2.1 ' , 'lft ' => 5 , 'rgt ' => 6 , 'depth ' => 2 , 'parent_id ' => 3 ));
17
- $ child3 = ScopedCategory::create (array ('id ' => 5 , 'company_id ' => 1 , 'name ' => 'Child 3 ' , 'lft ' => 8 , 'rgt ' => 9 , 'depth ' => 1 , 'parent_id ' => 1 ));
18
- $ root2 = ScopedCategory::create (array ('id ' => 6 , 'company_id ' => 2 , 'name ' => 'Root 2 ' , 'lft ' => 1 , 'rgt ' => 10 , 'depth ' => 0 ));
19
- $ child4 = ScopedCategory::create (array ('id ' => 7 , 'company_id ' => 2 , 'name ' => 'Child 4 ' , 'lft ' => 2 , 'rgt ' => 3 , 'depth ' => 1 , 'parent_id ' => 6 ));
20
- $ child5 = ScopedCategory::create (array ('id ' => 8 , 'company_id ' => 2 , 'name ' => 'Child 5 ' , 'lft ' => 4 , 'rgt ' => 7 , 'depth ' => 1 , 'parent_id ' => 6 ));
21
- $ child51 = ScopedCategory::create (array ('id ' => 9 , 'company_id ' => 2 , 'name ' => 'Child 5.1 ' , 'lft ' => 5 , 'rgt ' => 6 , 'depth ' => 2 , 'parent_id ' => 8 ));
22
- $ child6 = ScopedCategory::create (array ('id ' => 10 , 'company_id ' => 2 , 'name ' => 'Child 6 ' , 'lft ' => 8 , 'rgt ' => 9 , 'depth ' => 1 , 'parent_id ' => 6 ));
23
-
24
- ScopedCategory::reguard ();
25
-
26
- $ connection = $ root1 ->getConnection ();
27
-
28
- if ( $ connection ->getDriverName () === 'pgsql ' ) {
29
- $ tablePrefix = $ connection ->getTablePrefix ();
30
-
31
- $ sequenceName = $ tablePrefix . 'categories_id_seq ' ;
32
-
33
- $ connection ->statement ('ALTER SEQUENCE ' . $ sequenceName . ' RESTART WITH 11 ' );
34
- }
11
+ // ...
35
12
36
13
// Set up a custom inspector for our models
37
14
class BaumNodeInspector extends \Boris \ColoredInspector {
@@ -43,7 +20,8 @@ class BaumNodeInspector extends \Boris\ColoredInspector {
43
20
}
44
21
}
45
22
46
- // Start-up boris REPL and import our nodes into the context
23
+ // Start-up boris REPL and import any defined var (in scope) which happens to be
24
+ // a Baum\Node instance into the context
47
25
$ boris = new \Boris \Boris ('> ' );
48
26
49
27
$ boris ->setInspector (new BaumNodeInspector );
0 commit comments