mirror of
https://github.com/flarum/core.git
synced 2025-08-06 08:27:42 +02:00
chore: add tests
This commit is contained in:
committed by
Daniël Klabbers
parent
0431f15ac0
commit
899b931b89
@@ -162,6 +162,38 @@ class CreateTest extends TestCase
|
|||||||
$this->assertEquals('wo-shi-yi-ge-tu-dou', $discussion->slug);
|
$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
|
* @test
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user