mirror of
https://github.com/flarum/core.git
synced 2025-07-30 21:20:24 +02:00
fix: slug transliteration assuming the language is always en
(#3387)
* fix: transliteration assuming the language is always `en` * test: transliteration works with forum locale
This commit is contained in:
@@ -133,6 +133,35 @@ class CreateTest extends TestCase
|
||||
$this->assertEquals('test - too-obscure', Arr::get($data, 'data.attributes.title'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function can_create_discussion_with_current_lang_slug_transliteration()
|
||||
{
|
||||
$this->app()->getContainer()->make('flarum.locales')->setLocale('zh');
|
||||
|
||||
$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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user