-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathTestCase.php
More file actions
60 lines (54 loc) · 2.1 KB
/
TestCase.php
File metadata and controls
60 lines (54 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
namespace Libsql\Laravel\Tests;
use Libsql\Laravel\LibsqlServiceProvider;
use Orchestra\Testbench\TestCase as Orchestra;
use Illuminate\Database\Eloquent\Factories\Factory;
class TestCase extends Orchestra
{
protected function setUp(): void
{
parent::setUp();
Factory::guessFactoryNamesUsing(
fn (string $modelName) => 'Libsql\\Laravel\\Tests\\Fixtures\\Factories\\' . class_basename($modelName) . 'Factory'
);
}
protected function getPackageProviders($app)
{
return [
LibsqlServiceProvider::class,
];
}
public function getEnvironmentSetUp($app)
{
config()->set('database.connections', [
// In-Memory Connection
'libsql' => [
'driver' => 'libsql',
'url' => '',
'password' => '',
'database' => ':memory:',
'prefix' => '',
],
// Remote Connection
'otherdb' => [
'driver' => 'libsql',
'database' => '',
'prefix' => '',
'url' => 'http://127.0.0.1:8081',
// Replace the token with yours
'password' => 'eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSJ9.eyJpYXQiOjE3MzY2MzU1MTUsIm5iZiI6MTczNjYzNTUxNSwiZXhwIjoxNzM3MjQwMzE1LCJqdGkiOiJkYjEifQ.5sm4FN4PosAJ5h9wLay6q3ryAxbGRGuETU1A3F_Tr3WXpAEnr98tmAa92qcpZz_YZN0T_h4RqjGlEMgrSwIJAQ',
],
// Embedded Replica
'otherdb2' => [
'driver' => 'libsql',
'database' => test_database_path('otherdb2.db'),
'prefix' => '',
'url' => 'http://127.0.0.1:8081',
// Replace the token with yours
'password' => 'eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSJ9.eyJpYXQiOjE3MzY2MzU1MTUsIm5iZiI6MTczNjYzNTUxNSwiZXhwIjoxNzM3MjQwMzE1LCJqdGkiOiJkYjEifQ.5sm4FN4PosAJ5h9wLay6q3ryAxbGRGuETU1A3F_Tr3WXpAEnr98tmAa92qcpZz_YZN0T_h4RqjGlEMgrSwIJAQ',
],
]);
config()->set('database.default', 'libsql');
config()->set('queue.default', 'sync');
}
}