1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace LarsJanssen\IncrementDecrement\Test; |
4
|
|
|
|
5
|
|
|
use Illuminate\Database\Schema\Blueprint; |
6
|
|
|
use Orchestra\Testbench\TestCase as Orchestra; |
7
|
|
|
|
8
|
|
|
abstract class TestCase extends Orchestra |
9
|
|
|
{ |
10
|
|
|
public $order; |
11
|
|
|
|
12
|
|
|
public function setUp() |
13
|
|
|
{ |
14
|
|
|
parent::setUp(); |
15
|
|
|
$this->setUpDatabase($this->app); |
16
|
|
|
$this->order = $this->app->make('order'); |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @param \Illuminate\Foundation\Application $app |
21
|
|
|
* |
22
|
|
|
* @return array |
23
|
|
|
*/ |
24
|
|
|
protected function getPackageProviders($app) |
25
|
|
|
{ |
26
|
|
|
return [ |
27
|
|
|
\LarsJanssen\IncrementDecrement\IncrementDecrementServiceProvider::class, |
28
|
|
|
]; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @param \Illuminate\Foundation\Application $app |
33
|
|
|
*/ |
34
|
|
|
protected function getEnvironmentSetUp($app) |
35
|
|
|
{ |
36
|
|
|
$app['config']->set('database.default', 'sqlite'); |
37
|
|
|
$app['config']->set('database.connections.sqlite', [ |
38
|
|
|
'driver' => 'sqlite', |
39
|
|
|
'database' => ':memory:', |
40
|
|
|
'prefix' => '', |
41
|
|
|
]); |
42
|
|
|
|
43
|
|
|
$app['config']->set('app.key', '6rE9Nz59bGRbeMATftriyQjrpF7DcOQm'); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @param \Illuminate\Foundation\Application $app |
48
|
|
|
*/ |
49
|
|
|
protected function setUpDatabase($app) |
50
|
|
|
{ |
51
|
|
|
$app['db']->connection()->getSchemaBuilder()->create('forum', function (Blueprint $table) { |
52
|
|
|
$table->increments('id'); |
53
|
|
|
$table->string('name'); |
54
|
|
|
$table->integer('order'); |
55
|
|
|
$table->rememberToken(); |
56
|
|
|
$table->timestamps(); |
57
|
|
|
}); |
58
|
|
|
|
59
|
|
|
TestModel::create(['name' => 'food', 'order' => 1]); |
60
|
|
|
TestModel::create(['name' => 'work', 'order' => 2]); |
61
|
|
|
TestModel::create(['name' => 'children', 'order' => 3]); |
62
|
|
|
TestModel::create(['name' => 'ict', 'order' => 4]); |
63
|
|
|
TestModel::create(['name' => 'people', 'order' => 5]); |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|