@@ 23-31 (lines=9) @@ | ||
20 | class SearchableBehaviorTest extends TestCase |
|
21 | { |
|
22 | ||
23 | public function testSync() |
|
24 | { |
|
25 | $model = Model::findOne(1); |
|
26 | $model->article = 'testSync'; |
|
27 | $model->save(false); |
|
28 | ||
29 | $models = Model::search('testSync')->all(); |
|
30 | $this->assertEquals(1, count($models)); |
|
31 | } |
|
32 | ||
33 | public function testUnSync() |
|
34 | { |
|
@@ 33-43 (lines=11) @@ | ||
30 | $this->assertEquals(1, count($models)); |
|
31 | } |
|
32 | ||
33 | public function testUnSync() |
|
34 | { |
|
35 | Model::withoutSyncingToSearch(function () { |
|
36 | $model = Model::findOne(1); |
|
37 | $model->article = 'testUnSync'; |
|
38 | $model->save(false); |
|
39 | ||
40 | $models = Model::search('testUnSync')->all(); |
|
41 | $this->assertEquals(0, count($models)); |
|
42 | }); |
|
43 | } |
|
44 | ||
45 | public function testShouldBeSearchable() |
|
46 | { |
|
@@ 45-54 (lines=10) @@ | ||
42 | }); |
|
43 | } |
|
44 | ||
45 | public function testShouldBeSearchable() |
|
46 | { |
|
47 | $model = Model::findOne(1); |
|
48 | $model->shouldBeSearchable = false; |
|
49 | $model->article = 'testShouldBeSearchable'; |
|
50 | $model->save(false); |
|
51 | ||
52 | $models = Model::search('testShouldBeSearchable')->all(); |
|
53 | $this->assertEquals(0, count($models)); |
|
54 | } |
|
55 | ||
56 | public function testDeleteSync() |
|
57 | { |