Skip to content

Commit 6dbdcb5

Browse files
authored
fix: Product Attribute naming conventions changed (#603)
* fix: Product Attribute naming conventions changed * devops: dev dependencies updated * devops: dev dependencies updated * devops: dev dependencies updated * devops: Dockerfile updated * devops: dev dependencies updated * devops: dev dependencies updated * devops: dev dependencies updated * devops: Dockerfile updated * chore: Docker composer configurations updated * chore: Coding standards met.
1 parent d4177ce commit 6dbdcb5

File tree

90 files changed

+5971
-5946
lines changed

Some content is hidden

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

90 files changed

+5971
-5946
lines changed

Dockerfile

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,20 @@ ENV PATH "$PATH:~/.composer/vendor/bin"
3939
ARG PHPUNIT_VERSION="<=8.1"
4040
# Install wp-browser globally
4141
RUN composer global require --optimize-autoloader \
42-
wp-cli/wp-cli-bundle \
42+
wp-cli/wp-cli-bundle:* \
4343
lucatume/wp-browser \
44-
codeception/module-asserts \
45-
codeception/module-cli \
46-
codeception/module-db \
47-
codeception/module-filesystem \
48-
codeception/module-phpbrowser \
49-
codeception/module-rest \
50-
codeception/module-webdriver \
51-
codeception/util-universalframework \
44+
codeception/module-asserts:^1.0 \
45+
codeception/module-cli:^1.0 \
46+
codeception/module-db:^1.0 \
47+
codeception/module-filesystem:^1.0 \
48+
codeception/module-phpbrowser:^1.0 \
49+
codeception/module-rest:^1.0 \
50+
codeception/module-webdriver:^1.0 \
51+
codeception/util-universalframework:^1.0 \
5252
league/factory-muffin \
5353
league/factory-muffin-faker \
5454
stripe/stripe-php \
55-
wp-graphql/wp-graphql-testcase \
56-
"phpunit/phpunit:${PHPUNIT_VERSION}"
55+
wp-graphql/wp-graphql-testcase
5756

5857
# Remove exec statement from base entrypoint script.
5958
RUN sed -i '$d' /usr/local/bin/docker-entrypoint.sh

access-functions.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,44 @@ function wc_graphql_price_range( $from, $to ) {
173173

174174
return apply_filters( 'graphql_woocommerce_format_price_range', $price, $from, $to );
175175
}
176+
177+
/**
178+
* Converts a camel case formatted string to a underscore formatted string.
179+
*
180+
* @param string $string String to be formatted.
181+
* @param boolean $capitalize Capitalize first letter of string.
182+
*
183+
* @return string
184+
*/
185+
function wc_graphql_underscore_to_camel_case( $string, $capitalize = false ) {
186+
$str = str_replace( ' ', '', ucwords( str_replace( '-', ' ', $string ) ) );
187+
188+
if ( ! $capitalize ) {
189+
$str[0] = strtolower( $str[0] );
190+
}
191+
192+
return $str;
193+
}
194+
195+
/**
196+
* Converts a camel case formatted string to a underscore formatted string.
197+
*
198+
* @param string $string String to be formatted.
199+
*
200+
* @return string
201+
*/
202+
function wc_graphql_camel_case_to_underscore( $string ) {
203+
preg_match_all(
204+
'!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!',
205+
$string,
206+
$matches
207+
);
208+
209+
$ret = $matches[0];
210+
211+
foreach ( $ret as &$match ) {
212+
$match = strtoupper( $match ) === $match ? strtolower( $match ) : lcfirst( $match );
213+
}
214+
215+
return implode( '_', $ret );
216+
}

bin/_lib.sh

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@ install_wordpress() {
2929
wpackagist-plugin/woocommerce-gateway-stripe \
3030
wpackagist-plugin/wp-graphql \
3131
wpackagist-theme/twentytwentyone \
32-
wp-cli/wp-cli-bundle
32+
wp-cli/wp-cli-bundle:*
3333
}
3434

3535
remove_wordpress() {
36-
# Remove Wordpress + integrated plugins.
37-
wp plugin uninstall woocommerce --deactivate --path=${WP_CORE_DIR}
36+
# Uninstall woocommerce plugins.
37+
if [ -f $WP_CORE_DIR/wp-config.php ]; then
38+
wp plugin uninstall woocommerce --deactivate --path=${WP_CORE_DIR}
39+
fi
40+
41+
# Remove WordPress dependencies
3842
composer remove --dev wp-graphql/wp-graphql-jwt-authentication \
3943
wpackagist-plugin/woocommerce-gateway-stripe \
4044
wpackagist-plugin/wp-graphql \
@@ -43,18 +47,16 @@ remove_wordpress() {
4347
johnpbloch/wordpress \
4448
composer/installers \
4549
wp-cli/wp-cli-bundle
46-
47-
composer update
4850
}
4951

5052
install_local_test_library() {
5153
# Install testing library dependencies.
5254
composer install
53-
composer require --dev phpunit/phpunit:${PHPUNIT_VERSION} \
55+
composer require --dev \
5456
lucatume/wp-browser \
55-
codeception/module-asserts \
56-
codeception/module-rest \
57-
codeception/util-universalframework \
57+
codeception/module-asserts:^1.0 \
58+
codeception/module-rest:^1.0 \
59+
codeception/util-universalframework:^1.0 \
5860
wp-graphql/wp-graphql-testcase \
5961
stripe/stripe-php
6062
}
@@ -66,10 +68,7 @@ remove_local_test_library() {
6668
codeception/module-rest \
6769
codeception/util-universalframework \
6870
lucatume/wp-browser \
69-
phpunit/phpunit \
7071
stripe/stripe-php
71-
72-
composer update
7372
}
7473

7574
install_db() {

class-woographql-inflect.php

Lines changed: 0 additions & 237 deletions
This file was deleted.

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@
3737
"config": {
3838
"optimize-autoloader": true,
3939
"process-timeout": 0,
40-
"sort-packages": true
40+
"sort-packages": true,
41+
"allow-plugins": {
42+
"composer/installers": true,
43+
"johnpbloch/wordpress-core-installer": true
44+
}
4145
},
4246
"autoload": {
4347
"files": [

0 commit comments

Comments
 (0)