Skip to content

Commit

Permalink
removed double instance
Browse files Browse the repository at this point in the history
  • Loading branch information
rtschu committed Nov 30, 2020
1 parent a27adcf commit a46a6ff
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions tests/search_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ public function test_discussion_discussion() {

$searchmanager = \core_search\manager::instance();
$searchmanager->index(true);
$search = \core_search\manager::instance();
$results = $search->search((object)['q' => $discussion->name]);
$results = $searchmanager->search((object)['q' => $discussion->name]);
$this->assertEquals(2, count($results));
$this->assertEquals($post1->id, $results[0]->get('itemid'));
$this->assertEquals($post2->id, $results[1]->get('itemid'));
Expand All @@ -71,8 +70,7 @@ public function test_discussion_post() {

$searchmanager = \core_search\manager::instance();
$searchmanager->index(true);
$search = \core_search\manager::instance();
$results = $search->search((object)['q' => $post->message]);
$results = $searchmanager->search((object)['q' => $post->message]);
$this->assertEquals(1, count($results));
$this->assertEquals($post->id, $results[0]->get('itemid'));
}
Expand All @@ -96,8 +94,7 @@ public function test_deleted_discussion() {

$searchmanager = \core_search\manager::instance();
$searchmanager->index(true);
$search = \core_search\manager::instance();
$results = $search->search((object)['q' => $post->message]);
$results = $searchmanager->search((object)['q' => $post->message]);
$this->assertEquals(0, count($results));

$accessmanager = new \mod_moodleoverflow\search\moodleoverflowposts();
Expand Down Expand Up @@ -125,8 +122,7 @@ public function test_deleted_post() {

$searchmanager = \core_search\manager::instance();
$searchmanager->index(true);
$search = \core_search\manager::instance();
$results = $search->search((object)['q' => $post2->message]);
$results = $searchmanager->search((object)['q' => $post2->message]);
$this->assertEquals(0, count($results));

$accessmanager = new \mod_moodleoverflow\search\moodleoverflowposts();
Expand All @@ -151,8 +147,7 @@ public function test_forbidden_discussion() {

$searchmanager = \core_search\manager::instance();
$searchmanager->index(true);
$search = \core_search\manager::instance();
$results = $search->search((object)['q' => $discussion->name]);
$results = $searchmanager->search((object)['q' => $discussion->name]);
$this->assertEquals(0, count($results));
}

Expand All @@ -173,8 +168,7 @@ public function test_forbidden_post() {

$searchmanager = \core_search\manager::instance();
$searchmanager->index(true);
$search = \core_search\manager::instance();
$results = $search->search((object)['q' => $post->message]);
$results = $searchmanager->search((object)['q' => $post->message]);
$this->assertEquals(0, count($results));

$accessmanager = new \mod_moodleoverflow\search\moodleoverflowposts();
Expand Down

0 comments on commit a46a6ff

Please sign in to comment.