Skip to content

Commit f92da85

Browse files
authored
Merge branch 'master' into master
2 parents 79b22f1 + a9c7410 commit f92da85

File tree

9 files changed

+61
-41
lines changed

9 files changed

+61
-41
lines changed

Diff for: .github/workflows/build-ci.yml

+20-5
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,24 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: ${{matrix.os}}
11+
runs-on: ${{ matrix.os }}
12+
name: PHP v${{ matrix.php }} with Mongo v${{ matrix.mongodb }}
13+
continue-on-error: ${{ matrix.experimental }}
1214
strategy:
1315
matrix:
14-
php: ['7.2', '7.3', '7.4']
15-
os: ['ubuntu-latest']
16-
mongodb: ['3.6', '4.0', '4.2', '4.4']
16+
include:
17+
- { os: ubuntu-latest, php: 7.2, mongodb: 3.6, experimental: true}
18+
- { os: ubuntu-latest, php: 7.2, mongodb: '4.0', experimental: true}
19+
- { os: ubuntu-latest, php: 7.2, mongodb: 4.2, experimental: true}
20+
- { os: ubuntu-latest, php: 7.2, mongodb: 4.4, experimental: true}
21+
- { os: ubuntu-latest, php: 7.3, mongodb: 3.6, experimental: false}
22+
- { os: ubuntu-latest, php: 7.3, mongodb: '4.0', experimental: false}
23+
- { os: ubuntu-latest, php: 7.3, mongodb: 4.2, experimental: false}
24+
- { os: ubuntu-latest, php: 7.3, mongodb: 4.4, experimental: false}
25+
- { os: ubuntu-latest, php: 7.4, mongodb: 3.6, experimental: false}
26+
- { os: ubuntu-latest, php: 7.4, mongodb: '4.0', experimental: false}
27+
- { os: ubuntu-latest, php: 7.4, mongodb: 4.2, experimental: false}
28+
- { os: ubuntu-latest, php: 7.4, mongodb: 4.4, experimental: false}
1729
services:
1830
mongo:
1931
image: mongo:${{ matrix.mongodb }}
@@ -27,7 +39,6 @@ jobs:
2739
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
2840
MYSQL_DATABASE: 'unittest'
2941
MYSQL_ROOT_PASSWORD:
30-
name: PHP v${{ matrix.php }} with Mongo v${{ matrix.mongodb }}
3142

3243
steps:
3344
- uses: actions/checkout@v2
@@ -45,18 +56,22 @@ jobs:
4556
env:
4657
DEBUG: ${{secrets.DEBUG}}
4758
- name: Download Composer cache dependencies from cache
59+
if: (!startsWith(matrix.php, '7.2'))
4860
id: composer-cache
4961
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
5062
- name: Cache Composer dependencies
63+
if: (!startsWith(matrix.php, '7.2'))
5164
uses: actions/cache@v1
5265
with:
5366
path: ${{ steps.composer-cache.outputs.dir }}
5467
key: ${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }}
5568
restore-keys: ${{ matrix.os }}-composer-
5669
- name: Install dependencies
70+
if: (!startsWith(matrix.php, '7.2'))
5771
run: |
5872
composer install --no-interaction
5973
- name: Run tests
74+
if: (!startsWith(matrix.php, '7.2'))
6075
run: |
6176
./vendor/bin/phpunit --coverage-clover coverage.xml
6277
env:

Diff for: CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file.
33

44
## [Unreleased]
55

