ProductAttributeQueriesTest updated

This commit is contained in:
Geoff Taylor
2020-08-06 14:47:24 -04:00
parent 8c7951bdde
commit cf25353985
7 changed files with 34 additions and 12 deletions
@@ -192,7 +192,7 @@ class ProductHelper extends WCG_Helper {
$this->create_simple(),
$this->create_simple(),
);
$tag_ids = array( $this->create_product_tag( 'related' ) );
$tag_ids = array( $this->create_product_tag( 'related' ) );
$related_product_id = $this->create_simple( array( 'tag_ids' => $tag_ids ) );
return array(
@@ -389,7 +389,7 @@ class ProductHelper extends WCG_Helper {
$results[] = array(
'id' => base64_encode( $attribute_name . ':' . $id . ':' . $attribute->get_name() ),
'attributeId' => $attribute->get_id(),
'name' => $attribute->get_name(),
'name' => str_replace( 'pa_', '', $attribute->get_name() ),
'options' => $attribute->get_slugs(),
'position' => $attribute->get_position(),
'visible' => $attribute->get_visible(),
@@ -406,7 +406,7 @@ class ProductHelper extends WCG_Helper {
if ( empty( $downloads ) ) {
return null;
}
$results = array();
foreach ( $downloads as $download ) {
$results[] = array(
@@ -420,7 +420,7 @@ class ProductHelper extends WCG_Helper {
'file' => $download->get_file(),
);
}
return $results;
}
@@ -493,13 +493,13 @@ class ProductHelper extends WCG_Helper {
$reviews = array();
foreach ( $ids as $review_id ) {
$reviews[] = array(
'rating' => floatval( get_comment_meta( $review_id, 'rating', true ) ),
'rating' => floatval( get_comment_meta( $review_id, 'rating', true ) ),
'node' => array(
'id' => Relay::toGlobalId( 'comment', $review_id )
),
);
}
return $reviews;
}
}
}
+4 -4
View File
@@ -14,10 +14,10 @@ class ProductAttributeQueriesTest extends \Codeception\TestCase\WPTestCase {
$this->shop_manager = $this->factory->user->create( array( 'role' => 'shop_manager' ) );
$this->customer = $this->factory->user->create( array( 'role' => 'customer' ) );
$this->helper = $this->getModule('\Helper\Wpunit')->product();
$this->variation_helper = $this->getModule('\Helper\Wpunit')->product_variation();
$this->variation_helper = $this->getModule('\Helper\Wpunit')->product_variation();
$this->product_id = $this->helper->create_variable();
$this->variation_ids = $this->variation_helper->create( $this->product_id )['variations'];
}
public function tearDown() {
@@ -35,7 +35,7 @@ class ProductAttributeQueriesTest extends \Codeception\TestCase\WPTestCase {
nodes {
id
attributeId
name
name
options
position
visible
@@ -175,4 +175,4 @@ class ProductAttributeQueriesTest extends \Codeception\TestCase\WPTestCase {
$this->assertEquals( $expected, $actual );
}
}
}
+1 -1
View File
@@ -279,7 +279,7 @@ class ClassLoader
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
+5
View File
@@ -6,6 +6,11 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Firebase\\JWT\\BeforeValidException' => $vendorDir . '/firebase/php-jwt/src/BeforeValidException.php',
'Firebase\\JWT\\ExpiredException' => $vendorDir . '/firebase/php-jwt/src/ExpiredException.php',
'Firebase\\JWT\\JWK' => $vendorDir . '/firebase/php-jwt/src/JWK.php',
'Firebase\\JWT\\JWT' => $vendorDir . '/firebase/php-jwt/src/JWT.php',
'Firebase\\JWT\\SignatureInvalidException' => $vendorDir . '/firebase/php-jwt/src/SignatureInvalidException.php',
'WPGraphQL\\WooCommerce\\ACF_Schema_Filters' => $baseDir . '/includes/class-acf-schema-filters.php',
'WPGraphQL\\WooCommerce\\Connection\\Cart_Items' => $baseDir . '/includes/connection/class-cart-items.php',
'WPGraphQL\\WooCommerce\\Connection\\Coupons' => $baseDir . '/includes/connection/class-coupons.php',
+1
View File
@@ -7,4 +7,5 @@ $baseDir = dirname($vendorDir);
return array(
'WPGraphQL\\WooCommerce\\' => array($baseDir . '/includes'),
'Firebase\\JWT\\' => array($vendorDir . '/firebase/php-jwt/src'),
);
+3
View File
@@ -13,6 +13,9 @@ class ComposerAutoloaderInit51f6ef77ec7a78ec4a9df8dd9f5dc45f
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
+13
View File
@@ -16,6 +16,10 @@ class ComposerStaticInit51f6ef77ec7a78ec4a9df8dd9f5dc45f
array (
'WPGraphQL\\WooCommerce\\' => 22,
),
'F' =>
array (
'Firebase\\JWT\\' => 13,
),
);
public static $prefixDirsPsr4 = array (
@@ -23,9 +27,18 @@ class ComposerStaticInit51f6ef77ec7a78ec4a9df8dd9f5dc45f
array (
0 => __DIR__ . '/../..' . '/includes',
),
'Firebase\\JWT\\' =>
array (
0 => __DIR__ . '/..' . '/firebase/php-jwt/src',
),
);
public static $classMap = array (
'Firebase\\JWT\\BeforeValidException' => __DIR__ . '/..' . '/firebase/php-jwt/src/BeforeValidException.php',
'Firebase\\JWT\\ExpiredException' => __DIR__ . '/..' . '/firebase/php-jwt/src/ExpiredException.php',
'Firebase\\JWT\\JWK' => __DIR__ . '/..' . '/firebase/php-jwt/src/JWK.php',
'Firebase\\JWT\\JWT' => __DIR__ . '/..' . '/firebase/php-jwt/src/JWT.php',
'Firebase\\JWT\\SignatureInvalidException' => __DIR__ . '/..' . '/firebase/php-jwt/src/SignatureInvalidException.php',
'WPGraphQL\\WooCommerce\\ACF_Schema_Filters' => __DIR__ . '/../..' . '/includes/class-acf-schema-filters.php',
'WPGraphQL\\WooCommerce\\Connection\\Cart_Items' => __DIR__ . '/../..' . '/includes/connection/class-cart-items.php',
'WPGraphQL\\WooCommerce\\Connection\\Coupons' => __DIR__ . '/../..' . '/includes/connection/class-coupons.php',