mirror of
https://github.com/flarum/core.git
synced 2025-08-03 06:57:54 +02:00
Add a few more automated tests
This commit is contained in:
@@ -14,7 +14,5 @@ namespace Flarum\Testing;
|
|||||||
use Flarum\Extend;
|
use Flarum\Extend;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
(new Extend\Settings)->serializeToForum('notARealSetting', 'not.a.real.setting')
|
||||||
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@@ -9,11 +9,29 @@
|
|||||||
|
|
||||||
namespace Flarum\Testing\Tests\integration;
|
namespace Flarum\Testing\Tests\integration;
|
||||||
|
|
||||||
|
use Flarum\Extend;
|
||||||
use Flarum\Settings\SettingsRepositoryInterface;
|
use Flarum\Settings\SettingsRepositoryInterface;
|
||||||
use Flarum\Testing\integration\TestCase;
|
use Flarum\Testing\integration\TestCase;
|
||||||
|
use Flarum\User\User;
|
||||||
|
|
||||||
class TestCaseTest extends TestCase
|
class TestCaseTest extends TestCase
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function admin_user_created_as_part_of_default_state()
|
||||||
|
{
|
||||||
|
$this->app();
|
||||||
|
|
||||||
|
$this->assertEquals(1, User::query()->count());
|
||||||
|
|
||||||
|
$user = User::find(1);
|
||||||
|
|
||||||
|
$this->assertEquals('admin', $user->username);
|
||||||
|
$this->assertEquals('admin@machine.local', $user->email);
|
||||||
|
$this->assertTrue($user->isAdmin());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
@@ -27,4 +45,46 @@ class TestCaseTest extends TestCase
|
|||||||
$this->assertEquals('world', $settings->get('hello'));
|
$this->assertEquals('world', $settings->get('hello'));
|
||||||
$this->assertEquals('something_other_than_username', $settings->get('display_name_driver'));
|
$this->assertEquals('something_other_than_username', $settings->get('display_name_driver'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function current_extension_not_applied_by_default()
|
||||||
|
{
|
||||||
|
$response = $this->send(
|
||||||
|
$this->request('GET', '/')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertStringNotContainsString('notARealSetting', $response->getBody()->getContents());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function current_extension_applied_if_specified()
|
||||||
|
{
|
||||||
|
$this->extension('flarum-testing-tests');
|
||||||
|
|
||||||
|
$response = $this->send(
|
||||||
|
$this->request('GET', '/')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertStringContainsString('notARealSetting', $response->getBody()->getContents());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function can_apply_extenders()
|
||||||
|
{
|
||||||
|
$this->extend(
|
||||||
|
(new Extend\Settings)->serializeToForum('notARealSetting', 'not.a.real.setting')
|
||||||
|
);
|
||||||
|
|
||||||
|
$response = $this->send(
|
||||||
|
$this->request('GET', '/')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertStringContainsString('notARealSetting', $response->getBody()->getContents());
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user