Skip to content
This repository was archived by the owner on Nov 4, 2021. It is now read-only.

Commit 3319615

Browse files
committed
Made unit tests compatible with the new version
1 parent 5ab154e commit 3319615

File tree

3 files changed

+49
-3
lines changed

3 files changed

+49
-3
lines changed

tests/ConsoleCommandsTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ private function fireCommand($class, array $arguments)
2727
->getMock();
2828
}
2929

30-
$command->fire();
30+
$command->handle();
3131
}
3232

3333
public function test_if_the_create_index_command_builds_correct_response()
@@ -68,6 +68,8 @@ public function test_if_the_create_index_command_builds_correct_response()
6868
$this->fireCommand(ElasticIndexCreateCommand::class, [
6969
'index-configurator' => IndexConfiguratorStub::class
7070
]);
71+
72+
$this->addToAssertionCount(1);
7173
}
7274

7375
public function test_if_the_update_index_command_builds_correct_response()
@@ -126,6 +128,8 @@ public function test_if_the_update_index_command_builds_correct_response()
126128
$this->fireCommand(ElasticIndexUpdateCommand::class, [
127129
'index-configurator' => IndexConfiguratorStub::class
128130
]);
131+
132+
$this->addToAssertionCount(1);
129133
}
130134

131135
public function test_if_the_drop_index_command_builds_correct_response()
@@ -144,6 +148,8 @@ public function test_if_the_drop_index_command_builds_correct_response()
144148
$this->fireCommand(ElasticIndexDropCommand::class, [
145149
'index-configurator' => IndexConfiguratorStub::class
146150
]);
151+
152+
$this->addToAssertionCount(1);
147153
}
148154

149155
public function test_if_the_update_mapping_command_builds_correct_response()
@@ -181,5 +187,7 @@ public function test_if_the_update_mapping_command_builds_correct_response()
181187
$this->fireCommand(ElasticUpdateMappingCommand::class, [
182188
'model' => ModelStub::class
183189
]);
190+
191+
$this->addToAssertionCount(1);
184192
}
185193
}

tests/ElasticEngineTest.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public function test_if_the_update_method_builds_correct_payload()
3939
]);
4040

4141
(new ElasticEngine())->update(Collection::make([$model]));
42+
43+
$this->addToAssertionCount(1);
4244
}
4345

4446
public function test_if_the_delete_method_builds_correct_payload()
@@ -54,6 +56,8 @@ public function test_if_the_delete_method_builds_correct_payload()
5456
$model = $this->mockModel(['id' => 1]);
5557

5658
(new ElasticEngine())->delete(Collection::make([$model]));
59+
60+
$this->addToAssertionCount(1);
5761
}
5862

5963
public function test_if_the_search_method_builds_correct_payload()
@@ -81,6 +85,8 @@ public function test_if_the_search_method_builds_correct_payload()
8185
$builder = new SearchBuilder($model, 'test query');
8286

8387
(new ElasticEngine())->search($builder);
88+
89+
$this->addToAssertionCount(1);
8490
}
8591

8692
public function test_if_the_search_method_with_specified_limit_builds_correct_payload()
@@ -109,6 +115,8 @@ public function test_if_the_search_method_with_specified_limit_builds_correct_pa
109115
$builder = (new SearchBuilder($model, 'test query'))->take(10);
110116

111117
(new ElasticEngine())->search($builder);
118+
119+
$this->addToAssertionCount(1);
112120
}
113121

114122
public function test_if_the_search_method_with_specified_order_builds_correct_payload()
@@ -139,6 +147,8 @@ public function test_if_the_search_method_with_specified_order_builds_correct_pa
139147
$builder = (new SearchBuilder($model, 'test query'))->orderBy('name', 'asc');
140148

141149
(new ElasticEngine())->search($builder);
150+
151+
$this->addToAssertionCount(1);
142152
}
143153

144154
public function test_if_the_search_method_with_specified_where_clause_builds_correct_payload()
@@ -224,6 +234,8 @@ public function test_if_the_search_method_with_specified_where_clause_builds_cor
224234
->where('used', '<>', 'yes');
225235

226236
(new ElasticEngine())->search($builder);
237+
238+
$this->addToAssertionCount(1);
227239
}
228240

229241
public function test_if_the_search_method_with_specified_whereIn_clause_builds_correct_payload()
@@ -262,6 +274,8 @@ public function test_if_the_search_method_with_specified_whereIn_clause_builds_c
262274
$builder = (new SearchBuilder($model, 'test query'))->whereIn('id', [1, 2, 3, 4, 5]);
263275

264276
(new ElasticEngine())->search($builder);
277+
278+
$this->addToAssertionCount(1);
265279
}
266280

267281
public function test_if_the_search_method_with_specified_whereNotIn_clause_builds_correct_payload()
@@ -300,6 +314,8 @@ public function test_if_the_search_method_with_specified_whereNotIn_clause_build
300314
$builder = (new SearchBuilder($model, 'test query'))->whereNotIn('id', [1, 2, 3, 4, 5]);
301315

