@@ -23,6 +23,20 @@ public function getNgRestPrimaryKey()
23
23
24
24
class IndexTest extends CrawlerTestCase
25
25
{
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
+
26
40
public function testPreview ()
27
41
{
28
42
$ model = new StubIndex ();
@@ -36,9 +50,6 @@ public function testPreview()
36
50
37
51
public function testFlatSearchByQuery ()
38
52
{
39
- $ fixture = new IndexFixture ();
40
- $ fixture ->load ();
41
-
42
53
$ test = Index::flatSearchByQuery ('aaa ' , 'en ' );
43
54
$ this ->assertSame ('aaa ' , $ test [0 ]->title );
44
55
@@ -54,9 +65,6 @@ public function testFlatSearchByQuery()
54
65
55
66
public function testsearchByQuery ()
56
67
{
57
- $ fixture = new IndexFixture ();
58
- $ fixture ->load ();
59
-
60
68
$ test1 = Index::searchByQuery ('aaa ' , 'en ' );
61
69
$ this ->assertSame ('aaa ' , $ test1 [0 ]->title );
62
70
$ test1 = Index::searchByQuery ('AAA ' , 'en ' );
@@ -71,9 +79,6 @@ public function testsearchByQuery()
71
79
72
80
public function testEnhancedSearchByQuery ()
73
81
{
74
- $ fixture = new IndexFixture ();
75
- $ fixture ->load ();
76
-
77
82
$ test1 = Index::searchByQuery ('drink bug ' , 'en ' );
78
83
$ this ->assertSame ('index2 ' , $ test1 [0 ]->title );
79
84
@@ -99,9 +104,6 @@ public function testEnhancedSearchByQuery()
99
104
100
105
public function testEmptySearchs ()
101
106
{
102
- $ fixture = new IndexFixture ();
103
- $ fixture ->load ();
104
-
105
107
$ test1 = Index::searchByQuery ('1 ' , 'en ' );
106
108
$ this ->assertEmpty ($ test1 );
107
109
$ test2 = Index::flatSearchByQuery ('1 ' , 'en ' );
@@ -111,7 +113,6 @@ public function testEmptySearchs()
111
113
public function testSortByUrl ()
112
114
{
113
115
$ test1 = Index::searchByQuery ('item ' , 'en ' );
114
-
115
116
$ this ->assertSame (3 , count ($ test1 ));
116
117
117
118
$ this ->assertSame ('index5/item ' , $ test1 [0 ]->url );
0 commit comments