innhold/Containerfile.test
Ruben b8e6d2537d Add browser and unit test suite with Pest + Playwright
Add comprehensive test coverage for core site features (content,
navigation, language, FAQ, news, petition, newsletter) using Pest
browser tests and unit tests for custom plugins. Includes test
infrastructure (Containerfile.test, compose.test.yaml), test
documentation, and test files covering petition form logic, CSV
handling, translation, date formatting, rate limiting, and map data
building.
2026-03-17 16:43:39 +01:00

32 lines
1.2 KiB
Text

FROM php:8.4-cli-bookworm
# System dependencies + PHP sockets extension (required by pest-plugin-browser)
RUN apt-get update && apt-get install -y \
git unzip curl \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-install sockets pcntl
# Node.js 22 LTS (required by pest-plugin-browser / Playwright)
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# WORKDIR matches where composer.json lives — Pest finds vendor/autoload.php here
# Tests are mounted at /app/tests via compose.test.yaml
WORKDIR /app
# Install PHP test dependencies
COPY tests/composer.json composer.json
RUN composer install --no-interaction --no-progress
# Install Playwright npm package (skip post-install browser download — we do it explicitly below)
RUN PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm install playwright
# Install Playwright browsers (Chromium) with OS-level dependencies
ENV PLAYWRIGHT_BROWSERS_PATH=/opt/playwright
RUN ./node_modules/.bin/playwright install --with-deps chromium
ENTRYPOINT ["/app/vendor/bin/pest"]