302316
(new ElasticEngine())->search($builder);
317+
318+
$this->addToAssertionCount(1);
303319
}
304320

305321
public function test_if_the_search_method_with_specified_whereBetween_clause_builds_correct_payload()
@@ -341,6 +357,8 @@ public function test_if_the_search_method_with_specified_whereBetween_clause_bui
341357
$builder = (new SearchBuilder($model, 'test query'))->whereBetween('price', [100, 300]);
342358

343359
(new ElasticEngine())->search($builder);
360+
361+
$this->addToAssertionCount(1);
344362
}
345363

346364
public function test_if_the_search_method_with_specified_whereNotBetween_clause_builds_correct_payload()
@@ -382,6 +400,8 @@ public function test_if_the_search_method_with_specified_whereNotBetween_clause_
382400
$builder = (new SearchBuilder($model, 'test query'))->whereNotBetween('price', [100, 300]);
383401

384402
(new ElasticEngine())->search($builder);
403+
404+
$this->addToAssertionCount(1);
385405
}
386406

387407
public function test_if_the_search_method_with_specified_whereExists_clause_builds_correct_payload()
@@ -420,6 +440,8 @@ public function test_if_the_search_method_with_specified_whereExists_clause_buil
420440
$builder = (new SearchBuilder($model, 'test query'))->whereExists('sale');
421441

422442
(new ElasticEngine())->search($builder);
443+
444+
$this->addToAssertionCount(1);
423445
}
424446

425447
public function test_if_the_search_method_with_specified_whereNotExists_clause_builds_correct_payload()
@@ -458,6 +480,8 @@ public function test_if_the_search_method_with_specified_whereNotExists_clause_b
458480
$builder = (new SearchBuilder($model, 'test query'))->whereNotExists('sale');
459481

460482
(new ElasticEngine())->search($builder);
483+
484+
$this->addToAssertionCount(1);
461485
}
462486

463487
public function test_if_the_search_method_with_specified_whereRegexp_clause_builds_correct_payload()
@@ -499,6 +523,8 @@ public function test_if_the_search_method_with_specified_whereRegexp_clause_buil
499523
$builder = (new SearchBuilder($model, 'phone'))->whereRegexp('brand', 'a[a-z]+', 'ALL');
500524

501525
(new ElasticEngine())->search($builder);
526+
527+
$this->addToAssertionCount(1);
502528
}
503529

504530
public function test_if_the_search_method_with_specified_rule_builds_correct_payload()
@@ -534,6 +560,8 @@ public function test_if_the_search_method_with_specified_rule_builds_correct_pay
534560
});
535561

536562
(new ElasticEngine())->search($builder);
563+
564+
$this->addToAssertionCount(1);
537565
}
538566

539567
public function test_if_the_search_method_with_an_asterisk_builds_correct_payload()
@@ -559,6 +587,8 @@ public function test_if_the_search_method_with_an_asterisk_builds_correct_payloa
559587
$builder = new FilterBuilder($model);
560588

561589
(new ElasticEngine())->search($builder);
590+
591+
$this->addToAssertionCount(1);
562592
}
563593

564594
public function test_if_the_searchRaw_method_builds_correct_payload()
@@ -594,6 +624,8 @@ public function test_if_the_searchRaw_method_builds_correct_payload()
594624
]
595625
]
596626
]);
627+
628+
$this->addToAssertionCount(1);
597629
}
598630

599631
public function test_if_the_paginate_method_builds_correct_payload()
@@ -623,6 +655,8 @@ public function test_if_the_paginate_method_builds_correct_payload()
623655
$builder = new SearchBuilder($model, 'test query');
624656

625657
(new ElasticEngine())->paginate($builder, 8, 3);
658+
659+
$this->addToAssertionCount(1);
626660
}
627661

628662
protected function getElasticSearchResponse()
@@ -733,6 +767,8 @@ public function test_if_the_explain_method_builds_correct_payload()
733767
$builder = new SearchBuilder($model, 'test query');
734768

735769
(new ElasticEngine())->explain($builder);
770+
771+
$this->addToAssertionCount(1);
736772
}
737773

738774
public function test_if_the_profile_method_builds_correct_payload()
@@ -761,5 +797,7 @@ public function test_if_the_profile_method_builds_correct_payload()
761797
$builder = new SearchBuilder($model, 'test query');
762798

763799
(new ElasticEngine())->profile($builder);
800+
801+
$this->addToAssertionCount(1);
764802
}
765803
}

tests/TestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
namespace ScoutElastic\Tests;
44

55
use Mockery;
6-
use PHPUnit_Framework_TestCase;
6+
use PHPUnit\Framework\TestCase as PhpUnitTestCase;
77
use ScoutElastic\Facades\ElasticClient;
88

9-
class TestCase extends PHPUnit_Framework_TestCase
9+
class TestCase extends PhpUnitTestCase
1010
{
1111
public function tearDown()
1212
{

0 commit comments

Comments
 (0)