Skip to content

Commit 7bc5d18

Browse files
committed
fixed crawler tests
1 parent 255dc22 commit 7bc5d18

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

modules/crawler/tests/models/IndexTest.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@ public function getNgRestPrimaryKey()
2323

2424
class IndexTest extends CrawlerTestCase
2525
{
26+
public $fixture;
27+
28+
public function setUp()
29+
{
30+
parent::setUp();
31+
$this->fixture = new IndexFixture();
32+
$this->fixture->load();
33+
}
34+
35+
public function tearDown()
36+
{
37+
$this->fixture->unload();
38+
}
39+
2640
public function testPreview()
2741
{
2842
$model = new StubIndex();
@@ -36,9 +50,6 @@ public function testPreview()
3650

3751
public function testFlatSearchByQuery()
3852
{
39-
$fixture = new IndexFixture();
40-
$fixture->load();
41-
4253
$test = Index::flatSearchByQuery('aaa', 'en');
4354
$this->assertSame('aaa', $test[0]->title);
4455

@@ -54,9 +65,6 @@ public function testFlatSearchByQuery()
5465

5566
public function testsearchByQuery()
5667
{
57-
$fixture = new IndexFixture();
58-
$fixture->load();
59-
6068
$test1 = Index::searchByQuery('aaa', 'en');
6169
$this->assertSame('aaa', $test1[0]->title);
6270
$test1 = Index::searchByQuery('AAA', 'en');
@@ -71,9 +79,6 @@ public function testsearchByQuery()
7179

7280
public function testEnhancedSearchByQuery()
7381
{
74-
$fixture = new IndexFixture();
75-
$fixture->load();
76-
7782
$test1 = Index::searchByQuery('drink bug', 'en');
7883
$this->assertSame('index2', $test1[0]->title);
7984

@@ -99,9 +104,6 @@ public function testEnhancedSearchByQuery()
99104

100105
public function testEmptySearchs()
101106
{
102-
$fixture = new IndexFixture();
103-
$fixture->load();
104-
105107
$test1 = Index::searchByQuery('1', 'en');
106108
$this->assertEmpty($test1);
107109
$test2 = Index::flatSearchByQuery('1', 'en');
@@ -111,7 +113,6 @@ public function testEmptySearchs()
111113
public function testSortByUrl()
112114
{
113115
$test1 = Index::searchByQuery('item', 'en');
114-
115116
$this->assertSame(3, count($test1));
116117

117118
$this->assertSame('index5/item', $test1[0]->url);

0 commit comments

Comments
 (0)