coding standards met.

This commit is contained in:
Geoff Taylor
2021-01-27 14:02:06 -05:00
parent 6adfc199f4
commit ea4a4a539b
7 changed files with 30 additions and 22 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ jobs:
run: vendor/bin/php-coveralls -v
- name: Test & publish code coverage
if: ${{ matrix.coverage == '--coverage --coverage-xml' && env.STRIPE_API_PUBLISHABLE_KEY == null }}
if: ${{ matrix.coverage == '--coverage --coverage-xml' }}
uses: paambaati/codeclimate-action@v2.7.5
env:
CC_TEST_REPORTER_ID: 739347fbfc0caa4e7f25069899203df2d4a411b3cbc9c3b1ef28257520c99d31
@@ -119,6 +119,12 @@ class Customer_Mutation {
);
}
/**
* Processes Customer meta data input.
*
* @param \WC_Customer $customer Customer object.
* @param array $inputs Incoming meta data.
*/
public static function input_meta_data_mapping( $customer, $inputs ) {
if ( is_array( $inputs ) ) {
foreach ( $inputs as $meta ) {
@@ -45,12 +45,6 @@ class Customer_Register {
public static function get_input_fields() {
$result = array_merge(
UserRegister::get_input_fields(),
array(
'metaData' => array(
'description' => __( 'Meta data.', 'wp-graphql-woocommerce' ),
'type' => array( 'list_of' => 'MetaDataInput' ),
)
),
array(
'billing' => array(
'type' => 'CustomerAddressInput',
@@ -64,6 +58,10 @@ class Customer_Register {
'type' => 'Boolean',
'description' => __( 'Customer shipping is identical to billing address', 'wp-graphql-woocommerce' ),
),
'metaData' => array(
'description' => __( 'Meta data.', 'wp-graphql-woocommerce' ),
'type' => array( 'list_of' => 'MetaDataInput' ),
),
)
);
@@ -178,9 +176,9 @@ class Customer_Register {
}
}
// Set meta data
// Set meta data.
if ( ! empty( $input['metaData'] ) ) {
Customer_Mutation::input_meta_data_mapping($customer, $input['metaData']);
Customer_Mutation::input_meta_data_mapping( $customer, $input['metaData'] );
}
// Save customer and get customer ID.
+6 -8
View File
@@ -44,12 +44,6 @@ class Customer_Update {
public static function get_input_fields() {
return array_merge(
UserCreate::get_input_fields(),
array(
'metaData' => array(
'description' => __( 'Meta data.', 'wp-graphql-woocommerce' ),
'type' => array( 'list_of' => 'MetaDataInput' ),
)
),
array(
'id' => array(
'type' => 'ID',
@@ -67,6 +61,10 @@ class Customer_Update {
'type' => 'Boolean',
'description' => __( 'Customer shipping is identical to billing address', 'wp-graphql-woocommerce' ),
),
'metaData' => array(
'description' => __( 'Meta data.', 'wp-graphql-woocommerce' ),
'type' => array( 'list_of' => 'MetaDataInput' ),
),
)
);
}
@@ -142,9 +140,9 @@ class Customer_Update {
}
}
// Set meta data
// Set meta data.
if ( ! empty( $input['metaData'] ) ) {
Customer_Mutation::input_meta_data_mapping($customer, $input['metaData']);
Customer_Mutation::input_meta_data_mapping( $customer, $input['metaData'] );
}
// Save customer and get customer ID.
+7 -1
View File
@@ -63,7 +63,13 @@ class CustomerMutationsTest extends \Codeception\TestCase\WPTestCase {
}
public function tearDown(): void {
// your tear down methods here
wp_set_current_user( 0 );
\WC()->customer = null;
\WC()->session = null;
\WC()->cart = null;
\WC()->initialize_session();
\WC()->initialize_cart();
// then
parent::tearDown();
+2 -2
View File
@@ -29,7 +29,7 @@ private static $installed = array (
'aliases' =>
array (
),
'reference' => '81f1f9d7d8de9146489f69eb1b833d21d39b444e',
'reference' => '6adfc199f4aefb3e92b0729d1312b874d452bc1e',
'name' => 'wp-graphql/wp-graphql-woocommerce',
),
'versions' =>
@@ -50,7 +50,7 @@ private static $installed = array (
'aliases' =>
array (
),
'reference' => '81f1f9d7d8de9146489f69eb1b833d21d39b444e',
'reference' => '6adfc199f4aefb3e92b0729d1312b874d452bc1e',
),
),
);
+2 -2
View File
@@ -6,7 +6,7 @@
'aliases' =>
array (
),
'reference' => '81f1f9d7d8de9146489f69eb1b833d21d39b444e',
'reference' => '6adfc199f4aefb3e92b0729d1312b874d452bc1e',
'name' => 'wp-graphql/wp-graphql-woocommerce',
),
'versions' =>
@@ -27,7 +27,7 @@
'aliases' =>
array (
),
'reference' => '81f1f9d7d8de9146489f69eb1b833d21d39b444e',
'reference' => '6adfc199f4aefb3e92b0729d1312b874d452bc1e',
),
),
);