Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-mongodb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
laravel-mongodb
Commits
5a876398
Commit
5a876398
authored
Jan 08, 2018
by
Jens Segers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make testing easier with docker
parent
321885c9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
4 deletions
+49
-4
README.md
README.md
+9
-0
docker-compose.yml
docker-compose.yml
+29
-0
Dockerfile
docker/Dockerfile
+6
-0
ConnectionTest.php
tests/ConnectionTest.php
+2
-1
database.php
tests/config/database.php
+3
-3
No files found.
README.md
View file @
5a876398
...
...
@@ -103,6 +103,15 @@ Embedded relations now return an `Illuminate\Database\Eloquent\Collection` rathe
$books
=
$user
->
books
()
->
sortBy
(
'title'
);
```
Testing
-------
To run the test for this package, run:
```
docker-compose up
```
Configuration
-------------
...
...
docker-compose.yml
0 → 100644
View file @
5a876398
version
:
'
3'
services
:
php
:
build
:
context
:
.
dockerfile
:
docker/Dockerfile
volumes
:
-
.:/code
working_dir
:
/code
command
:
php ./vendor/bin/phpunit
depends_on
:
-
mysql
-
mongodb
mysql
:
image
:
mysql
environment
:
MYSQL_ROOT_PASSWORD
:
MYSQL_DATABASE
:
unittest
MYSQL_ALLOW_EMPTY_PASSWORD
:
'
yes'
logging
:
driver
:
none
mongodb
:
image
:
mongo
logging
:
driver
:
none
docker/Dockerfile
0 → 100644
View file @
5a876398
FROM
php:7.1-cli
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
tests/ConnectionTest.php
View file @
5a876398
...
...
@@ -98,12 +98,13 @@ class ConnectionTest extends TestCase
public
function
testAuth
()
{
$host
=
Config
::
get
(
'database.connections.mongodb.host'
);
Config
::
set
(
'database.connections.mongodb.username'
,
'foo'
);
Config
::
set
(
'database.connections.mongodb.password'
,
'bar'
);
Config
::
set
(
'database.connections.mongodb.options.database'
,
'custom'
);
$connection
=
DB
::
connection
(
'mongodb'
);
$this
->
assertEquals
(
'mongodb://
127.0.0.1
/custom'
,
(
string
)
$connection
->
getMongoClient
());
$this
->
assertEquals
(
'mongodb://
'
.
$host
.
'
/custom'
,
(
string
)
$connection
->
getMongoClient
());
}
public
function
testCustomHostAndPort
()
...
...
tests/config/database.php
View file @
5a876398
...
...
@@ -7,15 +7,15 @@ return [
'mongodb'
=>
[
'name'
=>
'mongodb'
,
'driver'
=>
'mongodb'
,
'host'
=>
'
127.0.0.1
'
,
'host'
=>
'
mongodb
'
,
'database'
=>
'unittest'
,
],
'mysql'
=>
[
'driver'
=>
'mysql'
,
'host'
=>
'
127.0.0.1
'
,
'host'
=>
'
mysql
'
,
'database'
=>
'unittest'
,
'username'
=>
'
travis
'
,
'username'
=>
'
root
'
,
'password'
=>
''
,
'charset'
=>
'utf8'
,
'collation'
=>
'utf8_unicode_ci'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment