Skip to content

Commit fd2dbd2

Browse files
authored
Fix tests (#2)
- Fixes and adds more tests - Removes unnecessary items from the packagist export - Fixes method for passing options along to browsers
1 parent b762f33 commit fd2dbd2

20 files changed

+620
-365
lines changed

.ddev/config.yaml

Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
name: php-webdriver
2+
type: php
3+
docroot: ""
4+
php_version: "8.1"
5+
webserver_type: nginx-fpm
6+
xdebug_enabled: false
7+
additional_hostnames: []
8+
additional_fqdns: []
9+
database:
10+
type: mariadb
11+
version: "10.4"
12+
use_dns_when_possible: true
13+
composer_version: "2"
14+
web_environment: []
15+
nodejs_version: "18"
16+
webimage_extra_packages:
17+
- chromium-driver
18+
- firefox-esr
19+
web_extra_daemons:
20+
- name: "chromedriver"
21+
command: "/usr/bin/chromedriver --verbose"
22+
directory: "/usr/bin"
23+
- name: "geckodriver"
24+
command: "/usr/local/bin/geckodriver -b /usr/bin/firefox"
25+
directory: "/usr/local/bin/"
26+
27+
# Key features of ddev's config.yaml:
28+
29+
# name: <projectname> # Name of the project, automatically provides
30+
# http://projectname.ddev.site and https://projectname.ddev.site
31+
32+
# type: <projecttype> # drupal6/7/8, backdrop, typo3, wordpress, php
33+
34+
# docroot: <relative_path> # Relative path to the directory containing index.php.
35+
36+
# php_version: "8.1" # PHP version to use, "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2"
37+
38+
# You can explicitly specify the webimage but this
39+
# is not recommended, as the images are often closely tied to ddev's' behavior,
40+
# so this can break upgrades.
41+
42+
# webimage: <docker_image> # nginx/php docker image.
43+
44+
# database:
45+
# type: <dbtype> # mysql, mariadb, postgres
46+
# version: <version> # database version, like "10.4" or "8.0"
47+
# mariadb versions can be 5.5-10.8 and 10.11, mysql versions can be 5.5-8.0
48+
# postgres versions can be 9-15.
49+
50+
# router_http_port: <port> # Port to be used for http (defaults to global configuration, usually 80)
51+
# router_https_port: <port> # Port for https (defaults to global configuration, usually 443)
52+
53+
# xdebug_enabled: false # Set to true to enable xdebug and "ddev start" or "ddev restart"
54+
# Note that for most people the commands
55+
# "ddev xdebug" to enable xdebug and "ddev xdebug off" to disable it work better,
56+
# as leaving xdebug enabled all the time is a big performance hit.
57+
58+
# xhprof_enabled: false # Set to true to enable xhprof and "ddev start" or "ddev restart"
59+
# Note that for most people the commands
60+
# "ddev xhprof" to enable xhprof and "ddev xhprof off" to disable it work better,
61+
# as leaving xhprof enabled all the time is a big performance hit.
62+
63+
# webserver_type: nginx-fpm, apache-fpm, or nginx-gunicorn
64+
65+
# timezone: Europe/Berlin
66+
# This is the timezone used in the containers and by PHP;
67+
# it can be set to any valid timezone,
68+
# see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
69+
# For example Europe/Dublin or MST7MDT
70+
71+
# composer_root: <relative_path>
72+
# Relative path to the composer root directory from the project root. This is
73+
# the directory which contains the composer.json and where all Composer related
74+
# commands are executed.
75+
76+
# composer_version: "2"
77+
# You can set it to "" or "2" (default) for Composer v2 or "1" for Composer v1
78+
# to use the latest major version available at the time your container is built.
79+
# It is also possible to use each other Composer version channel. This includes:
80+
# - 2.2 (latest Composer LTS version)
81+
# - stable
82+
# - preview
83+
# - snapshot
84+
# Alternatively, an explicit Composer version may be specified, for example "2.2.18".
85+
# To reinstall Composer after the image was built, run "ddev debug refresh".
86+
87+
# nodejs_version: "18"
88+
# change from the default system Node.js version to another supported version, like 14, 16, 18, 20.
89+
# Note that you can use 'ddev nvm' or nvm inside the web container to provide nearly any
90+
# Node.js version, including v6, etc.
91+
92+
# additional_hostnames:
93+
# - somename
94+
# - someothername
95+
# would provide http and https URLs for "somename.ddev.site"
96+
# and "someothername.ddev.site".
97+
98+
# additional_fqdns:
99+
# - example.com
100+
# - sub1.example.com
101+
# would provide http and https URLs for "example.com" and "sub1.example.com"
102+
# Please take care with this because it can cause great confusion.
103+
104+
# upload_dirs: "custom/upload/dir"
105+
#
106+
# upload_dirs:
107+
# - custom/upload/dir
108+
# - ../private
109+
#
110+
# would set the destination paths for ddev import-files to <docroot>/custom/upload/dir
111+
# When mutagen is enabled this path is bind-mounted so that all the files
112+
# in the upload_dirs don't have to be synced into mutagen.
113+
114+
# disable_upload_dirs_warning: false
115+
# If true, turns off the normal warning that says
116+
# "You have Mutagen enabled and your 'php' project type doesn't have upload_dirs set"
117+
118+
# working_dir:
119+
# web: /var/www/html
120+
# db: /home
121+
# would set the default working directory for the web and db services.
122+
# These values specify the destination directory for ddev ssh and the
123+
# directory in which commands passed into ddev exec are run.
124+
125+
# omit_containers: [db, ddev-ssh-agent]
126+
# Currently only these containers are supported. Some containers can also be
127+
# omitted globally in the ~/.ddev/global_config.yaml. Note that if you omit
128+
# the "db" container, several standard features of ddev that access the
129+
# database container will be unusable. In the global configuration it is also
130+
# possible to omit ddev-router, but not here.
131+
132+
# performance_mode: "global"
133+
# DDEV offers performance optimization strategies to improve the filesystem
134+
# performance depending on your host system. Should be configured globally.
135+
#
136+
# If set, will override the global config. Possible values are:
137+
# - "global": uses the value from the global config.
138+
# - "none": disables performance optimization for this project.
139+
# - "mutagen": enables Mutagen for this project.
140+
# - "nfs": enables NFS for this project.
141+
#
142+
# See https://ddev.readthedocs.io/en/latest/users/install/performance/#nfs
143+
# See https://ddev.readthedocs.io/en/latest/users/install/performance/#mutagen
144+
145+
# fail_on_hook_fail: False
146+
# Decide whether 'ddev start' should be interrupted by a failing hook
147+
148+
# host_https_port: "59002"
149+
# The host port binding for https can be explicitly specified. It is
150+
# dynamic unless otherwise specified.
151+
# This is not used by most people, most people use the *router* instead
152+
# of the localhost port.
153+
154+
# host_webserver_port: "59001"
155+
# The host port binding for the ddev-webserver can be explicitly specified. It is
156+
# dynamic unless otherwise specified.
157+
# This is not used by most people, most people use the *router* instead
158+
# of the localhost port.
159+
160+
# host_db_port: "59002"
161+
# The host port binding for the ddev-dbserver can be explicitly specified. It is dynamic
162+
# unless explicitly specified.
163+
164+
# mailhog_port: "8025"
165+
# mailhog_https_port: "8026"
166+
# The MailHog ports can be changed from the default 8025 and 8026
167+
168+
# host_mailhog_port: "8025"
169+
# The mailhog port is not normally bound on the host at all, instead being routed
170+
# through ddev-router, but it can be bound directly to localhost if specified here.
171+
172+
# webimage_extra_packages: [php7.4-tidy, php-bcmath]
173+
# Extra Debian packages that are needed in the webimage can be added here
174+
175+
# dbimage_extra_packages: [telnet,netcat]
176+
# Extra Debian packages that are needed in the dbimage can be added here
177+
178+
# use_dns_when_possible: true
179+
# If the host has internet access and the domain configured can
180+
# successfully be looked up, DNS will be used for hostname resolution
181+
# instead of editing /etc/hosts
182+
# Defaults to true
183+
184+
# project_tld: ddev.site
185+
# The top-level domain used for project URLs
186+
# The default "ddev.site" allows DNS lookup via a wildcard
187+
# If you prefer you can change this to "ddev.local" to preserve
188+
# pre-v1.9 behavior.
189+
190+
# ngrok_args: --basic-auth username:pass1234
191+
# Provide extra flags to the "ngrok http" command, see
192+
# https://ngrok.com/docs/ngrok-agent/config or run "ngrok http -h"
193+
194+
# disable_settings_management: false
195+
# If true, ddev will not create CMS-specific settings files like
196+
# Drupal's settings.php/settings.ddev.php or TYPO3's AdditionalConfiguration.php
197+
# In this case the user must provide all such settings.
198+
199+
# You can inject environment variables into the web container with:
200+
# web_environment:
201+
# - SOMEENV=somevalue
202+
# - SOMEOTHERENV=someothervalue
203+
204+
# no_project_mount: false
205+
# (Experimental) If true, ddev will not mount the project into the web container;
206+
# the user is responsible for mounting it manually or via a script.
207+
# This is to enable experimentation with alternate file mounting strategies.
208+
# For advanced users only!
209+
210+
# bind_all_interfaces: false
211+
# If true, host ports will be bound on all network interfaces,
212+
# not just the localhost interface. This means that ports
213+
# will be available on the local network if the host firewall
214+
# allows it.
215+
216+
# default_container_timeout: 120
217+
# The default time that ddev waits for all containers to become ready can be increased from
218+
# the default 120. This helps in importing huge databases, for example.
219+
220+
#web_extra_exposed_ports:
221+
#- name: nodejs
222+
# container_port: 3000
223+
# http_port: 2999
224+
# https_port: 3000
225+
#- name: something
226+
# container_port: 4000
227+
# https_port: 4000
228+
# http_port: 3999
229+
# Allows a set of extra ports to be exposed via ddev-router
230+
# Fill in all three fields even if you don’t intend to use the https_port!
231+
# If you don’t add https_port, then it defaults to 0 and ddev-router will fail to start.
232+
#
233+
# The port behavior on the ddev-webserver must be arranged separately, for example
234+
# using web_extra_daemons.
235+
# For example, with a web app on port 3000 inside the container, this config would
236+
# expose that web app on https://<project>.ddev.site:9999 and http://<project>.ddev.site:9998
237+
# web_extra_exposed_ports:
238+
# - name: myapp
239+
# container_port: 3000
240+
# http_port: 9998
241+
# https_port: 9999
242+
243+
#web_extra_daemons:
244+
#- name: "http-1"
245+
# command: "/var/www/html/node_modules/.bin/http-server -p 3000"
246+
# directory: /var/www/html
247+
#- name: "http-2"
248+
# command: "/var/www/html/node_modules/.bin/http-server /var/www/html/sub -p 3000"
249+
# directory: /var/www/html
250+
251+
# override_config: false
252+
# By default, config.*.yaml files are *merged* into the configuration
253+
# But this means that some things can't be overridden
254+
# For example, if you have 'nfs_mount_enabled: true'' you can't override it with a merge
255+
# and you can't erase existing hooks or all environment variables.
256+
# However, with "override_config: true" in a particular config.*.yaml file,
257+
# 'nfs_mount_enabled: false' can override the existing values, and
258+
# hooks:
259+
# post-start: []
260+
# or
261+
# web_environment: []
262+
# or
263+
# additional_hostnames: []
264+
# can have their intended affect. 'override_config' affects only behavior of the
265+
# config.*.yaml file it exists in.
266+
267+
# Many ddev commands can be extended to run tasks before or after the
268+
# ddev command is executed, for example "post-start", "post-import-db",
269+
# "pre-composer", "post-composer"
270+
# See https://ddev.readthedocs.io/en/stable/users/extend/custom-commands/ for more
271+
# information on the commands that can be extended and the tasks you can define
272+
# for them. Example:
273+
#hooks:

.ddev/docker-compose.selenium.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
version: '3.6'
2+
3+
services:
4+
firefox:
5+
container_name: ddev-${DDEV_SITENAME}-firefox
6+
image: selenium/standalone-firefox:latest
7+
labels:
8+
com.ddev.site-name: ${DDEV_SITENAME}
9+
com.ddev.approot: $DDEV_APPROOT
10+
shm_size: 2gb
11+
environment:
12+
- VIRTUAL_HOST=$DDEV_HOSTNAME
13+
links:
14+
- web:web
15+
external_links:
16+
- ddev-router:${DDEV_SITENAME}.${DDEV_TLD}
17+
volumes:
18+
- ".:/mnt/ddev_config:ro"
19+
- ddev-global-cache:/mnt/ddev-global-cache
20+
chrome:
21+
container_name: ddev-${DDEV_SITENAME}-chrome
22+
image: selenium/standalone-chrome:latest
23+
labels:
24+
com.ddev.site-name: ${DDEV_SITENAME}
25+
com.ddev.approot: $DDEV_APPROOT
26+
shm_size: 2gb
27+
environment:
28+
- VIRTUAL_HOST=$DDEV_HOSTNAME
29+
links:
30+
- web:web
31+
external_links:
32+
- ddev-router:${DDEV_SITENAME}.${DDEV_TLD}
33+
volumes:
34+
- ".:/mnt/ddev_config:ro"
35+
- ddev-global-cache:/mnt/ddev-global-cache

.ddev/web-build/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
RUN URL=$(curl -s -f https://api.github.com/repos/mozilla/geckodriver/releases/latest | jq -r '.assets[].browser_download_url | select(contains("linux64") and endswith("gz"))') && \
2+
curl -s -L $URL | tar -xz && \
3+
mv geckodriver /usr/local/bin/ && \
4+
chmod +x /usr/local/bin/geckodriver

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/.ddev export-ignore
2+
/.github export-ignore
3+
/test export-ignore
4+
/phpdoc.dist.xml export-ignore
5+
/phpstan.neon.dist export-ignore
6+
/phpunit.xml.dist export-ignore

.github/workflows/Tests.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Tests
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
push:
7+
branches:
8+
- main
9+
schedule:
10+
- cron: '0 0 * * *' # every day at midnight
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
Tests:
18+
runs-on: ubuntu-latest
19+
20+
strategy:
21+
matrix:
22+
php: [ '7.4', '8.0', '8.1', '8.2' ]
23+
fail-fast: false
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
28+
- uses: ddev/github-action-setup-ddev@v1
29+
30+
- name: Setup PHP Version
31+
run: ddev config --php-version ${{ matrix.php }}
32+
33+
- name: Install dependencies
34+
run: ddev composer install
35+
36+
- name: Run tests
37+
run: ddev exec phpunit --log-junit phpunit-results.xml

0 commit comments

Comments
 (0)