generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathTestCase.php
55 lines (48 loc) · 1.46 KB
/
TestCase.php
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
<?php
namespace TimothePearce\TimeSeries\Tests;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Foundation\Application;
use Orchestra\Testbench\TestCase as Orchestra;
use TimothePearce\TimeSeries\TimeSeriesServiceProvider;
class TestCase extends Orchestra
{
public function setUp(): void
{
parent::setUp();
Factory::guessFactoryNamesUsing(
fn (string $modelName) => 'TimothePearce\\TimeSeries\\Tests\\Database\\Factories\\' . class_basename($modelName) . 'Factory'
);
}
protected function getPackageProviders($app)
{
return [
TimeSeriesServiceProvider::class,
];
}
/**
* Define environment setup.
*
* @param Application $app
* @return void
*/
protected function defineEnvironment($app)
{
$app['config']->set('time-series.queue', false);
$app['config']->set('time-series.models_namespace', 'TimothePearce\\TimeSeries\\Tests\\Models');
$app['config']->set('database.default', 'testing');
$app['config']->set('database.connections.testing', [
'driver' => 'sqlite',
'database' => ':memory:',
]);
}
/**
* Define database migrations.
*
* @return void
*/
protected function defineDatabaseMigrations()
{
$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
$this->loadMigrationsFrom(__DIR__ . '/database/migrations');
}
}