Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tjardoo committed Feb 24, 2024
1 parent 4614ca0 commit 3c79d26
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace Label84\MailViewer\Tests;

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Schema;
use Label84\MailViewer\MailViewerServiceProvider;

class TestCase extends \Orchestra\Testbench\TestCase
Expand All @@ -13,7 +15,7 @@ public function setUp(): void
{
parent::setUp();

$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
$this->setUpDatabase();
}

protected function getPackageProviders($app): array
Expand All @@ -25,8 +27,31 @@ protected function getPackageProviders($app): array

protected function getEnvironmentSetUp($app): void
{
include_once __DIR__.'/../database/migrations/create_mail_viewer_items_table.php.stub';
config()->set('mailviewer.database_connection', 'sqlite');
config()->set('database.default', 'sqlite');
config()->set('database.connections.sqlite', [
'driver' => 'sqlite',
'database' => ':memory:',
]);
}

protected function setUpDatabase()
{
Schema::create(config('mailviewer.table_name'), function (Blueprint $table) {
$table->uuid('uuid')->primary();

$table->string('event_type');
$table->string('mailer');

$table->text('headers')->nullable();
$table->text('recipients');

$table->string('notification')->nullable();

$table->string('subject')->nullable();
$table->text('body')->nullable();

(new \CreateMailViewerItemsTable())->up();
$table->string('sent_at');
});
}
}

0 comments on commit 3c79d26

Please sign in to comment.