Skip to content

Commit ba58266

Browse files
Merge branch 'master' of https://github.com/jenssegers/laravel-mongodb into develop
* 'master' of https://github.com/jenssegers/laravel-mongodb: (98 commits) Report package version when establishing connection (mongodb#2507) Add missing return types Fix styleCI issues Fix auth test for Laravel 10 Update tested PHP versions Remove dependency on doctrine/dbal Rename getBaseQuery method to toBase Remove deprecated PHPUnit call Update handling of dates for Laravel 10 chore: disable php 8.0 in gh builds chore: update minimum stability Bump dependencies for Laravel 10 fix: keep camel cased name except for `getMorphs` tests: for snake case morph relation name Add Geonear instructions to ReadMe. Closes mongodb#1878 (mongodb#2487) fix: whereBelongsTo (mongodb#2454) Transaction support (mongodb#2465) Use single connection using DSN for testing (mongodb#2462) Chore: add types where safe (mongodb#2464) Pass timeout in milliseconds (mongodb#2461) ... # Conflicts: # composer.json # src/Eloquent/Builder.php # src/Eloquent/Model.php
2 parents 10ebfdc + 7dab675 commit ba58266

File tree

87 files changed

+2683
-884
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+2683
-884
lines changed

.github/ISSUE_TEMPLATE/QUESTION.md

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

.github/workflows/build-ci.yml

Lines changed: 96 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,103 @@
11
name: CI
22

33
on:
4-
push:
5-
branches:
6-
tags:
7-
pull_request:
4+
push:
5+
branches:
6+
tags:
7+
pull_request:
88

99
jobs:
10-
build:
11-
runs-on: ${{matrix.os}}
12-
strategy:
13-
matrix:
14-
php: ['7.2', '7.3', '7.4']
15-
os: ['ubuntu-latest']
16-
mongodb: ['3.6', '4.0', '4.2']
17-
services:
18-
mongo:
19-
image: mongo:${{ matrix.mongodb }}
20-
ports:
21-
- 27017:27017
22-
mysql:
23-
image: mysql:5.7
24-
ports:
25-
- 3307:3306
10+
php-cs-fixer:
11+
runs-on: ubuntu-latest
2612
env:
27-
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
28-
MYSQL_DATABASE: 'unittest'
29-
MYSQL_ROOT_PASSWORD:
30-
name: PHP v${{ matrix.php }} with Mongo v${{ matrix.mongodb }}
13+
PHP_CS_FIXER_VERSION: v3.6.0
14+
strategy:
15+
matrix:
16+
php:
17+
- '8.1'
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
- name: Setup PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: ${{ matrix.php }}
25+
extensions: curl,mbstring
26+
tools: php-cs-fixer:${{ env.PHP_CS_FIXER_VERSION }}
27+
coverage: none
28+
- name: Run PHP-CS-Fixer Fix, version ${{ env.PHP_CS_FIXER_VERSION }}
29+
run: php-cs-fixer fix --dry-run --diff --ansi
3130

