mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 09:00:55 +08:00
Ensure that migrations run
This commit is contained in:
parent
5febbf8fb1
commit
d68d551e16
@ -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.
|
||||
*/
|
||||
|
@ -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();
|
||||
});
|
@ -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
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user