Use PHPUnit for CI Automation

Hi everybody,

I recently try Space for manage PHP projects.
I want to do those jobs after push on any branch :

  • use composer to install dependencies ;
  • call phpUnit functions to test all asserts

But when I try to define that, nothing work !

Anybody had a response or a similar problem to help me to fund a solution ?

Thank you for all.

0
2 comments

Hi Ronald, thanks for the question! May I ask you to share your .space.kts script with us?

0

Yes, no prob!

job("Run shell script") {
container(displayName = "Run Test", image = "justinhartman/cakephp3.5-php7-mysql-apache2") {
shellScript {
interpreter = "/bin/bash"
content = """
export TZ=Europe/Paris
apt-get update -yqq
DEBIAN_FRONTEND=noninteractive apt-get install git libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev -yqq
docker-php-ext-install mbstring mcrypt pdo_mysql curl json intl gd xml zip bz2 opcache

apt-get install curl -yqq
curl -sS https://getcomposer.org/installer | php
php composer.phar install -n

cp config/app.default.php config/app.php
mkdir logs/ && chmod 777 logs/
./vendor/bin/phpunit
"""
}
}
}

Thank you for your help!

0

Please sign in to leave a comment.