6+
### Added
7+
- Laravel 8 support by [@divine](https://github.com/divine).
8+
9+
### Changed
10+
- Updated versions of all dependencies by [@divine](https://github.com/divine).
11+
12+
## [3.7.0] - 2020-09-18
13+
614
### Added
715
- Laravel 7 support by [@divine](https://github.com/divine).
816

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Make sure you have the MongoDB PHP driver installed. You can find installation i
6868
5.8.x | 3.5.x
6969
6.x | 3.6.x
7070
7.x | 3.7.x
71+
8.x | 3.8.x
7172

7273
Install the package via Composer:
7374

Diff for: composer.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
],
2020
"license": "MIT",
2121
"require": {
22-
"illuminate/support": "^7.0",
23-
"illuminate/container": "^7.0",
24-
"illuminate/database": "^7.0",
25-
"illuminate/events": "^7.0",
22+
"illuminate/support": "^8.0",
23+
"illuminate/container": "^8.0",
24+
"illuminate/database": "^8.0",
25+
"illuminate/events": "^8.0",
2626
"mongodb/mongodb": "^1.6"
2727
},
2828
"require-dev": {
29-
"phpunit/phpunit": "^8.4|^9.0",
30-
"orchestra/testbench": "^5.0",
29+
"phpunit/phpunit": "^9.0",
30+
"orchestra/testbench": "^6.0",
3131
"mockery/mockery": "^1.3.1",
3232
"doctrine/dbal": "^2.6"
3333
},

Diff for: phpunit.xml.dist

+6-14
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
4-
bootstrap="vendor/autoload.php"
5-
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">./src</directory>
6+
</include>
7+
</coverage>
118
<testsuites>
129
<testsuite name="all">
1310
<directory>tests/</directory>
@@ -37,11 +34,6 @@
3734
<file>tests/ValidationTest.php</file>
3835
</testsuite>
3936
</testsuites>
40-
<filter>
41-
<whitelist processUncoveredFilesFromWhitelist="true">
42-
<directory suffix=".php">./src</directory>
43-
</whitelist>
44-
</filter>
4537
<php>
4638
<env name="MONGO_HOST" value="mongodb"/>
4739
<env name="MONGO_DATABASE" value="unittest"/>

Diff for: src/Jenssegers/Mongodb/Query/Builder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ protected function compileWhereBasic(array $where)
10401040

10411041
if (!isset($operator) || $operator == '=') {
10421042
if ($is_numeric) {
1043-
$query = ['$where' => '/^'.$value->getPattern().'/.test(this.'.$column.')'];
1043+
$query = ['$where' => '/^'.$value->getPattern().'/.test(this["'.$column.'"])'];
10441044
} else {
10451045
$query = [$column => $value];
10461046
}

Diff for: src/Jenssegers/Mongodb/Relations/MorphTo.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected function getResultsByType($type)
3131

3232
$query = $instance->newQuery();
3333

34-
return $query->whereIn($key, $this->gatherKeysByType($type))->get();
34+
return $query->whereIn($key, $this->gatherKeysByType($type, $instance->getKeyType()))->get();
3535
}
3636

3737
/**

Diff for: tests/QueryTest.php

+17-13
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public function setUp(): void
1616
User::create(['name' => 'Brett Boe', 'age' => 35, 'title' => 'user']);
1717
User::create(['name' => 'Tommy Toe', 'age' => 33, 'title' => 'user']);
1818
User::create(['name' => 'Yvonne Yoe', 'age' => 35, 'title' => 'admin']);
19+
User::create(['name' => 'John Smith', 'user-age' => 28, 'title' => 'member']);
1920
User::create(['name' => 'Error', 'age' => null, 'title' => null]);
2021
}
2122

@@ -41,10 +42,10 @@ public function testWhere(): void
4142
$this->assertCount(1, $users);
4243

4344
$users = User::where('age', '!=', 35)->get();
44-
$this->assertCount(6, $users);
45+
$this->assertCount(7, $users);
4546

4647
$users = User::where('age', '<>', 35)->get();
47-
$this->assertCount(6, $users);
48+
$this->assertCount(7, $users);
4849
}
4950

5051
public function testAndWhere(): void
@@ -78,21 +79,24 @@ public function testLike(): void
7879

7980
$users = User::where('age', 'like', '%3')->get();
8081
$this->assertCount(4, $users);
82+
83+
$users = User::where('user-age', 'like', '%28')->get();
84+
$this->assertCount(1, $users);
8185
}
8286

8387
public function testNotLike(): void
8488
{
8589
$users = User::where('name', 'not like', '%doe')->get();
86-
$this->assertCount(7, $users);
90+
$this->assertCount(8, $users);
8791

8892
$users = User::where('name', 'not like', '%y%')->get();
89-
$this->assertCount(6, $users);
93+
$this->assertCount(7, $users);
9094

9195
$users = User::where('name', 'not LIKE', '%y%')->get();
92-
$this->assertCount(6, $users);
96+
$this->assertCount(7, $users);
9397

9498
$users = User::where('name', 'not like', 't%')->get();
95-
$this->assertCount(8, $users);
99+
$this->assertCount(9, $users);
96100
}
97101

98102
public function testSelect(): void
@@ -152,7 +156,7 @@ public function testIn(): void
152156
$this->assertCount(6, $users);
153157

154158
$users = User::whereNotIn('age', [33, 35])->get();
155-
$this->assertCount(4, $users);
159+
$this->assertCount(5, $users);
156160

157161
$users = User::whereNotNull('age')
158162
->whereNotIn('age', [33, 35])->get();
@@ -162,7 +166,7 @@ public function testIn(): void
162166
public function testWhereNull(): void
163167
{
164168
$users = User::whereNull('age')->get();
165-
$this->assertCount(1, $users);
169+
$this->assertCount(2, $users);
166170
}
167171

168172
public function testWhereNotNull(): void
@@ -195,7 +199,7 @@ public function testOrder(): void
195199
public function testGroupBy(): void
196200
{
197201
$users = User::groupBy('title')->get();
198-
$this->assertCount(3, $users);
202+
$this->assertCount(4, $users);
199203

200204
$users = User::groupBy('age')->get();
201205
$this->assertCount(6, $users);
@@ -225,11 +229,11 @@ public function testGroupBy(): void
225229
public function testCount(): void
226230
{
227231
$count = User::where('age', '<>', 35)->count();
228-
$this->assertEquals(6, $count);
232+
$this->assertEquals(7, $count);
229233

230234
// Test for issue #165
231235
$count = User::select('_id', 'age', 'title')->where('age', '<>', 35)->count();
232-
$this->assertEquals(6, $count);
236+
$this->assertEquals(7, $count);
233237
}
234238

235239
public function testExists(): void
@@ -327,12 +331,12 @@ public function testPaginate(): void
327331
$results = User::paginate(2);
328332
$this->assertEquals(2, $results->count());
329333
$this->assertNotNull($results->first()->title);
330-
$this->assertEquals(9, $results->total());
334+
$this->assertEquals(10, $results->total());
331335

332336
$results = User::paginate(2, ['name', 'age']);
333337
$this->assertEquals(2, $results->count());
334338
$this->assertNull($results->first()->title);
335-
$this->assertEquals(9, $results->total());
339+
$this->assertEquals(10, $results->total());
336340
$this->assertEquals(1, $results->currentPage());
337341
}
338342

Diff for: tests/QueueTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testQueueJobLifeCycle(): void
3737
'job' => 'test',
3838
'maxTries' => null,
3939
'maxExceptions' => null,
40-
'delay' => null,
40+
'backoff' => null,
4141
'timeout' => null,
4242
'data' => ['action' => 'QueueJobLifeCycle'],
4343
]), $job->getRawBody());

0 commit comments

Comments
 (0)