Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,20 @@ ENV PATH "$PATH:~/.composer/vendor/bin"
ARG PHPUNIT_VERSION="<=8.1"
# Install wp-browser globally
RUN composer global require --optimize-autoloader \
wp-cli/wp-cli-bundle \
wp-cli/wp-cli-bundle:* \
lucatume/wp-browser \
codeception/module-asserts \
codeception/module-cli \
codeception/module-db \
codeception/module-filesystem \
codeception/module-phpbrowser \
codeception/module-rest \
codeception/module-webdriver \
codeception/util-universalframework \
codeception/module-asserts:^1.0 \
codeception/module-cli:^1.0 \
codeception/module-db:^1.0 \
codeception/module-filesystem:^1.0 \
codeception/module-phpbrowser:^1.0 \
codeception/module-rest:^1.0 \
codeception/module-webdriver:^1.0 \
codeception/util-universalframework:^1.0 \
league/factory-muffin \
league/factory-muffin-faker \
stripe/stripe-php \
wp-graphql/wp-graphql-testcase \
"phpunit/phpunit:${PHPUNIT_VERSION}"
wp-graphql/wp-graphql-testcase

# Remove exec statement from base entrypoint script.
RUN sed -i '$d' /usr/local/bin/docker-entrypoint.sh
Expand Down
41 changes: 41 additions & 0 deletions access-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,44 @@ function wc_graphql_price_range( $from, $to ) {

return apply_filters( 'graphql_woocommerce_format_price_range', $price, $from, $to );
}

/**
* Converts a camel case formatted string to a underscore formatted string.
*
* @param string $string String to be formatted.
* @param boolean $capitalize Capitalize first letter of string.
*
* @return string
*/
function wc_graphql_underscore_to_camel_case( $string, $capitalize = false ) {
$str = str_replace( ' ', '', ucwords( str_replace( '-', ' ', $string ) ) );

if ( ! $capitalize ) {
$str[0] = strtolower( $str[0] );
}

return $str;
}

/**
* Converts a camel case formatted string to a underscore formatted string.
*
* @param string $string String to be formatted.
*
* @return string
*/
function wc_graphql_camel_case_to_underscore( $string ) {
preg_match_all(
'!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!',
$string,
$matches
);

$ret = $matches[0];

foreach ( $ret as &$match ) {
$match = strtoupper( $match ) === $match ? strtolower( $match ) : lcfirst( $match );
}

return implode( '_', $ret );
}
23 changes: 11 additions & 12 deletions bin/_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ install_wordpress() {
wpackagist-plugin/woocommerce-gateway-stripe \
wpackagist-plugin/wp-graphql \
wpackagist-theme/twentytwentyone \
wp-cli/wp-cli-bundle
wp-cli/wp-cli-bundle:*
}

remove_wordpress() {
# Remove Wordpress + integrated plugins.
wp plugin uninstall woocommerce --deactivate --path=${WP_CORE_DIR}
# Uninstall woocommerce plugins.
if [ -f $WP_CORE_DIR/wp-config.php ]; then
wp plugin uninstall woocommerce --deactivate --path=${WP_CORE_DIR}
fi

# Remove WordPress dependencies
composer remove --dev wp-graphql/wp-graphql-jwt-authentication \
wpackagist-plugin/woocommerce-gateway-stripe \
wpackagist-plugin/wp-graphql \
Expand All @@ -43,18 +47,16 @@ remove_wordpress() {
johnpbloch/wordpress \
composer/installers \
wp-cli/wp-cli-bundle

composer update
}

install_local_test_library() {
# Install testing library dependencies.
composer install
composer require --dev phpunit/phpunit:${PHPUNIT_VERSION} \
composer require --dev \
lucatume/wp-browser \
codeception/module-asserts \
codeception/module-rest \
codeception/util-universalframework \
codeception/module-asserts:^1.0 \
codeception/module-rest:^1.0 \
codeception/util-universalframework:^1.0 \
wp-graphql/wp-graphql-testcase \
stripe/stripe-php
}
Expand All @@ -66,10 +68,7 @@ remove_local_test_library() {
codeception/module-rest \
codeception/util-universalframework \
lucatume/wp-browser \
phpunit/phpunit \
stripe/stripe-php

composer update
}

install_db() {
Expand Down
237 changes: 0 additions & 237 deletions class-woographql-inflect.php

This file was deleted.

6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@
"config": {
"optimize-autoloader": true,
"process-timeout": 0,
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"composer/installers": true,
"johnpbloch/wordpress-core-installer": true
}
},
"autoload": {
"files": [
Expand Down
Loading