Skip to content

Commit

Permalink
run tests without refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
bert-w committed Mar 12, 2024
1 parent 84b922d commit acb68ea
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 30 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ parameters:
count: 1
path: tests/SocialiteTenantLoginTest.php

-
message: "#^Cannot call method run\\(\\) on Illuminate\\\\Testing\\\\PendingCommand\\|int\\.$#"
count: 1
path: tests/TestCase.php

-
message: "#^Parameter \\#1 \\$callback of static method Illuminate\\\\Database\\\\Eloquent\\\\Factories\\\\Factory\\<Illuminate\\\\Database\\\\Eloquent\\\\Model\\>\\:\\:guessFactoryNamesUsing\\(\\) expects callable\\(class\\-string\\<Illuminate\\\\Database\\\\Eloquent\\\\Model\\>\\)\\: class\\-string\\<Illuminate\\\\Database\\\\Eloquent\\\\Factories\\\\Factory\\>, Closure\\(string\\)\\: non\\-falsy\\-string given\\.$#"
count: 1
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<env name="APP_ENV" value="testing"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value="testing"/>
<env name="MAIL_MAILER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
Expand Down
19 changes: 19 additions & 0 deletions tests/Fixtures/change_nullable_password_on_users_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration {
public function up(): void
{
Schema::table('users', static function (Blueprint $table): void {
$table->string('password')->nullable()->change();
});
}

public function down(): void
{
//
}
};
3 changes: 0 additions & 3 deletions tests/SocialiteLoginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use DutchCodingCompany\FilamentSocialite\Facades\FilamentSocialite;
use DutchCodingCompany\FilamentSocialite\Tests\Fixtures\TestSocialiteUser;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Event;
Expand All @@ -19,8 +18,6 @@

class SocialiteLoginTest extends TestCase
{
use RefreshDatabase;

public function testLogin(): void
{
$response = $this
Expand Down
5 changes: 0 additions & 5 deletions tests/SocialiteTenantLoginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@
use DutchCodingCompany\FilamentSocialite\Tests\Fixtures\TestTeam;
use DutchCodingCompany\FilamentSocialite\Tests\Fixtures\TestTenantUser;
use Filament\Facades\Filament;
use Filament\Panel;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Crypt;
use Laravel\Socialite\Contracts\Provider;
use Laravel\Socialite\Facades\Socialite;
use Mockery;

class SocialiteTenantLoginTest extends TestCase
{
use RefreshDatabase;

protected string $userModelClass = TestTenantUser::class;

protected array $tenantArguments = [
Expand Down
17 changes: 0 additions & 17 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,14 @@
use Filament\Panel;
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Encryption\Encrypter;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schema;
use Laravel\Socialite\SocialiteServiceProvider;
use Livewire\LivewireServiceProvider;
use Orchestra\Testbench\TestCase as Orchestra;

class TestCase extends Orchestra
{
use LazilyRefreshDatabase;
use LazilyRefreshDatabase;

protected string $panelName = 'testpanel';

/**
Expand Down Expand Up @@ -97,8 +90,6 @@ protected function registerTestPanel(): void

public function getEnvironmentSetUp($app)
{
config()->set('mysql.driver', ':memory:');

config()->set('app.key', 'base64:'.base64_encode(
Encrypter::generateKey('AES-256-CBC')
));
Expand All @@ -108,19 +99,11 @@ public function getEnvironmentSetUp($app)
'client_secret' => 'defgmockeddefg',
'redirect' => 'http://localhost/oauth/callback/github',
]);

config()->set('database.default', 'testing');
}

protected function defineDatabaseMigrations()
{
$this->loadLaravelMigrations();
$this->loadMigrationsFrom(__DIR__.'/Fixtures');

$this->artisan('migrate', ['--database' => 'testing'])->run();

Schema::table('users', static function (Blueprint $table): void {
$table->string('password')->nullable()->change();
});
}
}

0 comments on commit acb68ea

Please sign in to comment.