diff --git a/php-packages/testing/tests/extend.php b/php-packages/testing/tests/extend.php index 8ece8c036..075d35db5 100644 --- a/php-packages/testing/tests/extend.php +++ b/php-packages/testing/tests/extend.php @@ -14,7 +14,5 @@ namespace Flarum\Testing; use Flarum\Extend; return [ - - - + (new Extend\Settings)->serializeToForum('notARealSetting', 'not.a.real.setting') ]; diff --git a/php-packages/testing/tests/tests/integration/TestCaseTest.php b/php-packages/testing/tests/tests/integration/TestCaseTest.php index 4aa709da1..374cd5db3 100644 --- a/php-packages/testing/tests/tests/integration/TestCaseTest.php +++ b/php-packages/testing/tests/tests/integration/TestCaseTest.php @@ -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()); + } } \ No newline at end of file