generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTestCase.php
44 lines (36 loc) · 1.15 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
<?php
namespace Vanthao03596\LaravelCursorPaginate\Tests;
use Illuminate\Database\Schema\Blueprint;
use Orchestra\Testbench\TestCase as Orchestra;
use Vanthao03596\LaravelCursorPaginate\LaravelCursorPaginateServiceProvider;
class TestCase extends Orchestra
{
public function setUp(): void
{
parent::setUp();
$this->setUpDatabase($this->app);
}
protected function getPackageProviders($app)
{
return [
LaravelCursorPaginateServiceProvider::class,
];
}
public function getEnvironmentSetUp($app)
{
config()->set('database.default', 'testing');
}
protected function setUpDatabase($app)
{
$app['db']->connection()->getSchemaBuilder()->create('test_posts', function (Blueprint $table) {
$table->increments('id');
$table->string('title')->nullable();
$table->unsignedInteger('user_id')->nullable();
$table->timestamps();
});
$app['db']->connection()->getSchemaBuilder()->create('test_users', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
});
}
}