Skip to content

Commit 6f3b742

Browse files
committed
added local test env using docker
1 parent a548d1f commit 6f3b742

File tree

4 files changed

+50
-6
lines changed

4 files changed

+50
-6
lines changed

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM php:7.4-alpine3.13
2+
3+
RUN mkdir /app
4+
5+
WORKDIR /app
6+
7+
# Install Git, NPM & needed libraries
8+
RUN apk update \
9+
&& apk add bash git nodejs npm gettext subversion mysql mysql-client zip \
10+
&& rm -f /var/cache/apk/*
11+
12+
RUN docker-php-ext-install mysqli
13+
14+
# Install Composer
15+
RUN EXPECTED_CHECKSUM=$(curl -s https://composer.github.io/installer.sig) \
16+
&& curl https://getcomposer.org/installer -o composer-setup.php \
17+
&& ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" \
18+
&& if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then >&2 echo 'ERROR: Invalid installer checksum'; rm composer-setup.php; exit 1; fi \
19+
&& php composer-setup.php --quiet \
20+
&& php -r "unlink('composer-setup.php');" \
21+
&& mv composer.phar /usr/local/bin/composer
22+
23+
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \
24+
chmod +x wp-cli.phar && \
25+
mv wp-cli.phar /usr/local/bin/wp
26+
27+
RUN chmod +x -R ./

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232
"installer-name": "activitypub"
3333
},
3434
"scripts": {
35-
"test": [
36-
"composer install",
37-
"bin/install-wp-tests.sh wordpress wordpress wordpress",
38-
"vendor/bin/phpunit"
39-
]
35+
"test": [
36+
"composer install",
37+
"bin/install-wp-tests.sh activitypub-test root activitypub-test test-db latest true",
38+
"vendor/bin/phpunit"
39+
]
4040
}
4141
}

docker-compose-test.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: '2'
2+
services:
3+
test-db:
4+
image: mysql:5.7
5+
environment:
6+
MYSQL_DATABASE: activitypub-test
7+
MYSQL_ROOT_PASSWORD: activitypub-test
8+
9+
test-php:
10+
build:
11+
context: .
12+
dockerfile: Dockerfile
13+
links:
14+
- test-db
15+
volumes:
16+
- .:/app
17+
command: ["composer", "run-script", "test"]

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
convertWarningsToExceptions="true"
88
>
99
<testsuites>
10-
<testsuite>
10+
<testsuite name="ActivityPub">
1111
<directory prefix="test-" suffix=".php">./tests/</directory>
1212
</testsuite>
1313
</testsuites>

0 commit comments

Comments
 (0)