Skip to content

Commit 3dadccc

Browse files
Merge pull request #31 from pmatseykanets/support-laravel6
Support Laravel 6
2 parents 104fa78 + b373a25 commit 3dadccc

File tree

8 files changed

+35
-90
lines changed

8 files changed

+35
-90
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/vendor
2-
composer.lock
2+
.phpunit.result.cache
3+
composer.lock

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: php
22

33
php:
4-
- 7.1
54
- 7.2
65
- 7.3
76

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [6.0.0](https://github.com/pmatseykanets/laravel-scout-postgres/releases/tag/v6.0.0) - 2019-09-19
4+
5+
### Added
6+
7+
- Added support for Laravel 6
8+
39
## [5.0.0](https://github.com/pmatseykanets/laravel-scout-postgres/releases/tag/v5.0.0) - 2019-03-13
410

511
### Added

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
}
2424
],
2525
"require": {
26-
"php": ">=7.0",
27-
"illuminate/contracts": "~5.4",
28-
"illuminate/database": "~5.4",
29-
"illuminate/support": "~5.4",
26+
"php": "^7.2",
27+
"illuminate/contracts": "~5.4|~6.0",
28+
"illuminate/database": "~5.4|~6.0",
29+
"illuminate/support": "~5.4|~6.0",
3030
"laravel/scout": "~7.0"
3131
},
3232
"require-dev": {
33-
"phpunit/phpunit": "~6.0",
34-
"mockery/mockery": "~1.0"
33+
"phpunit/phpunit": "^8.3",
34+
"mockery/mockery": "^1.2.3"
3535
},
3636
"autoload": {
3737
"psr-4": {

src/PostgresEngine.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace ScoutEngines\Postgres;
44

55
use Laravel\Scout\Builder;
6+
use Illuminate\Support\Arr;
67
use Laravel\Scout\Engines\Engine;
78
use Illuminate\Database\Eloquent\Model;
89
use Illuminate\Database\Eloquent\Collection;
@@ -200,7 +201,7 @@ public function getTotalCount($results)
200201
return 0;
201202
}
202203

203-
return (int) array_first($results)
204+
return (int) Arr::first($results)
204205
->total_count;
205206
}
206207

@@ -497,7 +498,7 @@ protected function option(Model $model, $key, $default = null)
497498

498499
$options = $model->searchableOptions() ?: [];
499500

500-
return array_get($options, $key, $default);
501+
return Arr::get($options, $key, $default);
501502
}
502503

503504
/**
@@ -509,7 +510,7 @@ protected function option(Model $model, $key, $default = null)
509510
*/
510511
protected function config($key, $default = null)
511512
{
512-
return array_get($this->config, $key, $default);
513+
return Arr::get($this->config, $key, $default);
513514
}
514515

