Skip to content

Commit 1664a32

Browse files
committed
Initial bootstrap of the plugin.
1 parent fb6995c commit 1664a32

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+13971
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/.devcontainer
2+
/.git
3+
/.github
4+
/.idea
5+
/.log
6+
/.vscode
7+
/.wordpress-org
8+
/bin
9+
/docker
10+
/docker-output
11+
/docs
12+
/img
13+
/phpstan
14+
/plugin-build
15+
/tests
16+
17+
.coveralls.yml
18+
.distignore
19+
.dockerignore
20+
.DS_Store
21+
.env
22+
.env.dist
23+
.gitattributes
24+
.gitignore
25+
.phpcs.xml
26+
.phpcs.xml.dist
27+
.travis.yml
28+
CHANGELOG.md
29+
codeception.dist.yml
30+
codeception.yml
31+
composer.json
32+
composer.lock
33+
docker-compose.yml
34+
phpstan.neon.dist
35+
README.md
36+
schema.graphql
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
###############################################################################
2+
# Pre-configured WordPress Installation w/ WPGraphQL Velocity Plugin
3+
# For testing only, use in production not recommended. #
4+
###############################################################################
5+
6+
# Use build args to get the right wordpress + php image
7+
ARG WP_VERSION
8+
ARG PHP_VERSION
9+
10+
FROM wordpress:${WP_VERSION:-6.8}-php${PHP_VERSION:-8.2}
11+
12+
# Needed to specify the build args again after the FROM command.
13+
ARG WP_VERSION
14+
ARG PHP_VERSION
15+
16+
# Save the build args for use by the runtime environment
17+
ENV WP_VERSION=${WP_VERSION}
18+
ENV PHP_VERSION=${PHP_VERSION}
19+
20+
SHELL [ "/bin/bash", "-c" ]
21+
22+
# Install required packages
23+
RUN apt-get update && \
24+
apt-get -y install \
25+
git \
26+
ssh \
27+
tar \
28+
gzip \
29+
mariadb-client \
30+
net-tools
31+
32+
# Needed for Codeception WPDB test integration.
33+
RUN docker-php-ext-install pdo pdo_mysql
34+
35+
# Install XDebug 3
36+
RUN if [[ $PHP_VERSION == 7* ]]; then pecl install xdebug-3.1.5; else pecl install xdebug; fi \
37+
&& mkdir -p /usr/local/etc/php/conf.d/disabled \
38+
&& echo "zend_extension=xdebug" > /usr/local/etc/php/conf.d/disabled/docker-php-ext-xdebug.ini \
39+
&& echo "xdebug.mode=develop,debug,coverage" >> /usr/local/etc/php/conf.d/disabled/docker-php-ext-xdebug.ini \
40+
&& echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/disabled/docker-php-ext-xdebug.ini \
41+
&& echo "xdebug.client_host=host.docker.internal" >> /usr/local/etc/php/conf.d/disabled/docker-php-ext-xdebug.ini \
42+
&& echo "xdebug.client_port=9003" >> /usr/local/etc/php/conf.d/disabled/docker-php-ext-xdebug.ini \
43+
&& echo "xdebug.max_nesting_level=512" >> /usr/local/etc/php/conf.d/disabled/docker-php-ext-xdebug.ini \
44+
;
45+
46+
# Set xdebug configuration off by default. Set USING_XDEBUG=1 in the runtime environment to enable it.
47+
ENV USING_XDEBUG=0
48+
49+
# Install PCOV
50+
# This is needed for Codeception / PHPUnit to track code coverage
51+
RUN apt-get install zip unzip -y \
52+
&& pecl install pcov
53+
54+
# Install Dockerize
55+
ENV DOCKERIZE_VERSION=v0.7.0
56+
RUN curl -L -O https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
57+
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
58+
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
59+
60+
# Install composer
61+
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
62+
RUN chmod +x /usr/local/bin/composer
63+
64+
# Install WP-CLI
65+
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
66+
&& chmod +x wp-cli.phar \
67+
&& mv wp-cli.phar /usr/local/bin/wp
68+
69+
# Install nvm, Node.js, and npm
70+
ENV NVM_DIR=/usr/local/nvm
71+
ENV NODE_VERSION=20
72+
73+
RUN mkdir -p $NVM_DIR
74+
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash \
75+
&& . $NVM_DIR/nvm.sh \
76+
&& nvm install $NODE_VERSION \
77+
&& nvm use $NODE_VERSION \
78+
&& nvm alias default $NODE_VERSION \
79+
&& npm install -g npm
80+
81+
# Setup the container for testing
82+
COPY init-docker.sh /usr/local/bin/
83+
RUN chmod +x /usr/local/bin/init-docker.sh
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
# Exit if any command fails.
4+
set -e
5+
6+
# Wait for the database
7+
dockerize -wait tcp://"${WORDPRESS_DB_HOST}":3306 -timeout 1m
8+
9+
# Get the current user
10+
11+
cd "$WORDPRESS_ROOT_DIR/wp-content/plugins/$PLUGIN_SLUG"
12+
13+
# Load NVM
14+
source $NVM_DIR/nvm.sh
15+
nvm use $NODE_VERSION
16+
17+
# Setup the test environment
18+
chmod +x ./bin/install-test-env.sh
19+
20+
bash -c "./bin/install-test-env.sh"
21+
22+
echo "Setting permissions"
23+
chmod -R 777 "$WORDPRESS_ROOT_DIR/wp-content/plugins/$PLUGIN_SLUG"
24+
25+
# Go back to the root directory
26+
cd "$WORDPRESS_ROOT_DIR"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
4+
# WordPress Coding Standards
5+
# https://make.wordpress.org/core/handbook/coding-standards/
6+
7+
root = true
8+
9+
[*]
10+
charset = utf-8
11+
end_of_line = lf
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
indent_style = tab
15+
16+
17+
[*.md]
18+
trim_trailing_whitespace = false
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
PLUGIN_SLUG=wpgraphql-velocity
2+
3+
# Configure these to match your existing testing environment or the one you want to create with Docker.
4+
## Usually, these values should match the ones in the `wp-config.php` file.
5+
## If using Local by Flywheel, you can `open AdminerEvo` and find the values in the URL: `http://localhost:{DB_PORT}/?username={DB_USER}&db={DB_NAME}`
6+
## NOTE: Codeception may modify or the database during testing. If you want to preserve your local data, create a new database and use that for the `DB_NAME`.
7+
DB_NAME=wordpress
8+
# localhost creates issues with wp config create command
9+
DB_HOST=127.0.0.1
10+
DB_USER=root
11+
DB_PASSWORD=password
12+
DB_PORT=3306
13+
14+
# The local path to the WordPress root directory, the one containing the wp-load.php file.
15+
## This can be a relative path from the directory that contains the codeception.yml file, or an absolute path.
16+
## If you are using Local by Flywheel, you can find the path in the Local by Flywheel app under the site's settings.
17+
WORDPRESS_ROOT_DIR="/tmp/wordpress"
18+
19+
# This table prefix used by the WordPress site, and in Acceptance tests.
20+
WORDPRESS_TABLE_PREFIX=wp_
21+
22+
# The URL and domain of the WordPress site, and in Acceptance tests.
23+
## If the port is in use, you can change it to a different port.
24+
WORDPRESS_URL=http://localhost
25+
WORDPRESS_DOMAIN=localhost
26+
WORDPRESS_ADMIN_PATH=/wp-admin
27+
28+
# The username and password of the administrator user of the WordPress site, and in Acceptance tests.
29+
WORDPRESS_ADMIN_USER=admin
30+
WORDPRESS_ADMIN_PASSWORD=password
31+
32+
33+
# Tests will require a MySQL database to run.
34+
# Do not use a database that contains important data!
35+
WORDPRESS_DB_HOST=${DB_HOST}
36+
WORDPRESS_DB_USER=${DB_USER}
37+
WORDPRESS_DB_PASSWORD=${DB_PASSWORD}
38+
WORDPRESS_DB_NAME=${DB_NAME}
39+
WORDPRESS_DB_PORT=${DB_PORT}
40+
41+
# WPUnit tests will use these variables instead.
42+
# By default this is the same as WordPress
43+
TEST_DB_HOST=${WORDPRESS_DB_HOST}
44+
TEST_DB_USER=${WORDPRESS_DB_USER}
45+
TEST_DB_PASSWORD=${WORDPRESS_DB_PASSWORD}
46+
TEST_DB_NAME=${WORDPRESS_DB_NAME}
47+
TEST_DB_PORT=${WORDPRESS_DB_PORT}
48+
# The Integration suite will use this table prefix for the WordPress tables.
49+
TEST_TABLE_PREFIX=test_
50+
51+
# The DSN used by Acceptance tests.
52+
TEST_DB_DSN="mysql:host=${TEST_DB_HOST};port=${TEST_DB_PORT};dbname=${TEST_DB_NAME}"
53+
54+
# The following variables are used to determine test behavior.
55+
56+
# Include 3rd party plugins (e.g. WooCommerce) in the tests.
57+
INCLUDE_EXTENSIONS=true
58+
# Skips recreating the database before running the tests.
59+
SKIP_DB_CREATE=false
60+
# Skips configuring the WordPress installation
61+
SKIP_WP_SETUP=false
62+
# Skips cleanup after the test suite run.
63+
SKIP_TESTS_CLEANUP=true
64+
# The default Codeception suite to run.
65+
SUITES=wpunit
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Hidden files
2+
.DS_Store
3+
Thumbs.db
4+
5+
# IDE Files
6+
.devcontainer/*
7+
.devcontainer.json
8+
.vscode
9+
.idea
10+
11+
# Environment variables for testing
12+
.env
13+
.env.*
14+
!.env.dist
15+
16+
# Ruleset Overrides
17+
phpcs.xml
18+
phpunit.xml
19+
phpstan.neon
20+
21+
# Directory to generate the dist zipfile
22+
plugin-build
23+
24+
# Composer auth
25+
auth.json
26+
27+
# Composer deps
28+
vendor
29+
30+
# NPM deps
31+
node_modules
32+
33+
# Generated Schema used in some tooling. Versioned Schema is uploaded as a Release artifact to Github.
34+
schema.graphql
35+
36+
# WP CLI config overrides
37+
wp-cli.local.yml
38+
39+
# Tests
40+
*.sql
41+
*.tar.gz
42+
!tests
43+
tests/*.suite.yml
44+
coverage/*
45+
build/
46+
.log/
47+
c3.php
48+
49+
# Cache
50+
phpcs-cache.json
51+
tests/_support/
52+
tests/_output/
53+
tests/_generated/
54+
tests/_data/
55+
56+
# Playwright outputs
57+
artifacts
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Actions & Filters
2+
3+
## Table of Contents
4+
5+
- [PHP Actions](#php-actions)
6+
- [PHP Filters](#php-filters)
7+
- [Examples](#examples)
8+
- [Actions](#actions)
9+
- [Filters](#filters)
10+
- [Contributing](#contributing)
11+
12+
---
13+
14+
This document lists the available PHP actions and filters provided by the WPGraphQL Velocity plugin, along with explanations and usage examples. These hooks allow you to customize plugin behavior, settings, and integration with other plugins or your theme.
15+
16+
---
17+
18+
## PHP Actions
19+
20+
| Action Name | Description |
21+
|-----------------------------------------------|-----------------------------------------------------------------------------------------------|
22+
|
23+
24+
---
25+
26+
## PHP Filters
27+
28+
| Filter Name | Description |
29+
|-----------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
30+
31+
32+
---
33+
34+
## Examples
35+
36+
37+
---
38+
39+
## Contributing
40+
41+
If you feel like something is missing or you want to add tests or testing documentation, we encourage you to contribute! Please check out our [Contributing Guide](https://github.com/wpengine/hwptoolkit/blob/main/CONTRIBUTING.md) for more details.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# WPGraphQL Velocity
2+
3+
## 0.0.1-beta
4+
- Proof of concept. A plugin for analyzing and measuring the performance of WPGraphQL queries in your headless application.

0 commit comments

Comments
 (0)