32-
steps:
33-
- uses: actions/checkout@v2
34-
- name: "Installing php"
35-
uses: shivammathur/setup-php@v2
36-
with:
37-
php-version: ${{ matrix.php }}
38-
extensions: curl,mbstring,xdebug
39-
coverage: xdebug
40-
tools: composer
41-
- name: Show PHP version
42-
run: php -v && composer -V
43-
- name: Show Docker version
44-
run: if [[ "$DEBUG" == "true" ]]; then docker version && env; fi
45-
env:
46-
DEBUG: ${{secrets.DEBUG}}
47-
- name: Download Composer cache dependencies from cache
48-
id: composer-cache
49-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
50-
- name: Cache Composer dependencies
51-
uses: actions/cache@v1
52-
with:
53-
path: ${{ steps.composer-cache.outputs.dir }}
54-
key: ${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }}
55-
restore-keys: ${{ matrix.os }}-composer-
56-
- name: Install dependencies
57-
run: |
58-
composer install --no-interaction
59-
- name: Run tests
60-
run: |
61-
./vendor/bin/phpunit --coverage-clover coverage.xml
62-
env:
63-
MONGO_HOST: 0.0.0.0
64-
MYSQL_HOST: 0.0.0.0
65-
MYSQL_PORT: 3307
66-
- name: Send coveralls
67-
run: vendor/bin/coveralls coverage.xml
68-
env:
69-
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70-
- uses: codecov/codecov-action@v1
71-
with:
72-
token: ${{ secrets.CODECOV_TOKEN }}
73-
fail_ci_if_error: false
31+
build:
32+
runs-on: ${{ matrix.os }}
33+
name: PHP v${{ matrix.php }} with MongoDB ${{ matrix.mongodb }}
34+
strategy:
35+
matrix:
36+
os:
37+
- ubuntu-latest
38+
mongodb:
39+
- '4.0'
40+
- '4.2'
41+
- '4.4'
42+
- '5.0'
43+
php:
44+
- '8.1'
45+
- '8.2'
46+
services:
47+
mysql:
48+
image: mysql:5.7
49+
ports:
50+
- 3307:3306
51+
env:
52+
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
53+
MYSQL_DATABASE: 'unittest'
54+
MYSQL_ROOT_PASSWORD:
55+
56+
steps:
57+
- uses: actions/checkout@v3
58+
- name: Create MongoDB Replica Set
59+
run: |
60+
docker run --name mongodb -p 27017:27017 -e MONGO_INITDB_DATABASE=unittest --detach mongo:${{ matrix.mongodb }} mongod --replSet rs --setParameter transactionLifetimeLimitSeconds=5
61+
until docker exec --tty mongodb mongo 127.0.0.1:27017 --eval "db.runCommand({ ping: 1 })"; do
62+
sleep 1
63+
done
64+
sudo docker exec --tty mongodb mongo 127.0.0.1:27017 --eval "rs.initiate({\"_id\":\"rs\",\"members\":[{\"_id\":0,\"host\":\"127.0.0.1:27017\" }]})"
65+
- name: Show MongoDB server status
66+
run: |
67+
docker exec --tty mongodb mongo 127.0.0.1:27017 --eval "db.runCommand({ serverStatus: 1 })"
68+
- name: "Installing php"
69+
uses: shivammathur/setup-php@v2
70+
with:
71+
php-version: ${{ matrix.php }}
72+
extensions: curl,mbstring,xdebug
73+
coverage: xdebug
74+
tools: composer
75+
- name: Show PHP version
76+
run: php -v && composer -V
77+
- name: Show Docker version
78+
run: if [[ "$DEBUG" == "true" ]]; then docker version && env; fi
79+
env:
80+
DEBUG: ${{secrets.DEBUG}}
81+
- name: Download Composer cache dependencies from cache
82+
id: composer-cache
83+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
84+
- name: Cache Composer dependencies
85+
uses: actions/cache@v1
86+
with:
87+
path: ${{ steps.composer-cache.outputs.dir }}
88+
key: ${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }}
89+
restore-keys: ${{ matrix.os }}-composer-
90+
- name: Install dependencies
91+
run: |
92+
composer install --no-interaction
93+
- name: Run tests
94+
run: |
95+
./vendor/bin/phpunit --coverage-clover coverage.xml
96+
env:
97+
MONGODB_URI: 'mongodb://127.0.0.1/?replicaSet=rs'
98+
MYSQL_HOST: 0.0.0.0
99+
MYSQL_PORT: 3307
100+
- uses: codecov/codecov-action@v1
101+
with:
102+
token: ${{ secrets.CODECOV_TOKEN }}
103+
fail_ci_if_error: false

.gitignore

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
.DS_Store
2-
phpunit.phar
3-
/vendor
4-
composer.phar
5-
composer.lock
1+
*.project
62
*.sublime-project
73
*.sublime-workspace
8-
*.project
4+
.DS_Store
95
.idea/
106
.phpunit.result.cache
7+
/.php-cs-fixer.php
8+
/.php-cs-fixer.cache
9+
/vendor
10+
composer.lock
11+
composer.phar
12+
phpunit.phar
13+
phpunit.xml

