Skip to content

Commit 75ad858

Browse files
committed
Add support for Laravel 5.6 and Elasticsearch 5.*/6.*
1 parent 1882167 commit 75ad858

File tree

7 files changed

+41
-26
lines changed

7 files changed

+41
-26
lines changed

.travis.yml

+22-15
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,40 @@ php:
66

77
sudo: false
88

9-
install:
10-
- phpenv config-rm xdebug.ini
11-
- travis_retry composer self-update
12-
- travis_retry composer install --no-interaction --prefer-dist
13-
- travis_retry composer require symfony/yaml --no-interaction --prefer-dist
14-
159
env:
1610
- ILLUMINATE_VERSION=^5.1 TESTBENCH_VERSION=^3.1 ELASTICSEARCH_VERSION=^2
1711
- ILLUMINATE_VERSION=^5.2 TESTBENCH_VERSION=^3.2 ELASTICSEARCH_VERSION=^2
1812
- ILLUMINATE_VERSION=^5.3 TESTBENCH_VERSION=^3.3 ELASTICSEARCH_VERSION=^2
1913
- ILLUMINATE_VERSION=^5.4 TESTBENCH_VERSION=^3.4 ELASTICSEARCH_VERSION=^2
2014
- ILLUMINATE_VERSION=^5.5 TESTBENCH_VERSION=^3.5 ELASTICSEARCH_VERSION=^2
15+
- ILLUMINATE_VERSION=^5.6 TESTBENCH_VERSION=^3.6 ELASTICSEARCH_VERSION=^2
2116
- ILLUMINATE_VERSION=^5.1 TESTBENCH_VERSION=^3.1 ELASTICSEARCH_VERSION=^5
2217
- ILLUMINATE_VERSION=^5.2 TESTBENCH_VERSION=^3.2 ELASTICSEARCH_VERSION=^5
2318
- ILLUMINATE_VERSION=^5.3 TESTBENCH_VERSION=^3.3 ELASTICSEARCH_VERSION=^5
2419
- ILLUMINATE_VERSION=^5.4 TESTBENCH_VERSION=^3.4 ELASTICSEARCH_VERSION=^5
2520
- ILLUMINATE_VERSION=^5.5 TESTBENCH_VERSION=^3.5 ELASTICSEARCH_VERSION=^5
21+
- ILLUMINATE_VERSION=^5.6 TESTBENCH_VERSION=^3.6 ELASTICSEARCH_VERSION=^5
22+
- ILLUMINATE_VERSION=^5.1 TESTBENCH_VERSION=^3.1 ELASTICSEARCH_VERSION=^6
23+
- ILLUMINATE_VERSION=^5.2 TESTBENCH_VERSION=^3.2 ELASTICSEARCH_VERSION=^6
24+
- ILLUMINATE_VERSION=^5.3 TESTBENCH_VERSION=^3.3 ELASTICSEARCH_VERSION=^6
25+
- ILLUMINATE_VERSION=^5.4 TESTBENCH_VERSION=^3.4 ELASTICSEARCH_VERSION=^6
26+
- ILLUMINATE_VERSION=^5.5 TESTBENCH_VERSION=^3.5 ELASTICSEARCH_VERSION=^6
27+
- ILLUMINATE_VERSION=^5.6 TESTBENCH_VERSION=^3.6 ELASTICSEARCH_VERSION=^6
28+
29+
matrix:
30+
exclude:
31+
- php: 7.0
32+
env: ILLUMINATE_VERSION=^5.6 TESTBENCH_VERSION=^3.6 ELASTICSEARCH_VERSION=^2
33+
- php: 7.0
34+
env: ILLUMINATE_VERSION=^5.6 TESTBENCH_VERSION=^3.6 ELASTICSEARCH_VERSION=^5
35+
- php: 7.0
36+
env: ILLUMINATE_VERSION=^5.6 TESTBENCH_VERSION=^3.6 ELASTICSEARCH_VERSION=^6
2637

27-
before_script:
28-
- composer remove elasticsearch/elasticsearch illuminate/support
29-
- composer remove --dev orchestra/testbench
30-
- composer require elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION} illuminate/support:${ILLUMINATE_VERSION}
31-
- composer require --dev orchestra/testbench:${TESTBENCH_VERSION}
38+
install:
39+
- phpenv config-rm xdebug.ini
40+
- travis_retry composer global require hirak/prestissimo
41+
- travis_retry composer require elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION} illuminate/support:${ILLUMINATE_VERSION}
42+
- travis_retry composer require --dev orchestra/testbench:${TESTBENCH_VERSION}
3243

3344
script: composer run coverage
3445

