Skip to content

Commit

Permalink
建立測試環境
Browse files Browse the repository at this point in the history
  • Loading branch information
puckwang committed Jun 4, 2019
1 parent b4b45c7 commit aa377e0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 22 deletions.
6 changes: 6 additions & 0 deletions config/database.php
Expand Up @@ -40,6 +40,12 @@
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],

'testing' => [
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
],

'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
Expand Down
Expand Up @@ -13,7 +13,7 @@ class AddTypeToLoanTable extends Migration
public function up()
{
Schema::table('loans', function ($table) {
$table->unsignedInteger('type')->comment = '類型(0:Equipment,1:RaiseEquipment)';
$table->unsignedInteger('type')->default(0)->comment = '類型(0:Equipment,1:RaiseEquipment)';
});
}

Expand Down
1 change: 1 addition & 0 deletions phpunit.xml
Expand Up @@ -29,5 +29,6 @@
<env name="MAIL_DRIVER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="DB_CONNECTION" value="testing"/>
</php>
</phpunit>
21 changes: 0 additions & 21 deletions tests/Feature/ExampleTest.php

This file was deleted.

8 changes: 8 additions & 0 deletions tests/TestCase.php
Expand Up @@ -2,9 +2,17 @@

namespace Tests;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
use RefreshDatabase;

protected function setUp(): void
{
parent::setUp();
$this->seed();
}
}

0 comments on commit aa377e0

Please sign in to comment.