I'm running PHPUnit tests inside the Pipeline and one of the tests is using the iconv ext. to convert for example a german "ä" into "ae". Inside the Pipeline (based on PHP 7.2) this test return always a empty string.
My last try:
image: php:7.2-cli
pipelines:
default:
- step:
caches:
- composer
script:
- apt-get clean
- apt-get update -y
- apt-get install -y locales unzip zlib1g-dev libicu-dev
- printf 'en_US.UTF-8 UTF-8\n' >> /etc/locale.gen
- locale-gen
- dpkg-reconfigure --frontend noninteractive locales
- docker-php-ext-install bcmath
- docker-php-ext-enable bcmath
- docker-php-ext-install intl
- docker-php-ext-enable intl
- docker-php-ext-install mbstring
- docker-php-ext-enable mbstring
- docker-php-ext-install iconv
- docker-php-ext-enable iconv
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- vendor/bin/phpunit
The test script:
echo iconv('UTF-8', 'ASCII//TRANSLIT', 'ÄäÖöÜü');
Expected: 'AaOoUu'
Actual: ''
My problem was with phpunit and some env config. If I executed plain php it will work. To make my tests pass what finally worked was:
apt-get install locales
localedef -i en_US -f UTF-8 en_US.UTF-8
For anyone needing the full script to run a symfony project:
- echo "memory_limit = 512M" > $PHP_INI_DIR/conf.d/php-memory-limits.ini
- apt-get update && apt-get install -y libc-bin libonig-dev libfreetype-dev libjpeg62-turbo-dev libpng-dev default-mysql-client unzip libicu-dev locales
- docker-php-ext-configure gd --with-freetype --with-jpeg && docker-php-ext-install -j$(nproc) gd
- docker-php-ext-install pdo_mysql
- docker-php-ext-configure intl && docker-php-ext-install intl
- pecl install mailparse && docker-php-ext-enable mailparse
- localedef -i en_US -f UTF-8 en_US.UTF-8
# app config
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- cp app/config/parameters.yml.dist app/config/parameters.yml
- export SYMFONY_ENV=test
- composer require composer/package-versions-deprecated
- cp phpunit.xml.dist phpunit.xml
- vendor/bin/phpunit
- vendor/bin/phpstan analyse src
- echo "DONE!"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.