Skip to content

Laravel 5.6 support #1428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 42 commits into from
Feb 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
0ae6a63
Merge pull request #1 from jenssegers/master
RemiCollin Feb 6, 2018
2a7ea3b
Upgrade dependencies to illuminate:5.6
RemiCollin Feb 6, 2018
9096abe
Change Model::getDateFormat() to public
RemiCollin Feb 6, 2018
9b125dc
Add new optionnal argument in HybridRelations::morphTo()
RemiCollin Feb 6, 2018
004af28
remove php7.0 from travis
RemiCollin Feb 6, 2018
3ffd304
update minimum stability
RemiCollin Feb 8, 2018
2de8728
Accept both phpunit 6.0/7.0 to allow composer to require latest Orche…
RemiCollin Feb 8, 2018
00379cd
Update travis config
RemiCollin Feb 9, 2018
0122330
Fix mongo driver script
RemiCollin Feb 9, 2018
21f3641
Add missing environment variable
RemiCollin Feb 9, 2018
fd26595
Add missing environment variable
RemiCollin Feb 9, 2018
fe49676
Explicitely setup port
RemiCollin Feb 9, 2018
83f95ed
Add explicit mongo start
RemiCollin Feb 9, 2018
d51f582
Travis : use default distribution
RemiCollin Feb 9, 2018
4721124
Remove sudo
RemiCollin Feb 9, 2018
ea06454
Remove port from config
RemiCollin Feb 12, 2018
8289095
Added dropifExists method
thilanga Feb 16, 2018
7347a87
Increment attempts
thilanga Feb 16, 2018
27ad5f3
Added docker support to travis
thilanga Feb 16, 2018
51676e9
Call docker-compose up to run phpunit test
thilanga Feb 16, 2018
5ed0f0f
Updated to add composer to the path
thilanga Feb 16, 2018
82da20f
Updated to move composer install to entry point
thilanga Feb 16, 2018
b6b84d1
Removed php70
thilanga Feb 16, 2018
272b6df
Updated to add zip and unzip packages
thilanga Feb 16, 2018
ac6dc3e
Updated with container exit
thilanga Feb 16, 2018
4689d2a
Updated container names and composer up
thilanga Feb 16, 2018
ecc974e
Updated to handle container down
thilanga Feb 16, 2018
aa2a6e0
Updated to shorten the command
thilanga Feb 16, 2018
4566abe
Updated to test failer
thilanga Feb 16, 2018
0053841
Updated to add php 7.2 support
thilanga Feb 16, 2018
2ae102f
Updated to remove docker-compose down
thilanga Feb 16, 2018
8271437
Updated to test failure
thilanga Feb 16, 2018
6b6e3c7
Updated to remove failure assert
thilanga Feb 16, 2018
58b93eb
Updated to fix php-coverall path
thilanga Feb 16, 2018
4868a70
Updated to create build folder for code cove
thilanga Feb 16, 2018
545bd04
Updated to remove container exit
thilanga Feb 16, 2018
2b7f00f
Added xdebug
thilanga Feb 16, 2018
e8a40cc
Without code-cove
thilanga Feb 16, 2018
bb4410b
Updated with exit
thilanga Feb 16, 2018
4ea4e39
Updated to add php 70,71 and 72
thilanga Feb 16, 2018
9d5398b
Style CI fix
thilanga Feb 16, 2018
1ed686d
Fix travis
RemiCollin Feb 19, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 26 additions & 28 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
sudo: required
dist: trusty
language: php

php:
- 7
- 7.1

matrix:
fast_finish: true

sudo: false
- "7.2"
- "7.1"

services:
- mongodb
- mysql

addons:
apt:
sources:
- mongodb-3.0-precise
packages:
- mongodb-org-server

before_script:
- pecl install mongodb
- mysql -e 'create database unittest;'
- travis_retry composer self-update
- travis_retry composer install --no-interaction
- docker

install:
# Update docker-engine using Ubuntu 'trusty' apt repo
- >
curl -sSL "https://get.docker.com/gpg" |
sudo -E apt-key add -
- >
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" |
sudo tee -a /etc/apt/sources.list
- sudo apt-get update
- >
sudo apt-get -o Dpkg::Options::="--force-confdef" \
-o Dpkg::Options::="--force-confold" --assume-yes install docker-engine --allow-unauthenticated
- docker version

