最近我决定检查一下 Symfony Panther HTTP 客户端。我认为将它集成到测试和事物中会很好。
我确实非常仔细地遵循了文档。我已经为 PHP 单元注册了它的扩展。在扩展 Panther 测试用例后,我可以创建一个 Panther 客户端 - 没问题。
当我尝试拨打实际电话时出现问题。比方说:
$client = static::createPantherClient([ "--no-sandbox", "--headless", "window-size=1024,768"]);
$client->request('GET', '/mypage');
数组中的这些选项 - 我只是在尝试,我认为它可能会有所帮助。我得到的错误如下:
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.)
我确实查看了文档和 SO 以寻求解决方案,但我真的找不到任何可以帮助我的东西。
有谁知道为什么会这样?
这是我的 PHP Dockerfile
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