1
0
mirror of https://github.com/flarum/core.git synced 2025-08-05 16:07:34 +02:00

chore: add tests

This commit is contained in:
Daniël Klabbers
2022-05-13 15:11:26 +02:00
committed by Daniël Klabbers
parent 0431f15ac0
commit 899b931b89

View File

@@ -162,6 +162,38 @@ class CreateTest extends TestCase
$this->assertEquals('wo-shi-yi-ge-tu-dou', $discussion->slug);
}
/**
* @test
*/
public function can_create_discussion_with_forum_locale_transliteration()
{
// Forum default is traditional Chinese.
$this->app()->getContainer()->make('flarum.settings')->set('default_locale', 'zh');
// Actor locale is English
$this->app()->getContainer()->make('flarum.locales')->setLocale('en');
$response = $this->send(
$this->request('POST', '/api/discussions', [
'authenticatedAs' => 1,
'json' => [
'data' => [
'attributes' => [
'title' => '我是一个土豆',
'content' => 'predetermined content for automated testing',
],
]
],
])
);
$this->assertEquals(201, $response->getStatusCode());
/** @var Discussion $discussion */
$discussion = Discussion::firstOrFail();
$this->assertEquals('wo-shi-yi-ge-tu-dou', $discussion->slug);
}
/**
* @test
*/