@@ -39,7 +50,3 @@ cache:
3950
directories:
4051
- vendor
4152
- "$HOME/.composer/cache"
42-
43-
notifications:
44-
slack:
45-
secure: ODPo7KQ7N+gQv4thY6Y8oDvvWt95tHpc19w018K9dTrY5+OWUp4LYimAwBTJ0YJxa/e3L+mRXXFl5R6i++SZGEqidmes4tPQB1ApP6ru4InIF6bQ0b0rvpxtWSUJZ1iVMvSQSFsp5C+1I75lfKDw4trnSarJ2jIQqa7z4uMrp4nLW/cVuYgoC44ehFiW3Uhzm+EtEOtbTgOvgZr+hLiUVE1x1VGIVcalSDbz+AnAiYmLBARwhKXMmL39/89O/eXucJALp3yLlmLKYjp5MaIh5EjFmAAWuvqayEbW3gb4U70XGvMf3FRORxnQn+pPcU55ULSy+6JeH3t4tZt48Wq29RQhY296klspW8bSXvry7Ot6/L2DiKAOOx6yBOIWMTUfMlOhKCT4HZoHZ4LCl74UqnmWaHlsdq2X+coNlD/XvdGgqd9QFKLoVfAwdGlaP3Lt5wDX9Ihce1m9Ncm4xNv5dbwG3hlfA/oY8Ntakc3u4IWH8ujELv0Vbc940zBlOK4YL6xRR3+2Ek2CYf6do7iNpHhLlcZXQeA0XK+ELhXKtIJxDIiTUt6ZRv0TrSsiAq2h95NUSLjw/LuwLlKQp22CUkj4L870/wC6kf67HuFXlPFau5L8hS++3dBghe8CJnySZTfrCMb7EJCCfr9TmkD63/W+xCN83S2071bjbpkqE8Y=

composer.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
}
1818
],
1919
"require": {
20-
"php": "^7.0 || ^7.1",
21-
"elasticsearch/elasticsearch": "^2.0 || ^5.0",
22-
"illuminate/support": "^5.1 || ^5.2 || ^5.3 || ^5.4 || ^5.5"
20+
"php": "^7.0 || ^7.1 || ^7.2",
21+
"elasticsearch/elasticsearch": "^2.0 || ^5.0 || ^6.0",
22+
"illuminate/support": "^5.1 || ^5.2 || ^5.3 || ^5.4 || ^5.5 || ^5.6"
2323
},
2424
"require-dev": {
25-
"phpunit/phpunit": "^4.8 || ^5.4 || ^6.0",
25+
"phpunit/phpunit": "^4.8 || ^5.4 || ^6.0 || ^7.0",
2626
"mockery/mockery": "dev-master",
2727
"codeclimate/php-test-reporter": "dev-master",
28-
"orchestra/testbench": "^3.1 || ^3.2 || ^3.3 || ^3.4 || ^3.5",
28+
"orchestra/testbench": "^3.1 || ^3.2 || ^3.3 || ^3.4 || ^3.5 || ^3.6",
2929
"ext-sqlite3": "*"
3030
},
3131
"suggest": {

phpunit.xml

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
convertWarningsToExceptions="true"
88
processIsolation="false"
99
stopOnFailure="false"
10-
syntaxCheck="false"
1110
>
1211
<testsuites>
1312
<testsuite name="Package Test Suite">

src/ArrayDelegateMethod.php

+7
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,11 @@ public function offsetGet($offset)
3030

3131
return $item;
3232
}
33+
34+
public function count()
35+
{
36+
$array = call_user_func([$this, static::$arrayDelegate]);
37+
38+
return count($array);
39+
}
3340
}

src/Response.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
namespace Datashaman\Elasticsearch\Model;
44

55
use ArrayAccess;
6+
use Countable;
67
use Exception;
78
use Illuminate\Pagination\LengthAwarePaginator;
89
use Illuminate\Support\Collection;
910

10-
class Response implements ArrayAccess
11+
class Response implements ArrayAccess, Countable
1112
{
1213
use ArrayDelegateMethod;
1314
protected static $arrayDelegate = 'results';

src/Response/Records.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
namespace Datashaman\Elasticsearch\Model\Response;
44

55
use ArrayAccess;
6+
use Countable;
67
use Datashaman\Elasticsearch\Model\ArrayDelegateMethod;
78
use Illuminate\Support\Collection;
89

9-
class Records implements ArrayAccess
10+
class Records implements ArrayAccess, Countable
1011
{
1112
use ArrayDelegateMethod;
1213
protected static $arrayDelegate = 'records';

tests/Response/PaginationTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ public function testResults()
274274

275275
$rendered = (string) $results->render();
276276

277-
$this->assertContains('<ul class="pagination">', $rendered);
278-
$this->assertContains('<a href="/articles?page=1" rel="prev">&laquo;</a>', $rendered);
279-
$this->assertContains('<a href="/articles?page=3" rel="next">&raquo;</a>', $rendered);
277+
$this->assertContains('ul class="pagination"', $rendered);
278+
$this->assertContains('href="/articles?page=1" rel="prev"', $rendered);
279+
$this->assertContains('href="/articles?page=3" rel="next"', $rendered);
280280
}
281281
}

0 commit comments

Comments
 (0)