mirror of
https://github.com/flarum/core.git
synced 2025-07-23 17:51:24 +02:00
Ensure that migrations run
This commit is contained in:
@@ -69,6 +69,14 @@ class ExtensionManagerIncludeCurrent extends ExtensionManager
|
|||||||
return $this->extensions;
|
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.
|
* 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\Settings\SettingsRepositoryInterface;
|
||||||
use Flarum\Testing\integration\TestCase;
|
use Flarum\Testing\integration\TestCase;
|
||||||
use Flarum\User\User;
|
use Flarum\User\User;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Schema\Builder;
|
||||||
|
|
||||||
class TestCaseTest extends TestCase
|
class TestCaseTest extends TestCase
|
||||||
{
|
{
|
||||||
@@ -112,6 +114,17 @@ class TestCaseTest extends TestCase
|
|||||||
$this->assertStringContainsString('notARealSetting', $response->getBody()->getContents());
|
$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
|
* @test
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user