mirror of
https://github.com/flarum/framework.git
synced 2024-12-04 00:03:37 +08:00
Fix failing tests
This commit is contained in:
parent
51ae92f841
commit
82562294b7
|
@ -76,16 +76,16 @@ class ListDiscussionsControllerTest extends ApiControllerTestCase
|
||||||
*/
|
*/
|
||||||
public function can_search_for_word_in_post()
|
public function can_search_for_word_in_post()
|
||||||
{
|
{
|
||||||
|
$this->database()->table('discussions')->insert([
|
||||||
|
['id' => 2, 'title' => 'lightsail in title', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'comment_count' => 1],
|
||||||
|
['id' => 3, 'title' => 'not in title', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'comment_count' => 1],
|
||||||
|
]);
|
||||||
|
|
||||||
$this->database()->table('posts')->insert([
|
$this->database()->table('posts')->insert([
|
||||||
['id' => 2, 'discussion_id' => 2, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>not in text</p></t>'],
|
['id' => 2, 'discussion_id' => 2, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>not in text</p></t>'],
|
||||||
['id' => 3, 'discussion_id' => 3, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>lightsail in text</p></t>'],
|
['id' => 3, 'discussion_id' => 3, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>lightsail in text</p></t>'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->database()->table('discussions')->insert([
|
|
||||||
['id' => 2, 'title' => 'lightsail in title', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'first_post_id' => 2, 'comment_count' => 1],
|
|
||||||
['id' => 3, 'title' => 'not in title', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'first_post_id' => 3, 'comment_count' => 1],
|
|
||||||
]);
|
|
||||||
|
|
||||||
$response = $this->callWith([], [
|
$response = $this->callWith([], [
|
||||||
'filter' => ['q' => 'lightsail'],
|
'filter' => ['q' => 'lightsail'],
|
||||||
'include' => 'mostRelevantPost'
|
'include' => 'mostRelevantPost'
|
||||||
|
@ -104,16 +104,16 @@ class ListDiscussionsControllerTest extends ApiControllerTestCase
|
||||||
*/
|
*/
|
||||||
public function ignores_non_word_characters_when_searching()
|
public function ignores_non_word_characters_when_searching()
|
||||||
{
|
{
|
||||||
|
$this->database()->table('discussions')->insert([
|
||||||
|
['id' => 2, 'title' => 'lightsail in title', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'comment_count' => 1],
|
||||||
|
['id' => 3, 'title' => 'not in title', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'comment_count' => 1],
|
||||||
|
]);
|
||||||
|
|
||||||
$this->database()->table('posts')->insert([
|
$this->database()->table('posts')->insert([
|
||||||
['id' => 2, 'discussion_id' => 2, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>not in text</p></t>'],
|
['id' => 2, 'discussion_id' => 2, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>not in text</p></t>'],
|
||||||
['id' => 3, 'discussion_id' => 3, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>lightsail in text</p></t>'],
|
['id' => 3, 'discussion_id' => 3, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'type' => 'comment', 'content' => '<t><p>lightsail in text</p></t>'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->database()->table('discussions')->insert([
|
|
||||||
['id' => 2, 'title' => 'lightsail in title', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'first_post_id' => 2, 'comment_count' => 1],
|
|
||||||
['id' => 3, 'title' => 'not in title', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 2, 'first_post_id' => 3, 'comment_count' => 1],
|
|
||||||
]);
|
|
||||||
|
|
||||||
$response = $this->callWith([], [
|
$response = $this->callWith([], [
|
||||||
'filter' => ['q' => 'lightsail+'],
|
'filter' => ['q' => 'lightsail+'],
|
||||||
'include' => 'mostRelevantPost'
|
'include' => 'mostRelevantPost'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user