Ensure that migrations run

This commit is contained in:
Alexander Skvortsov 2021-05-11 17:15:11 -04:00
parent 5febbf8fb1
commit d68d551e16
3 changed files with 31 additions and 0 deletions

View File

@ -69,6 +69,14 @@ class ExtensionManagerIncludeCurrent extends ExtensionManager
return $this->extensions;
}
/**
* Since we enable every time, we always assume it's not enabled.
*/
public function isEnabled($extension)
{
return false;
}
/**
* In test cases, enabled extensions are determined by the test case, not the database.
*/

View File

@ -0,0 +1,10 @@
<?php
namespace Flarum\Testing;
use Flarum\Database\Migration;
use Illuminate\Database\Schema\Blueprint;
return Migration::createTable('testing_table', function (Blueprint $table) {
$table->string('id', 100)->primary();
});

View File

@ -14,6 +14,8 @@ use Flarum\Foundation\Config;
use Flarum\Settings\SettingsRepositoryInterface;
use Flarum\Testing\integration\TestCase;
use Flarum\User\User;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\Builder;
class TestCaseTest extends TestCase
{
@ -112,6 +114,17 @@ class TestCaseTest extends TestCase
$this->assertStringContainsString('notARealSetting', $response->getBody()->getContents());
}
/**
* @test
*/
public function current_extension_migrations_applied_if_specified()
{
$this->extension('flarum-testing-tests');
$tableExists = $this->app()->getContainer()->make(Builder::class)->hasTable('testing_table');
$this->assertTrue($tableExists);
}
/**
* @test
*/