This repository has been archived by the owner on Jul 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
283 changed files
with
98,893 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# A set of files you probably don't want in your WordPress.org distribution | ||
.distignore | ||
.editorconfig | ||
.git | ||
.gitignore | ||
.gitlab-ci.yml | ||
.travis.yml | ||
.DS_Store | ||
Thumbs.db | ||
behat.yml | ||
bin | ||
circle.yml | ||
composer.json | ||
composer.lock | ||
Gruntfile.js | ||
package.json | ||
phpunit.xml | ||
phpunit.xml.dist | ||
multisite.xml | ||
multisite.xml.dist | ||
phpcs.ruleset.xml | ||
README.md | ||
wp-cli.local.yml | ||
tests | ||
vendor | ||
node_modules | ||
*.sql | ||
*.tar.gz | ||
*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# This file is for unifying the coding style for different editors and IDEs | ||
# editorconfig.org | ||
|
||
# WordPress Coding Standards | ||
# https://make.wordpress.org/core/handbook/coding-standards/ | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = tab | ||
indent_size = 4 | ||
|
||
[{.jshintrc,*.json,*.yml}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[{*.txt,wp-config-sample.php}] | ||
end_of_line = crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
# Shared | ||
TEST_DB_NAME="wptests" | ||
TEST_DB_HOST="127.0.0.1" | ||
TEST_DB_USER="" | ||
TEST_DB_PASSWORD="" | ||
|
||
# Install script | ||
WP_VERSION=latest | ||
SKIP_DB_CREATE=false | ||
WP_GRAPHQL_BRANCH=develop | ||
|
||
# Codeception | ||
WP_ROOT_FOLDER="/tmp/wp-graphql-acf/wordpress" | ||
TEST_SITE_WP_ADMIN_PATH="/wp-admin" | ||
TEST_SITE_DB_NAME="wptests" | ||
TEST_SITE_DB_HOST="127.0.0.1" | ||
TEST_SITE_DB_USER="root" | ||
TEST_SITE_DB_PASSWORD="" | ||
TEST_SITE_TABLE_PREFIX="wp_" | ||
TEST_TABLE_PREFIX="wp_" | ||
TEST_SITE_WP_URL="http://wp.test" | ||
TEST_SITE_WP_DOMAIN="wp.test" | ||
TEST_SITE_ADMIN_EMAIL="[email protected]" | ||
TEST_SITE_ADMIN_USERNAME="admin" | ||
TEST_SITE_ADMIN_PASSWORD="password" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/bin export-ignore | ||
/.distignore export-ignore | ||
/.env export-ignore | ||
/travis.yml export-ignore | ||
/codeception.yml export-ignore | ||
/phpcs.ruleset.xml export-ignore | ||
/vscode.md export-ignore | ||
/tests export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.DS_Store | ||
Thumbs.db | ||
wp-cli.local.yml | ||
node_modules/ | ||
*.sql | ||
*.tar.gz | ||
*.zip | ||
.idea* | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
sudo: false | ||
|
||
language: php | ||
|
||
notifications: | ||
email: | ||
on_success: never | ||
on_failure: change | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
cache: | ||
directories: | ||
- vendor | ||
- $HOME/.composer/cache | ||
|
||
matrix: | ||
include: | ||
- php: 7.1 | ||
env: WP_VERSION=latest | ||
- php: 7.0 | ||
env: WP_VERSION=latest | ||
- php: 5.6 | ||
env: WP_VERSION=4.4 | ||
- php: 5.6 | ||
env: WP_VERSION=latest | ||
- php: 5.6 | ||
env: WP_VERSION=trunk | ||
- php: 5.6 | ||
env: WP_TRAVISCI=phpcs | ||
- php: 5.3 | ||
env: WP_VERSION=latest | ||
|
||
before_script: | ||
- export PATH="$HOME/.composer/vendor/bin:$PATH" | ||
- | | ||
if [[ ! -z "$WP_VERSION" ]] ; then | ||
bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION | ||
if [[ ${TRAVIS_PHP_VERSION:0:2} == "5." ]]; then | ||
composer global require "phpunit/phpunit=4.8.*" | ||
else | ||
composer global require "phpunit/phpunit=5.7.*" | ||
fi | ||
fi | ||
- | | ||
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then | ||
composer global require wp-coding-standards/wpcs | ||
phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs | ||
fi | ||
script: | ||
- | | ||
if [[ ! -z "$WP_VERSION" ]] ; then | ||
phpunit | ||
WP_MULTISITE=1 phpunit | ||
fi | ||
- | | ||
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then | ||
phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php') | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"phpcs.standard": "./phpcs.ruleset.xml", | ||
"phpcs.ignorePatterns": ["vendor"], | ||
"phpcs.executablePath": "./vendor/bin/phpcs", | ||
"phpcbf.onsave": true, | ||
"phpcbf.executablePath": "./vendor/bin/phpcbf", | ||
// "phpcbf.standard": "./phpcs.ruleset.xml", | ||
"phpcbf.configSearch": true, | ||
"editor.formatOnSaveTimeout": 5000, | ||
"phpcbf.debug": true, | ||
"editor.formatOnSave": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,3 @@ | ||
![WPGraphQL for Advanced Custom Fields](https://www.wpgraphql.com/wp-content/uploads/2019/04/Screen-Shot-2019-04-19-at-10.53.19-AM-868x456.png "WPGraphQL for Advanced Custom Fields") | ||
|
||
# WPGraphQL for Advanced Custom Fields | ||
|
||
WPGraphQL for Advanced Custom Fields automatically exposes your ACF fields to the WPGraphQL Schema. | ||
|
||
## Licensing | ||
|
||
This is a licensed plugin. To purchase a license for the plugin and receive a copy of the plugin, visit: https://wpgraphql.com/acf | ||
|
||
## Support | ||
|
||
If you've purchased a license, you can get support in the WPGraphQL Slack #ACF channel, or by using the contact form on the bottom right corner of the [https://wpgraphql.com](https://wpgraphql.com) website. | ||
|
||
## Documentation | ||
|
||
Documentation for the plugin can be found at: [https://docs.wpgraphql.com/extensions/wpgraphql-advanced-custom-fields](https://docs.wpgraphql.com/extensions/wpgraphql-advanced-custom-fields) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ $# -lt 3 ]; then | ||
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version] [skip-database-creation]" | ||
exit 1 | ||
fi | ||
|
||
DB_NAME=$1 | ||
DB_USER=$2 | ||
DB_PASS=$3 | ||
DB_HOST=${4-localhost} | ||
WP_VERSION=${5-latest} | ||
SKIP_DB_CREATE=${6-false} | ||
|
||
PLUGIN_DIR=$(pwd) | ||
WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wp-graphql-acf/wordpress-tests-lib} | ||
WP_CORE_DIR=${WP_CORE_DIR-/tmp/wp-graphql-acf/wordpress/} | ||
DB_SERVE_NAME=${DB_SERVE_NAME-wpgraphql_acf_serve} | ||
|
||
download() { | ||
if [ `which curl` ]; then | ||
curl -s "$1" > "$2"; | ||
elif [ `which wget` ]; then | ||
wget -nv -O "$2" "$1" | ||
fi | ||
} | ||
|
||
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+(\.[0-9]+)? ]]; then | ||
WP_TESTS_TAG="tags/$WP_VERSION" | ||
elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then | ||
WP_TESTS_TAG="trunk" | ||
else | ||
# http serves a single offer, whereas https serves multiple. we only want one | ||
download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json | ||
grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json | ||
LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//') | ||
if [[ -z "$LATEST_VERSION" ]]; then | ||
echo "Latest WordPress version could not be found" | ||
exit 1 | ||
fi | ||
WP_TESTS_TAG="tags/$LATEST_VERSION" | ||
fi | ||
|
||
set -ex | ||
|
||
install_wp() { | ||
|
||
if [ -d $WP_CORE_DIR ]; then | ||
return; | ||
fi | ||
|
||
mkdir -p $WP_CORE_DIR | ||
|
||
if [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then | ||
mkdir -p /tmp/wordpress-nightly | ||
download https://wordpress.org/nightly-builds/wordpress-latest.zip /tmp/wordpress-nightly/wordpress-nightly.zip | ||
unzip -q /tmp/wordpress-nightly/wordpress-nightly.zip -d /tmp/wordpress-nightly/ | ||
mv /tmp/wordpress-nightly/wordpress/* $WP_CORE_DIR | ||
else | ||
if [ $WP_VERSION == 'latest' ]; then | ||
local ARCHIVE_NAME='latest' | ||
else | ||
local ARCHIVE_NAME="wordpress-$WP_VERSION" | ||
fi | ||
download https://wordpress.org/${ARCHIVE_NAME}.tar.gz /tmp/wordpress.tar.gz | ||
tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR | ||
fi | ||
|
||
download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php | ||
} | ||
|
||
install_test_suite() { | ||
# portable in-place argument for both GNU sed and Mac OSX sed | ||
if [[ $(uname -s) == 'Darwin' ]]; then | ||
local ioption='-i .bak' | ||
else | ||
local ioption='-i' | ||
fi | ||
|
||
# set up testing suite if it doesn't yet exist | ||
if [ ! -d $WP_TESTS_DIR ]; then | ||
# set up testing suite | ||
mkdir -p $WP_TESTS_DIR | ||
svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes | ||
svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data | ||
fi | ||
|
||
if [ ! -f wp-tests-config.php ]; then | ||
download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php | ||
# remove all forward slashes in the end | ||
WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::") | ||
sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php | ||
sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php | ||
sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php | ||
sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php | ||
sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php | ||
fi | ||
|
||
} | ||
|
||
install_db() { | ||
|
||
if [ ${SKIP_DB_CREATE} = "true" ]; then | ||
return 0 | ||
fi | ||
|
||
# parse DB_HOST for port or socket references | ||
local PARTS=(${DB_HOST//\:/ }) | ||
local DB_HOSTNAME=${PARTS[0]}; | ||
local DB_SOCK_OR_PORT=${PARTS[1]}; | ||
local EXTRA="" | ||
|
||
if ! [ -z $DB_HOSTNAME ] ; then | ||
if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then | ||
EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp" | ||
elif ! [ -z $DB_SOCK_OR_PORT ] ; then | ||
EXTRA=" --socket=$DB_SOCK_OR_PORT" | ||
elif ! [ -z $DB_HOSTNAME ] ; then | ||
EXTRA=" --host=$DB_HOSTNAME --protocol=tcp" | ||
fi | ||
fi | ||
|
||
# create database | ||
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA | ||
} | ||
|
||
configure_wordpress() { | ||
|
||
cd $WP_CORE_DIR | ||
wp config create --dbname="$DB_SERVE_NAME" --dbuser=root --dbpass="$DB_PASS" --dbhost="$DB_HOST" --skip-check --force=true | ||
wp core install --url=wpgraphql.test --title="WPGraphQL Tests" --admin_user=admin --admin_password=password [email protected] | ||
wp rewrite structure '/%year%/%monthnum%/%postname%/' | ||
} | ||
|
||
install_wpgraphql() { | ||
echo "Cloning WPGraphQL" | ||
git clone https://github.com/wp-graphql/wp-graphql.git $WP_CORE_DIR/wp-content/plugins/wp-graphql | ||
} | ||
|
||
install_acf_pro() { | ||
echo "Cloning ACF PRO" | ||
git clone [email protected]:AdvancedCustomFields/acf-pro.git $WP_CORE_DIR/wp-content/plugins/advanced-custom-fields-pro | ||
} | ||
|
||
activate_plugins() { | ||
|
||
# Add this repo as a plugin to the repo | ||
ln -s $PLUGIN_DIR $WP_CORE_DIR/wp-content/plugins/wp-graphql-acf | ||
|
||
cd $WP_CORE_DIR | ||
|
||
# activate the plugin | ||
wp plugin activate wp-graphql | ||
wp plugin activate wp-graphql-acf | ||
wp plugin activate advanced-custom-fields-pro | ||
|
||
# Flush the permalinks | ||
wp rewrite flush | ||
|
||
# Export the db for codeception to use | ||
wp db export $PLUGIN_DIR/tests/_data/dump.sql | ||
} | ||
|
||
install_wp | ||
install_test_suite | ||
install_db | ||
configure_wordpress | ||
install_wpgraphql | ||
install_acf_pro | ||
activate_plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
paths: | ||
tests: tests | ||
output: tests/_output | ||
data: tests/_data | ||
support: tests/_support | ||
envs: tests/_envs | ||
actor_suffix: Tester | ||
settings: | ||
colors: true | ||
memory_limit: 1024M | ||
coverage: | ||
enabled: true | ||
whitelist: | ||
include: | ||
- wp-graphql-acf.php | ||
- access-functions.php | ||
- src/*.php | ||
extensions: | ||
enabled: | ||
- Codeception\Extension\RunFailed | ||
commands: | ||
- Codeception\Command\GenerateWPUnit | ||
- Codeception\Command\GenerateWPRestApi | ||
- Codeception\Command\GenerateWPRestController | ||
- Codeception\Command\GenerateWPRestPostTypeController | ||
- Codeception\Command\GenerateWPAjax | ||
- Codeception\Command\GenerateWPCanonical | ||
- Codeception\Command\GenerateWPXMLRPC | ||
params: | ||
- .env |
Oops, something went wrong.