mirror of
https://github.com/flarum/framework.git
synced 2025-03-22 13:05:15 +08:00
Add a few more automated tests
This commit is contained in:
parent
f13d45f77b
commit
675627ac15
@ -14,7 +14,5 @@ namespace Flarum\Testing;
|
||||
use Flarum\Extend;
|
||||
|
||||
return [
|
||||
|
||||
|
||||
|
||||
(new Extend\Settings)->serializeToForum('notARealSetting', 'not.a.real.setting')
|
||||
];
|
||||
|
@ -9,11 +9,29 @@
|
||||
|
||||
namespace Flarum\Testing\Tests\integration;
|
||||
|
||||
use Flarum\Extend;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
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
|
||||
*/
|
||||
@ -27,4 +45,46 @@ class TestCaseTest extends TestCase
|
||||
$this->assertEquals('world', $settings->get('hello'));
|
||||
$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());
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user