Skip to content

Commit b2de93c

Browse files
committed
Add support for pcov code coverage driver
1 parent 8254c34 commit b2de93c

5 files changed

Lines changed: 65 additions & 0 deletions

File tree

DOCUMENTATION/content/documentation/index.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,29 @@ For information on how to configure xDebug with your IDE and work it out, check
299299

300300

301301

302+
<br>
303+
<a name="Install-pcov"></a>
304+
## Install pcov
305+
306+
1 - First install `pcov` in the Workspace and the PHP-FPM Containers:
307+
<br>
308+
a) open the `.env` file
309+
<br>
310+
b) search for the `WORKSPACE_INSTALL_PCOV` argument under the Workspace Container
311+
<br>
312+
c) set it to `true`
313+
<br>
314+
d) search for the `PHP_FPM_INSTALL_PCOV` argument under the PHP-FPM Container
315+
<br>
316+
e) set it to `true`
317+
318+
2 - Re-build the containers `docker-compose build workspace php-fpm`
319+
320+
Note that pcov is only supported on PHP 7.1 or newer. For more information on setting up pcov optimally, check the recommended section
321+
of the [README](https://github.com/krakjoe/pcov)
322+
323+
324+
302325
<br>
303326
<a name="Control-xDebug"></a>
304327
## Start/Stop xDebug:

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ services:
5959
- LARADOCK_PHALCON_VERSION=${PHALCON_VERSION}
6060
- INSTALL_SUBVERSION=${WORKSPACE_INSTALL_SUBVERSION}
6161
- INSTALL_XDEBUG=${WORKSPACE_INSTALL_XDEBUG}
62+
- INSTALL_PCOV=${WORKSPACE_INSTALL_PCOV}
6263
- INSTALL_PHPDBG=${WORKSPACE_INSTALL_PHPDBG}
6364
- INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE}
6465
- INSTALL_SSH2=${WORKSPACE_INSTALL_SSH2}
@@ -148,6 +149,7 @@ services:
148149
- LARADOCK_PHP_VERSION=${PHP_VERSION}
149150
- LARADOCK_PHALCON_VERSION=${PHALCON_VERSION}
150151
- INSTALL_XDEBUG=${PHP_FPM_INSTALL_XDEBUG}
152+
- INSTALL_PCOV=${PHP_FPM_INSTALL_PCOV}
151153
- INSTALL_PHPDBG=${PHP_FPM_INSTALL_PHPDBG}
152154
- INSTALL_BLACKFIRE=${INSTALL_BLACKFIRE}
153155
- INSTALL_SSH2=${PHP_FPM_INSTALL_SSH2}

env-example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ WORKSPACE_INSTALL_PHPREDIS=true
9797
WORKSPACE_INSTALL_WORKSPACE_SSH=false
9898
WORKSPACE_INSTALL_SUBVERSION=false
9999
WORKSPACE_INSTALL_XDEBUG=false
100+
WORKSPACE_INSTALL_PCOV=true
100101
WORKSPACE_INSTALL_PHPDBG=false
101102
WORKSPACE_INSTALL_SSH2=false
102103
WORKSPACE_INSTALL_LDAP=false
@@ -157,6 +158,7 @@ PHP_FPM_INSTALL_IMAGE_OPTIMIZERS=true
157158
PHP_FPM_INSTALL_PHPREDIS=true
158159
PHP_FPM_INSTALL_MEMCACHED=false
159160
PHP_FPM_INSTALL_XDEBUG=false
161+
PHP_FPM_INSTALL_PCOV=false
160162
PHP_FPM_INSTALL_XHPROF=false
161163
PHP_FPM_INSTALL_PHPDBG=false
162164
PHP_FPM_INSTALL_IMAP=false

php-fpm/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,25 @@ RUN sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=1/" /usr/local/e
164164
sed -i "s/xdebug.remote_enable=0/xdebug.remote_enable=1/" /usr/local/etc/php/conf.d/xdebug.ini && \
165165
sed -i "s/xdebug.cli_color=0/xdebug.cli_color=1/" /usr/local/etc/php/conf.d/xdebug.ini
166166

167+
###########################################################################
168+
# pcov:
169+
###########################################################################
170+
171+
USER root
172+
173+
ARG INSTALL_PCOV=false
174+
175+
RUN if [ ${INSTALL_PCOV} = true ]; then \
176+
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \
177+
if [ $(php -r "echo PHP_MAJOR_VERSION;") != "0" ]; then \
178+
pecl install pcov && \
179+
echo "extension=pcov.so" >> /etc/php/${LARADOCK_PHP_VERSION}/cli/php.ini && \
180+
echo "pcov.enabled" >> /etc/php/${LARADOCK_PHP_VERSION}/cli/php.ini \
181+
;fi \
182+
;fi \
183+
;fi
184+
185+
167186
###########################################################################
168187
# Phpdbg:
169188
###########################################################################

workspace/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,25 @@ RUN sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=1/" /etc/php/${L
324324
sed -i "s/xdebug.remote_enable=0/xdebug.remote_enable=1/" /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/xdebug.ini && \
325325
sed -i "s/xdebug.cli_color=0/xdebug.cli_color=1/" /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/xdebug.ini
326326

327+
###########################################################################
328+
# pcov:
329+
###########################################################################
330+
331+
USER root
332+
333+
ARG INSTALL_PCOV=false
334+
335+
RUN if [ ${INSTALL_PCOV} = true ]; then \
336+
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \
337+
if [ $(php -r "echo PHP_MAJOR_VERSION;") != "0" ]; then \
338+
pecl install pcov && \
339+
echo "extension=pcov.so" >> /etc/php/${LARADOCK_PHP_VERSION}/cli/php.ini && \
340+
echo "pcov.enabled" >> /etc/php/${LARADOCK_PHP_VERSION}/cli/php.ini \
341+
;fi \
342+
;fi \
343+
;fi
344+
345+
327346
###########################################################################
328347
# Phpdbg:
329348
###########################################################################

0 commit comments

Comments
 (0)