Skip to content

Commit 32974fd

Browse files
authored
Merge pull request #1428 from RemiCollin/master
Laravel 5.6 support
2 parents 1bb259a + 1ed686d commit 32974fd

File tree

10 files changed

+63
-41
lines changed

10 files changed

+63
-41
lines changed

.travis.yml

+26-28
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
1+
sudo: required
2+
dist: trusty
13
language: php
2-
34
php:
4-
- 7
5-
- 7.1
6-
7-
matrix:
8-
fast_finish: true
9-
10-
sudo: false
5+
- "7.2"
6+
- "7.1"
117

128
services:
13-
- mongodb
14-
- mysql
15-
16-
addons:
17-
apt:
18-
sources:
19-
- mongodb-3.0-precise
20-
packages:
21-
- mongodb-org-server
22-
23-
before_script:
24-
- pecl install mongodb
25-
- mysql -e 'create database unittest;'
26-
- travis_retry composer self-update
27-
- travis_retry composer install --no-interaction
9+
- docker
10+
11+
install:
12+
# Update docker-engine using Ubuntu 'trusty' apt repo
13+
- >
14+
curl -sSL "https://get.docker.com/gpg" |
15+
sudo -E apt-key add -
16+
- >
17+
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" |
18+
sudo tee -a /etc/apt/sources.list
19+
- sudo apt-get update
20+
- >
21+
sudo apt-get -o Dpkg::Options::="--force-confdef" \
22+
-o Dpkg::Options::="--force-confold" --assume-yes install docker-engine --allow-unauthenticated
23+
- docker version
24+
25+
# Update docker-compose via pip
26+
- sudo pip install docker-compose
27+
- docker-compose version
28+
- docker-compose up --build -d
29+
- docker ps -a
2830

2931
script:
30-
- mkdir -p build/logs
31-
- vendor/bin/phpunit --coverage-clover build/logs/clover.xml
32-
33-
after_success:
34-
- sh -c 'php vendor/bin/coveralls -v'
32+
- docker-compose up --exit-code-from php

composer.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
],
1212
"license" : "MIT",
1313
"require": {
14-
"illuminate/support": "^5.5",
15-
"illuminate/container": "^5.5",
16-
"illuminate/database": "^5.5",
17-
"illuminate/events": "^5.5",
14+
"illuminate/support": "^5.6",
15+
"illuminate/container": "^5.6",
16+
"illuminate/database": "^5.6",
17+
"illuminate/events": "^5.6",
1818
"mongodb/mongodb": "^1.0.0"
1919
},
2020
"require-dev": {
21-
"phpunit/phpunit": "^6.0",
21+
"phpunit/phpunit": "^6.0|^7.0",
2222
"orchestra/testbench": "^3.1",
2323
"mockery/mockery": "^1.0",
2424
"satooshi/php-coveralls": "^2.0",

docker-compose.yml

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ version: '3'
33
services:
44

55
php:
6+
container_name: php
67
build:
78
context: .
89
dockerfile: docker/Dockerfile
@@ -15,6 +16,7 @@ services:
1516
- mongodb
1617

1718
mysql:
19+
container_name: mysql
1820
image: mysql
1921
environment:
2022
MYSQL_ROOT_PASSWORD:
@@ -24,6 +26,7 @@ services:
2426
driver: none
2527

2628
mongodb:
29+
container_name: mongodb
2730
image: mongo
2831
logging:
2932
driver: none

docker/Dockerfile

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
FROM php:7.1-cli
22

3+
RUN pecl install xdebug
4+
35
RUN apt-get update && \
4-
apt-get install -y autoconf pkg-config libssl-dev && \
5-
pecl install mongodb && docker-php-ext-enable mongodb && \
6-
docker-php-ext-install -j$(nproc) pdo pdo_mysql
6+
apt-get install -y autoconf pkg-config libssl-dev git && \
7+
pecl install mongodb git zlib1g-dev && docker-php-ext-enable mongodb && \
8+
docker-php-ext-install -j$(nproc) pdo pdo_mysql zip && docker-php-ext-enable xdebug
9+
10+
RUN curl -sS https://getcomposer.org/installer | php \
11+
&& mv composer.phar /usr/local/bin/ \
12+
&& ln -s /usr/local/bin/composer.phar /usr/local/bin/composer
13+
14+
ENV PATH="~/.composer/vendor/bin:./vendor/bin:${PATH}"

docker/entrypoint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
22

3-
sleep 3 && php ./vendor/bin/phpunit
3+
sleep 3 && composer install --prefer-source --no-interaction && php ./vendor/bin/phpunit

src/Jenssegers/Mongodb/Eloquent/HybridRelations.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,10 @@ public function belongsTo($related, $foreignKey = null, $otherKey = null, $relat
169169
* @param string $name
170170
* @param string $type
171171
* @param string $id
172+
* @param string $ownerKey
172173
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
173174
*/
174-
public function morphTo($name = null, $type = null, $id = null)
175+
public function morphTo($name = null, $type = null, $id = null, $ownerKey = null)
175176
{
176177
// If no name is provided, we will use the backtrace to get the function name
177178
// since that is most likely the name of the polymorphic interface. We can

src/Jenssegers/Mongodb/Eloquent/Model.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected function asDateTime($value)
101101
/**
102102
* @inheritdoc
103103
*/
104-
protected function getDateFormat()
104+
public function getDateFormat()
105105
{
106106
return $this->dateFormat ?: 'Y-m-d H:i:s';
107107
}

src/Jenssegers/Mongodb/Queue/MongoQueue.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ protected function releaseJobsThatHaveBeenReservedTooLong($queue)
117117
})->get();
118118

119119
foreach ($reserved as $job) {
120-
$attempts = $job['attempts'];
120+
$attempts = $job['attempts'] + 1;
121121
$this->releaseJob($job['_id'], $attempts);
122122
}
123123
}

src/Jenssegers/Mongodb/Schema/Builder.php

+12
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,18 @@ public function create($collection, Closure $callback = null)
9696
}
9797
}
9898

99+
/**
100+
* @inheritdoc
101+
*/
102+
public function dropIfExists($collection)
103+
{
104+
if ($this->hasCollection($collection)) {
105+
return $this->drop($collection);
106+
}
107+
108+
return false;
109+
}
110+
99111
/**
100112
* @inheritdoc
101113
*/

tests/models/User.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function father()
6565
return $this->embedsOne('User');
6666
}
6767

68-
protected function getDateFormat()
68+
public function getDateFormat()
6969
{
7070
return 'l jS \of F Y h:i:s A';
7171
}

0 commit comments

Comments
 (0)