Skip to content

Commit

Permalink
Merge fd55bab into 8945fcf
Browse files Browse the repository at this point in the history
  • Loading branch information
missionmike committed Apr 25, 2024
2 parents 8945fcf + fd55bab commit c3c58b2
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 55 deletions.
28 changes: 21 additions & 7 deletions .github/workflows/continous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,37 @@ jobs:
php-version: ${{ matrix.php }}
extensions: json, mbstring

- name: Install Dependencies
run: composer install
- name: Install WP PHPUnit Dependencies
run: |
composer install --ignore-platform-reqs
composer require wp-phpunit/wp-phpunit \
yoast/phpunit-polyfills \
phpunit/phpunit:^9.6 \
wp-phpunit/wp-phpunit \
- name: Run PHPUnit Tests w/ Docker.
run: composer run-phpunit -- -- --coverage-text

- name: Install WPBrowser Dependencies
run: |
composer install --ignore-platform-reqs
composer require codeception/module-asserts:* \
codeception/util-universalframework:* \
codeception/module-rest:* \
lucatume/wp-browser:^3.1 --ignore-platform-reqs
- name: Run Codeception Tests w/ Docker.
run: composer run-codeception -- -- --coverage --coverage-xml

- name: Run PHPUnit Tests w/ Docker.
run: composer run-phpunit -- -- --coverage-text


- name: Push Codecoverage to Coveralls.io
env:
COVERALLS_RUN_LOCALLY: 1
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker-compose run --rm \
--workdir=/var/www/html/wp-content/plugins/wp-graphql-testcase \
--user $(id -u) \
-e COVERALLS_RUN_LOCALLY=1 -e COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN \
-e COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN \
wordpress \
vendor/bin/php-coveralls -v
13 changes: 4 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
]
},
"require": {
"php": "^7.1 || ^8.0"
"php": "^8.1"
},
"require-dev": {
"composer/installers": "^1.9",
Expand All @@ -27,13 +27,6 @@
"squizlabs/php_codesniffer": "^3.5",
"automattic/vipwpcs": "^2.3",
"wp-coding-standards/wpcs": "^2.3",
"wp-phpunit/wp-phpunit": "^6.3",
"yoast/phpunit-polyfills": "^2.0",
"phpunit/phpunit": "^9.6",
"codeception/module-asserts": "*",
"codeception/util-universalframework": "*",
"codeception/module-rest": "*",
"lucatume/wp-browser": "^3.1",
"php-coveralls/php-coveralls": "2.4.3"
},
"scripts": {
Expand All @@ -54,7 +47,9 @@
"codeception/util-universalframework": "Needed for \\Tests\\WPGraphQL\\TestCase\\WPGraphQLTestcase to work.",
"codeception/module-rest": "Needed for \\Tests\\WPGraphQL\\TestCase\\WPGraphQLTestcase to work.",
"lucatume/wp-browser": "Needed for \\Tests\\WPGraphQL\\TestCase\\WPGraphQLTestcase to work.",
"wp-phpunit/wp-phpunit": "Needed for \\Tests\\WPGraphQL\\TestCase\\WPGraphQLUnitTestcase to work."
"phpunit/phpunit": "Needed for \\Tests\\WPGraphQL\\TestCase\\WPGraphQLUnitTestcase to work.",
"wp-phpunit/wp-phpunit": "Needed for \\Tests\\WPGraphQL\\TestCase\\WPGraphQLUnitTestcase to work.",
"yoast/phpunit-polyfills": "Needed for \\Tests\\WPGraphQL\\TestCase\\WPGraphQLUnitTestcase to work."
},
"config": {
"allow-plugins": {
Expand Down
8 changes: 5 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
ARG PHP_VERSION=7.4
ARG PHP_VERSION=8.1

FROM wordpress:php${PHP_VERSION}-apache

ARG XDEBUG_VERSION=2.9.6
# See: https://xdebug.org/docs/compat to match the Xdebug version with the PHP version.
ARG XDEBUG_VERSION=3.3.1

RUN apt-get update; \
apt-get install -y --no-install-recommends \
Expand All @@ -13,10 +14,11 @@ RUN apt-get update; \

COPY php.ini /usr/local/etc/php/php.ini

# Setup xdebug. The latest version supported by PHP 5.6 is 2.5.5.
RUN pecl install "xdebug-${XDEBUG_VERSION}"; \
docker-php-ext-enable xdebug

ENV XDEBUG_MODE=coverage

# Install PDO MySQL driver.
RUN docker-php-ext-install \
pdo_mysql
Expand Down
11 changes: 11 additions & 0 deletions local/config/wp-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@
define( 'DB_CHARSET', 'utf8' );
define( 'DB_COLLATE', '' );

$table_prefix = 'wptests_';

define( 'AUTH_KEY', 'value' );
define( 'SECURE_AUTH_KEY', 'value' );
define( 'LOGGED_IN_KEY', 'value' );
define( 'NONCE_KEY', 'value' );
define( 'AUTH_SALT', 'value' );
define( 'SECURE_AUTH_SALT', 'value' );
define( 'LOGGED_IN_SALT', 'value' );
define( 'NONCE_SALT', 'value' );

define( 'ABSPATH', __DIR__ . '/' );

require_once ABSPATH . 'wp-settings.php';
36 changes: 0 additions & 36 deletions src/TestCase/WPGraphQLTestCommon.php
Original file line number Diff line number Diff line change
Expand Up @@ -836,24 +836,6 @@ protected static function endsWith( $needle, $haystack ) {
return ( substr( $haystack, -$len ) === $needle );
}

/**
* Wrapper for IsTrue constraint.
*
* @return IsTrue
*/
public static function isTrue(): IsTrue {
return new IsTrue;
}

/**
* Wrapper for IsEmpty constraint.
*
* @return IsEmpty
*/
public static function isEmpty(): IsEmpty {
return new IsEmpty;
}

/**
* Wrapper for IsEqual constraint.
*
Expand All @@ -875,22 +857,4 @@ public static function isEqual( $value ): IsEqual {
public static function contains( $value ): TraversableContainsIdentical {
return new TraversableContainsIdentical( $value );
}

/**
* Wrapper for IsNull constraint.
*
* @return IsNull
*/
public static function isNull(): IsNull {
return new IsNull;
}

/**
* Wrapper for LogicalNot constraint.
*
* @return LogicalNot
*/
public static function logicalNot( Constraint $last_constraint ): LogicalNot {
return new LogicalNot( $last_constraint );
}
}

0 comments on commit c3c58b2

Please sign in to comment.