海工商新版后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

65 lines
1.5 KiB

<?php
namespace Spatie\EloquentSortable\Test;
use Illuminate\Database\Schema\Blueprint;
use Orchestra\Testbench\TestCase as Orchestra;
abstract class TestCase extends Orchestra
{
public function setUp(): void
{
parent::setUp();
$this->setUpDatabase();
}
/**
* @param \Illuminate\Foundation\Application $app
*
* @return array
*/
protected function getPackageProviders($app)
{
return [
];
}
/**
* @param \Illuminate\Foundation\Application $app
*/
protected function getEnvironmentSetUp($app)
{
$app['config']->set('database.default', 'sqlite');
$app['config']->set('database.connections.sqlite', [
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
]);
}
protected function setUpDatabase()
{
$this->app['db']->connection()->getSchemaBuilder()->create('dummies', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('custom_column_sort');
$table->integer('order_column');
});
collect(range(1, 20))->each(function (int $i) {
Dummy::create([
'name' => $i,
'custom_column_sort' => rand(),
]);
});
}
protected function setUpSoftDeletes()
{
$this->app['db']->connection()->getSchemaBuilder()->table('dummies', function (Blueprint $table) {
$table->softDeletes();
});
}
}