Skip to content

Commit dcb54b0

Browse files
committed
workaround for the fact that RefreshDatabase does not handle debugging gt db; pseduo-migrate it...
1 parent 7754658 commit dcb54b0

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

tests/Feature/End2End/Groups/PublishApplicationEventsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private function addPerson()
152152
]);
153153
}
154154

155-
private function addGene($genes = null)
155+
private function addGene()
156156
{
157157
$genes = $this->seedGenes([['hgnc_id' => 678, 'gene_symbol'=>'BCD'], ['hgnc_id' => 12345, 'gene_symbol' => 'ABC1']]);
158158
$action = app()->make(GenesAdd::class);

tests/Traits/SeedsHgncGenesAndDiseases.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,23 @@ private function seedDiseases($diseases = null)
2626

2727
private function getDb()
2828
{
29-
return DB::connection(config('database.gt_db_connection'));
29+
$conn = DB::connection(config('database.gt_db_connection'));
30+
// This is an ugly hack for the fact that RefreshDatabase doesn't work with multiple connections
31+
// The real fix would be to access genetracker only through an API (and to mock it appropriately)
32+
if (!$conn->getSchemaBuilder()->hasTable('genes')) {
33+
$conn->getSchemaBuilder()->create('genes', function($table){
34+
$table->biginteger('hgnc_id');
35+
$table->string('gene_symbol');
36+
});
37+
}
38+
if (!conn->getSchemaBuilder()->hasTable('diseases')) {
39+
$conn->getSchemaBuilder()->create('diseases', function($table){
40+
$table->bigIncrements('id');
41+
$table->string('mondo_id');
42+
$table->string('name');
43+
});
44+
}
45+
return $conn;
3046
}
3147

3248

0 commit comments

Comments
 (0)