File tree Expand file tree Collapse file tree 4 files changed +64
-2
lines changed
tests/unit/Codeception/Module/Db Expand file tree Collapse file tree 4 files changed +64
-2
lines changed Original file line number Diff line number Diff line change 5
5
/Robofile.php export-ignore
6
6
/* .md export-ignore
7
7
/* .yml export-ignore
8
+ /* .Dockerfile export-ignore
Original file line number Diff line number Diff line change
1
+ version : " 3.9"
2
+
3
+ services :
4
+ php81 :
5
+ image : codeception-module-db-php81:2.2.0
6
+ build :
7
+ context : .
8
+ dockerfile : ./php81.Dockerfile
9
+ environment :
10
+ MYSQL_DSN : " mysql:host=host.docker.internal;port=3102;dbname=codeception"
11
+ MYSQL_USER : root
12
+ MYSQL_PASSWORD : codeception
13
+ XDEBUG_MODE : " debug"
14
+ XDEBUG_CONFIG : " client_host=host.docker.internal; client_port=9000; mode=debug; start_wih_request=1"
15
+ PHP_IDE_CONFIG : " serverName=codeception-module-db" # the name must be the same as in your PHP -> Server -> "name" field
16
+ volumes :
17
+ - " .:/var/www/html"
18
+
19
+ mariadb105 :
20
+ image : mariadb:10.5
21
+ environment :
22
+ MARIADB_ROOT_PASSWORD : codeception
23
+ MARIADB_DATABASE : codeception
24
+ ports :
25
+ - " 3102:3306"
26
+
Original file line number Diff line number Diff line change
1
+ FROM php:8.1-cli
2
+
3
+ RUN apt-get update && \
4
+ apt-get install -y \
5
+ unzip \
6
+ wget \
7
+ git \
8
+ zlib1g-dev \
9
+ libzip-dev \
10
+ mariadb-client-10.5
11
+
12
+ RUN docker-php-ext-install pdo pdo_mysql && docker-php-ext-enable pdo pdo_mysql
13
+ RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
14
+ RUN docker-php-ext-install zip
15
+
16
+ RUN pecl install xdebug-3.1.5 && \
17
+ echo zend_extension=xdebug.so > $PHP_INI_DIR/conf.d/xdebug.ini
18
+
19
+ COPY --from=composer /usr/bin/composer /usr/bin/composer
20
+
21
+ WORKDIR /var/www/html
22
+
23
+ COPY composer.json .
24
+ COPY composer.lock .
25
+
26
+ RUN composer install --no-autoloader
27
+
28
+ COPY . .
29
+
30
+ RUN composer dump-autoload -o
31
+
32
+ ENTRYPOINT ["tail" ]
33
+ CMD ["-f" , "/dev/null" ]
Original file line number Diff line number Diff line change @@ -23,11 +23,13 @@ public function getPopulator(): string
23
23
public function getConfig (): array
24
24
{
25
25
$ host = getenv ('MYSQL_HOST ' ) ? getenv ('MYSQL_HOST ' ) : 'localhost ' ;
26
+ $ user = getenv ('MYSQL_USER ' ) ? getenv ('MYSQL_USER ' ) : 'root ' ;
26
27
$ password = getenv ('MYSQL_PASSWORD ' ) ? getenv ('MYSQL_PASSWORD ' ) : '' ;
28
+ $ dsn = getenv ('MYSQL_DSN ' ) ? getenv ('MYSQL_DSN ' ) : 'mysql:host= ' .$ host .';dbname=codeception_test ' ;
27
29
28
30
return [
29
- 'dsn ' => ' mysql:host= ' . $ host . ' ;dbname=codeception_test ' ,
30
- 'user ' => ' root ' ,
31
+ 'dsn ' => $ dsn ,
32
+ 'user ' => $ user ,
31
33
'password ' => $ password ,
32
34
'dump ' => 'tests/data/dumps/mysql.sql ' ,
33
35
'reconnect ' => true ,
You can’t perform that action at this time.
0 commit comments