515516
/**

tests/PostgresEngineServiceProviderTest.php

Lines changed: 0 additions & 62 deletions
This file was deleted.

tests/PostgresEngineTest.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ class PostgresEngineTest extends TestCase
1515
{
1616
public function test_it_can_be_instantiated()
1717
{
18-
list($engine) = $this->getEngine();
18+
[$engine] = $this->getEngine();
1919

2020
$this->assertInstanceOf(PostgresEngine::class, $engine);
2121
}
2222

2323
public function test_update_adds_object_to_index()
2424
{
25-
list($engine, $db) = $this->getEngine();
25+
[$engine, $db] = $this->getEngine();
2626

2727
$db->shouldReceive('query')
2828
->andReturn($query = Mockery::mock('stdClass'));
@@ -50,14 +50,14 @@ public function test_update_adds_object_to_index()
5050

5151
public function test_update_do_nothing_if_index_maintenance_turned_off_globally()
5252
{
53-
list($engine) = $this->getEngine(['maintain_index' => false]);
53+
[$engine] = $this->getEngine(['maintain_index' => false]);
5454

5555
$engine->update(Collection::make([new TestModel()]));
5656
}
5757

5858
public function test_delete_removes_object_from_index()
5959
{
60-
list($engine, $db) = $this->getEngine();
60+
[$engine, $db] = $this->getEngine();
6161

6262
$db->shouldReceive('table')
6363
->andReturn($table = Mockery::mock('stdClass'));
@@ -72,7 +72,7 @@ public function test_delete_removes_object_from_index()
7272

7373
public function test_delete_do_nothing_if_index_maintenance_turned_off_globally()
7474
{
75-
list($engine, $db) = $this->getEngine(['maintain_index' => false]);
75+
[$engine, $db] = $this->getEngine(['maintain_index' => false]);
7676

7777
$db->shouldNotReceive('table');
7878

@@ -81,7 +81,7 @@ public function test_delete_do_nothing_if_index_maintenance_turned_off_globally(
8181

8282
public function test_flush_removes_all_objects_from_index()
8383
{
84-
list($engine, $db) = $this->getEngine();
84+
[$engine, $db] = $this->getEngine();
8585

8686
$db->shouldReceive('table')
8787
->once()
@@ -95,7 +95,7 @@ public function test_flush_removes_all_objects_from_index()
9595

9696
public function test_flush_does_nothing_if_index_maintenance_turned_off_globally()
9797
{
98-
list($engine, $db) = $this->getEngine(['maintain_index' => false]);
98+
[$engine, $db] = $this->getEngine(['maintain_index' => false]);
9999

100100
$db->shouldNotReceive('table');
101101

@@ -104,7 +104,7 @@ public function test_flush_does_nothing_if_index_maintenance_turned_off_globally
104104

105105
public function test_search()
106106
{
107-
list($engine, $db) = $this->getEngine();
107+
[$engine, $db] = $this->getEngine();
108108

109109
$skip = 0;
110110
$limit = 5;
@@ -129,7 +129,7 @@ public function test_search()
129129

130130
public function test_search_with_order_by()
131131
{
132-
list($engine, $db) = $this->getEngine();
132+
[$engine, $db] = $this->getEngine();
133133

134134
$table = $this->setDbExpectations($db, false);
135135

@@ -149,7 +149,7 @@ public function test_search_with_order_by()
149149

150150
public function test_search_with_global_config()
151151
{
152-
list($engine, $db) = $this->getEngine(['config' => 'simple']);
152+
[$engine, $db] = $this->getEngine(['config' => 'simple']);
153153

154154
$skip = 0;
155155
$limit = 5;
@@ -170,7 +170,7 @@ public function test_search_with_global_config()
170170

171171
public function test_search_with_model_config()
172172
{
173-
list($engine, $db) = $this->getEngine(['config' => 'simple']);
173+
[$engine, $db] = $this->getEngine(['config' => 'simple']);
174174

175175
$skip = 0;
176176
$limit = 5;
@@ -194,7 +194,7 @@ public function test_search_with_model_config()
194194

195195
public function test_search_with_soft_deletes()
196196
{
197-
list($engine, $db) = $this->getEngine();
197+
[$engine, $db] = $this->getEngine();
198198

199199
$table = $this->setDbExpectations($db);
200200

@@ -214,7 +214,7 @@ public function test_search_with_soft_deletes()
214214

215215
public function test_maps_results_to_models()
216216
{
217-
list($engine) = $this->getEngine();
217+
[$engine] = $this->getEngine();
218218

219219
$model = Mockery::mock('StdClass');
220220
$model->shouldReceive('getKeyName')->andReturn('id');
@@ -232,7 +232,7 @@ public function test_maps_results_to_models()
232232

233233
public function test_map_filters_out_no_longer_existing_models()
234234
{
235-
list($engine) = $this->getEngine();
235+
[$engine] = $this->getEngine();
236236

237237
$model = Mockery::mock('StdClass');
238238
$model->shouldReceive('getKeyName')->andReturn('id');
@@ -255,7 +255,7 @@ public function test_map_filters_out_no_longer_existing_models()
255255

256256
public function test_it_returns_total_count()
257257
{
258-
list($engine) = $this->getEngine();
258+
[$engine] = $this->getEngine();
259259

260260
$count = $engine->getTotalCount(
261261
json_decode('[{"id": 1, "tsrank": 0.33, "total_count": 100}]')
@@ -266,7 +266,7 @@ public function test_it_returns_total_count()
266266

267267
public function test_map_ids_returns_right_key()
268268
{
269-
list($engine, $db) = $this->getEngine();
269+
[$engine, $db] = $this->getEngine();
270270

271271
$table = $this->setDbExpectations($db);
272272
$table->shouldReceive('getBindings')->andReturn([null, 'foo']);

tests/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
abstract class TestCase extends BaseTestCase
99
{
10-
public function tearDown()
10+
public function tearDown(): void
1111
{
1212
// Prevent PHPUnit complaining about risky tests
1313
// because Mockery expectations are not counted towards assertions

0 commit comments

Comments
 (0)