.php-cs-fixer.dist.php

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
<?php
2+
3+
# Source: https://github.com/matt-allan/laravel-code-style/blob/main/src/Config.php
4+
5+
$rules = [
6+
'@PSR2' => true,
7+
'align_multiline_comment' => [
8+
'comment_type' => 'phpdocs_like',
9+
],
10+
'ordered_imports' => [
11+
'sort_algorithm' => 'alpha',
12+
],
13+
'array_indentation' => true,
14+
'binary_operator_spaces' => [
15+
'operators' => [
16+
'=>' => null,
17+
'=' => 'single_space',
18+
],
19+
],
20+
'blank_line_after_namespace' => true,
21+
'blank_line_after_opening_tag' => true,
22+
'blank_line_before_statement' => [
23+
'statements' => [
24+
'return',
25+
],
26+
],
27+
'cast_spaces' => true,
28+
'class_definition' => false,
29+
'clean_namespace' => true,
30+
'compact_nullable_typehint' => true,
31+
'concat_space' => [
32+
'spacing' => 'none',
33+
],
34+
'declare_equal_normalize' => true,
35+
'no_alias_language_construct_call' => true,
36+
'elseif' => true,
37+
'encoding' => true,
38+
'full_opening_tag' => true,
39+
'function_declaration' => true,
40+
'function_typehint_space' => true,
41+
'single_line_comment_style' => [
42+
'comment_types' => [
43+
'hash',
44+
],
45+
],
46+
'heredoc_to_nowdoc' => true,
47+
'include' => true,
48+
'indentation_type' => true,
49+
'integer_literal_case' => true,
50+
'braces' => false,
51+
'lowercase_cast' => true,
52+
'constant_case' => [
53+
'case' => 'lower',
54+
],
55+
'lowercase_keywords' => true,
56+
'lowercase_static_reference' => true,
57+
'magic_constant_casing' => true,
58+
'magic_method_casing' => true,
59+
'method_argument_space' => [
60+
'on_multiline' => 'ignore',
61+
],
62+
'class_attributes_separation' => [
63+
'elements' => [
64+
'method' => 'one',
65+
],
66+
],
67+
'visibility_required' => [
68+
'elements' => [
69+
'method',
70+
'property',
71+
],
72+
],
73+
'native_function_casing' => true,
74+
'native_function_type_declaration_casing' => true,
75+
'no_alternative_syntax' => true,
76+
'no_binary_string' => true,
77+
'no_blank_lines_after_class_opening' => true,
78+
'no_blank_lines_after_phpdoc' => true,
79+
'no_extra_blank_lines' => [
80+
'tokens' => [
81+
'throw',
82+
'use',
83+
'extra',
84+
],
85+
],
86+
'no_closing_tag' => true,
87+
'no_empty_phpdoc' => true,
88+
'no_empty_statement' => true,
89+
'no_leading_import_slash' => true,
90+
'no_leading_namespace_whitespace' => true,
91+
'no_multiline_whitespace_around_double_arrow' => true,
92+
'multiline_whitespace_before_semicolons' => true,
93+
'no_short_bool_cast' => true,
94+
'no_singleline_whitespace_before_semicolons' => true,
95+
'no_space_around_double_colon' => true,
96+
'no_spaces_after_function_name' => true,
97+
'no_spaces_around_offset' => [
98+
'positions' => [
99+
'inside',
100+
],
101+
],
102+
'no_spaces_inside_parenthesis' => true,
103+
'no_trailing_comma_in_list_call' => true,
104+
'no_trailing_comma_in_singleline_array' => true,
105+
'no_trailing_whitespace' => true,
106+
'no_trailing_whitespace_in_comment' => true,
107+
'no_unneeded_control_parentheses' => true,
108+
'no_unneeded_curly_braces' => true,
109+
'no_unset_cast' => true,
110+
'no_unused_imports' => true,
111+
'lambda_not_used_import' => true,
112+
'no_useless_return' => true,
113+
'no_whitespace_before_comma_in_array' => true,
114+
'no_whitespace_in_blank_line' => true,
115+
'normalize_index_brace' => true,
116+
'not_operator_with_successor_space' => true,
117+
'object_operator_without_whitespace' => true,
118+
'phpdoc_indent' => true,
119+
'phpdoc_inline_tag_normalizer' => true,
120+
'phpdoc_no_access' => true,
121+
'phpdoc_no_package' => true,
122+
'phpdoc_no_useless_inheritdoc' => true,
123+
'phpdoc_return_self_reference' => true,
124+
'phpdoc_scalar' => true,
125+
'phpdoc_single_line_var_spacing' => true,
126+
'phpdoc_summary' => true,
127+
'phpdoc_trim' => true,
128+
'phpdoc_no_alias_tag' => [
129+
'replacements' => [
130+
'type' => 'var',
131+
],
132+
],
133+
'phpdoc_types' => true,
134+
'phpdoc_var_without_name' => true,
135+
'increment_style' => [
136+
'style' => 'post',
137+
],
138+
'no_mixed_echo_print' => [
139+
'use' => 'echo',
140+
],
141+
'return_type_declaration' => [
142+
'space_before' => 'none',
143+
],
144+
'array_syntax' => [
145+
'syntax' => 'short',
146+
],
147+
'list_syntax' => [
148+
'syntax' => 'short',
149+
],
150+
'short_scalar_cast' => true,
151+
'single_blank_line_at_eof' => true,
152+
'single_blank_line_before_namespace' => true,
153+
'single_class_element_per_statement' => true,
154+
'single_import_per_statement' => true,
155+
'single_line_after_imports' => true,
156+
'single_quote' => true,
157+
'space_after_semicolon' => true,
158+
'standardize_not_equals' => true,
159+
'switch_case_semicolon_to_colon' => true,
160+
'switch_case_space' => true,
161+
'switch_continue_to_break' => true,
162+
'ternary_operator_spaces' => true,
163+
'trailing_comma_in_multiline' => [
164+
'elements' => [
165+
'arrays',
166+
],
167+
],
168+
'trim_array_spaces' => true,
169+
'unary_operator_spaces' => true,
170+
'types_spaces' => [
171+
'space' => 'none',
172+
],
173+
'line_ending' => true,
174+
'whitespace_after_comma_in_array' => true,
175+
'no_alias_functions' => true,
176+
'no_unreachable_default_argument_value' => true,
177+
'psr_autoloading' => true,
178+
'self_accessor' => true,
179+
];
180+
181+
$finder = PhpCsFixer\Finder::create()
182+
->in(__DIR__);
183+
184+
return (new PhpCsFixer\Config())
185+
->setRiskyAllowed(true)
186+
->setRules($rules)
187+
->setFinder($finder);

.styleci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
risky: true
12
preset: laravel

0 commit comments

Comments
 (0)