| 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 |  |  |      * @param \Illuminate\Foundation\Application $app | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  |      * @return array | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |     protected function getPackageProviders($app) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |         return [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |             \LarsJanssen\IncrementDecrement\IncrementDecrementServiceProvider::class, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |         ]; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 28 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  |      * @param \Illuminate\Foundation\Application $app | 
            
                                                                        
                            
            
                                    
            
            
                | 31 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     protected function getEnvironmentSetUp($app) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |         $app['config']->set('database.default', 'sqlite'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         $app['config']->set('database.connections.sqlite', [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |             'driver' => 'sqlite', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |             'database' => ':memory:', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |             'prefix' => '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |         ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         $app['config']->set('app.key', '6rE9Nz59bGRbeMATftriyQjrpF7DcOQm'); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 42 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 43 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  |      * @param \Illuminate\Foundation\Application $app | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     protected function setUpDatabase($app) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         $app['db']->connection()->getSchemaBuilder()->create('forum', function (Blueprint $table) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |             $table->increments('id'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |             $table->string('name'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |             $table->integer('order'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |             $table->rememberToken(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |             $table->timestamps(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |         TestModel::create(['name' => 'food',        'order' => 1]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         TestModel::create(['name' => 'work',        'order' => 2]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         TestModel::create(['name' => 'children',    'order' => 3]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         TestModel::create(['name' => 'ict',         'order' => 4]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |         TestModel::create(['name' => 'people',      'order' => 5]); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 61 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 62 |  |  | } |