Recently I've decided to check out the Symfony Panther HTTP Client. I thought it would be nice to integrate that for testing and things.
I did follow the documentation very carefully. I have registered its extension for PHP unit. I can create a Panther client after extending the Panther Test Case - no problem there.
Problem shows when I try to make an actual call. Let's say:
$client = static::createPantherClient([ "--no-sandbox", "--headless", "window-size=1024,768"]);
$client->request('GET', '/mypage');
These options in the array - I was just trying things out, I thought it might help. The error I am getting is as follows:
1) App\Tests\Integration\Container\Controllers\ContainerControllerTest::test_read_container_by_slug
Facebook\WebDriver\Exception\UnknownErrorException: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/lib/chromium/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
I did look at the docs and SO for a solution but I can't really find anything that would help me.
Does anyone know why this is happening?
This is my Dockerfile for PHP
FROM php:7.4.3-fpm-alpine
WORKDIR /srv/app/
RUN apk update
RUN echo "extension=pdo_mysql" >> /usr/local/etc/php/php.ini-development
RUN docker-php-ext-install -j$(nproc) pdo_mysql
# php-redis
ENV PHPREDIS_VERSION 5.0.2
RUN docker-php-source extract \
&& curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/$PHPREDIS_VERSION.tar.gz \
&& tar xfz /tmp/redis.tar.gz \
&& rm -r /tmp/redis.tar.gz \
&& mv phpredis-$PHPREDIS_VERSION /usr/src/php/ext/redis \
&& docker-php-ext-install redis \
&& docker-php-source delete
RUN apk add --no-cache \
unzip \
chromium \
chromium-chromedriver
ENV PANTHER_CHROME_DRIVER_BINARY /usr/lib/chromium/chromedriver
RUN docker-php-ext-install opcache
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
COPY conf/opcache.ini /usr/local/etc/php/conf.d/opcache.ini