File tree Expand file tree Collapse file tree 5 files changed +49
-4
lines changed Expand file tree Collapse file tree 5 files changed +49
-4
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,15 @@ Embedded relations now return an `Illuminate\Database\Eloquent\Collection` rathe
103103$books = $user->books()->sortBy('title');
104104```
105105
106+ Testing
107+ -------
108+
109+ To run the test for this package, run:
110+
111+ ```
112+ docker-compose up
113+ ```
114+
106115Configuration
107116-------------
108117
Original file line number Diff line number Diff line change 1+ version : ' 3'
2+
3+ services :
4+
5+ php :
6+ build :
7+ context : .
8+ dockerfile : docker/Dockerfile
9+ volumes :
10+ - .:/code
11+ working_dir : /code
12+ command : php ./vendor/bin/phpunit
13+ depends_on :
14+ - mysql
15+ - mongodb
16+
17+ mysql :
18+ image : mysql
19+ environment :
20+ MYSQL_ROOT_PASSWORD :
21+ MYSQL_DATABASE : unittest
22+ MYSQL_ALLOW_EMPTY_PASSWORD : ' yes'
23+ logging :
24+ driver : none
25+
26+ mongodb :
27+ image : mongo
28+ logging :
29+ driver : none
Original file line number Diff line number Diff line change 1+ FROM php:7.1-cli
2+
3+ 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
Original file line number Diff line number Diff line change @@ -98,12 +98,13 @@ public function testDriverName()
9898
9999 public function testAuth ()
100100 {
101+ $ host = Config::get ('database.connections.mongodb.host ' );
101102 Config::set ('database.connections.mongodb.username ' , 'foo ' );
102103 Config::set ('database.connections.mongodb.password ' , 'bar ' );
103104 Config::set ('database.connections.mongodb.options.database ' , 'custom ' );
104105
105106 $ connection = DB ::connection ('mongodb ' );
106- $ this ->assertEquals ('mongodb://127.0.0.1 /custom ' , (string ) $ connection ->getMongoClient ());
107+ $ this ->assertEquals ('mongodb:// ' . $ host . ' /custom ' , (string ) $ connection ->getMongoClient ());
107108 }
108109
109110 public function testCustomHostAndPort ()
Original file line number Diff line number Diff line change 77 'mongodb ' => [
88 'name ' => 'mongodb ' ,
99 'driver ' => 'mongodb ' ,
10- 'host ' => '127.0.0.1 ' ,
10+ 'host ' => 'mongodb ' ,
1111 'database ' => 'unittest ' ,
1212 ],
1313
1414 'mysql ' => [
1515 'driver ' => 'mysql ' ,
16- 'host ' => '127.0.0.1 ' ,
16+ 'host ' => 'mysql ' ,
1717 'database ' => 'unittest ' ,
18- 'username ' => 'travis ' ,
18+ 'username ' => 'root ' ,
1919 'password ' => '' ,
2020 'charset ' => 'utf8 ' ,
2121 'collation ' => 'utf8_unicode_ci ' ,
You can’t perform that action at this time.
0 commit comments