# Update docker-compose via pip
- sudo pip install docker-compose
- docker-compose version
- docker-compose up --build -d
- docker ps -a

script:
- mkdir -p build/logs
- vendor/bin/phpunit --coverage-clover build/logs/clover.xml

after_success:
- sh -c 'php vendor/bin/coveralls -v'
- docker-compose up --exit-code-from php
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
],
"license" : "MIT",
"require": {
"illuminate/support": "^5.5",
"illuminate/container": "^5.5",
"illuminate/database": "^5.5",
"illuminate/events": "^5.5",
"illuminate/support": "^5.6",
"illuminate/container": "^5.6",
"illuminate/database": "^5.6",
"illuminate/events": "^5.6",
"mongodb/mongodb": "^1.0.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0",
"phpunit/phpunit": "^6.0|^7.0",
"orchestra/testbench": "^3.1",
"mockery/mockery": "^1.0",
"satooshi/php-coveralls": "^2.0",
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ version: '3'
services:

php:
container_name: php
build:
context: .
dockerfile: docker/Dockerfile
Expand All @@ -15,6 +16,7 @@ services:
- mongodb

mysql:
container_name: mysql
image: mysql
environment:
MYSQL_ROOT_PASSWORD:
Expand All @@ -24,6 +26,7 @@ services:
driver: none

mongodb:
container_name: mongodb
image: mongo
logging:
driver: none
14 changes: 11 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
FROM php:7.1-cli

RUN pecl install xdebug

RUN apt-get update && \
apt-get install -y autoconf pkg-config libssl-dev && \
pecl install mongodb && docker-php-ext-enable mongodb && \
docker-php-ext-install -j$(nproc) pdo pdo_mysql
apt-get install -y autoconf pkg-config libssl-dev git && \
pecl install mongodb git zlib1g-dev && docker-php-ext-enable mongodb && \
docker-php-ext-install -j$(nproc) pdo pdo_mysql zip && docker-php-ext-enable xdebug

RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/ \
&& ln -s /usr/local/bin/composer.phar /usr/local/bin/composer

ENV PATH="~/.composer/vendor/bin:./vendor/bin:${PATH}"
2 changes: 1 addition & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

sleep 3 && php ./vendor/bin/phpunit
sleep 3 && composer install --prefer-source --no-interaction && php ./vendor/bin/phpunit
3 changes: 2 additions & 1 deletion src/Jenssegers/Mongodb/Eloquent/HybridRelations.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,10 @@ public function belongsTo($related, $foreignKey = null, $otherKey = null, $relat
* @param string $name
* @param string $type
* @param string $id
* @param string $ownerKey
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
*/
public function morphTo($name = null, $type = null, $id = null)
public function morphTo($name = null, $type = null, $id = null, $ownerKey = null)
{
// If no name is provided, we will use the backtrace to get the function name
// since that is most likely the name of the polymorphic interface. We can
Expand Down
2 changes: 1 addition & 1 deletion src/Jenssegers/Mongodb/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected function asDateTime($value)
/**
* @inheritdoc
*/
protected function getDateFormat()
public function getDateFormat()
{
return $this->dateFormat ?: 'Y-m-d H:i:s';
}
Expand Down
2 changes: 1 addition & 1 deletion src/Jenssegers/Mongodb/Queue/MongoQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected function releaseJobsThatHaveBeenReservedTooLong($queue)
})->get();

foreach ($reserved as $job) {
$attempts = $job['attempts'];
$attempts = $job['attempts'] + 1;
$this->releaseJob($job['_id'], $attempts);
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/Jenssegers/Mongodb/Schema/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ public function create($collection, Closure $callback = null)
}
}

/**
* @inheritdoc
*/
public function dropIfExists($collection)
{
if ($this->hasCollection($collection)) {
return $this->drop($collection);
}

return false;
}

/**
* @inheritdoc
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function father()
return $this->embedsOne('User');
}

protected function getDateFormat()
public function getDateFormat()
{
return 'l jS \of F Y h:i:s A';
}
Expand Down