6 declare(strict_types=1);
26 public function testAllFieldsBundleProducts()
28 $productSku =
'bundle-product';
32 products(filter: {sku: {eq:
"{$productSku}"}})
40 ...
on PhysicalProductInterface {
43 ...
on BundleProduct {
87 $bundleProduct->getData($metadataPool->getMetadata(ProductInterface::class)->getLinkField())
90 $this->assertEquals(
'SEPARATELY',
$response[
'products'][
'items'][0][
'ship_bundle_items']);
92 $this->assertEquals(
'TOGETHER',
$response[
'products'][
'items'][0][
'ship_bundle_items']);
95 $this->assertEquals(
'AS_LOW_AS',
$response[
'products'][
'items'][0][
'price_view']);
97 $this->assertEquals(
'PRICE_RANGE',
$response[
'products'][
'items'][0][
'price_view']);
102 $this->assertNotEmpty(
103 $response[
'products'][
'items'][0][
'items'],
104 "Precondition failed: 'items' must not be empty" 111 public function testBundleProdutWithNotVisibleChildren()
113 $productSku =
'bundle-product-1';
117 products(filter: {sku: {eq:
"{$productSku}"}})
125 ...
on PhysicalProductInterface {
128 ...
on BundleProduct {
167 \
Magento\CatalogInventory\Model\Configuration::XML_PATH_SHOW_OUT_OF_STOCK,
173 ->clean(\
Magento\Framework\
App\Config::CACHE_TAG);
175 $this->assertNotEmpty(
177 "Precondition failed: 'items' must not be empty" 186 $bundleProduct->getData($metadataPool->getMetadata(ProductInterface::class)->getLinkField())
189 $this->assertEquals(
'SEPARATELY',
$response[
'products'][
'items'][0][
'ship_bundle_items']);
191 $this->assertEquals(
'TOGETHER',
$response[
'products'][
'items'][0][
'ship_bundle_items']);
194 $this->assertEquals(
'AS_LOW_AS',
$response[
'products'][
'items'][0][
'price_view']);
196 $this->assertEquals(
'PRICE_RANGE',
$response[
'products'][
'items'][0][
'price_view']);
201 $this->assertNotEmpty(
202 $response[
'products'][
'items'][0][
'items'],
203 "Precondition failed: 'items' must not be empty" 211 private function assertBundleBaseFields(
$product, $actualResponse)
214 [
'response_field' =>
'sku',
'expected_value' =>
$product->getSku()],
215 [
'response_field' =>
'type_id',
'expected_value' =>
$product->getTypeId()],
216 [
'response_field' =>
'id',
'expected_value' =>
$product->getId()],
217 [
'response_field' =>
'name',
'expected_value' =>
$product->getName()],
218 [
'response_field' =>
'attribute_set_id',
'expected_value' =>
$product->getAttributeSetId()],
219 [
'response_field' =>
'weight',
'expected_value' =>
$product->getWeight()],
220 [
'response_field' =>
'dynamic_price',
'expected_value' => !(bool)
$product->getPriceType()],
221 [
'response_field' =>
'dynamic_weight',
'expected_value' => !(bool)
$product->getWeightType()],
222 [
'response_field' =>
'dynamic_sku',
'expected_value' => !(bool)
$product->getSkuType()]
232 private function assertBundleProductOptions(
$product, $actualResponse)
234 $this->assertNotEmpty(
235 $actualResponse[
'items'],
236 "Precondition failed: 'bundle product items' must not be empty" 244 $bundleProductLinks =
$option->getProductLinks();
245 $bundleProductLink = $bundleProductLinks[0];
246 $childProductSku = $bundleProductLink->getSku();
251 $childProduct->getData($metadataPool->getMetadata(ProductInterface::class)->getLinkField())
253 $this->assertEquals(1, count(
$options));
255 $actualResponse[
'items'][0],
257 'option_id' =>
$option->getOptionId(),
258 'title' =>
$option->getTitle(),
259 'required' =>(bool)
$option->getRequired(),
261 'position' =>
$option->getPosition(),
266 $actualResponse[
'items'][0][
'options'][0],
268 'id' => $bundleProductLink->getId(),
269 'qty' => (int)$bundleProductLink->getQty(),
270 'position' => $bundleProductLink->getPosition(),
271 'is_default' => (bool)$bundleProductLink->getIsDefault(),
273 'can_change_quantity' => $bundleProductLink->getCanChangeQuantity(),
278 $actualResponse[
'items'][0][
'options'][0][
'product'],
283 'sku' => $bundleProductLink->getSku()
291 public function testAndMaxMinPriceBundleProduct()
293 $productSku =
'bundle-product';
297 products(filter: {sku: {eq:
"{$productSku}"}})
302 ...
on PhysicalProductInterface {
349 ...
on BundleProduct {
378 $minimalPrice = $priceInfo->getPrice($priceCode)->getMinimalPrice()->getValue();
379 $maximalPrice = $priceInfo->getPrice($priceCode)->getMaximalPrice()->getValue();
382 $response[
'products'][
'items'][0][
'price'][
'minimalPrice'][
'amount'][
'value']
386 $response[
'products'][
'items'][0][
'price'][
'maximalPrice'][
'amount'][
'value']
396 $productSku =
'bundle-product';
400 products(filter: {sku: {eq:
"{$productSku}"}})
406 ...
on PhysicalProductInterface {
410 ...
on BundleProduct {
416 bundle_product_links {
427 $this->expectException(\Exception::class);
428 $this->expectExceptionMessage(
'GraphQL response contains errors: Cannot'.
' ' .
429 'query field "qty" on type "ProductInterface".');
testNonExistentFieldQtyExceptionOnBundleProduct()
const KEY_PRICE_TYPE_FIXED
const KEY_PRICE_TYPE_DYNAMIC
$block setTitle( 'CMS Block Title') -> setIdentifier('fixture_block') ->setContent('< h1 >Fixture Block Title</h1 >< a href=" store url</a><p> Config value
if( $block->displayPriceExclTax()||$block->displayBothPrices())(__('Excl. Tax')) ?>"> <?php if ($block -> displayPriceWithWeeeDetails()): ?> <span class="cart-tax-total" data-mage-init=' Magento Weee Helper Data Magento Weee Helper Data title amount
assertResponseFields($actualResponse, $assertionMap)
taxRateField this edit on("click.mselect-delete", ".mselect-delete", function() { if(!confirm('<?=/*@escapeNotVerified */__( 'Do you really want to delete this tax rate?') ?>')) { return;} var that=$(this), select=that.closest('.mselect-list').prev(), rateValue=that.parent().find( 'input[type="checkbox"]').val();$( 'body').trigger( 'processStart');var ajaxOptions={ type:'POST', data:{ tax_calculation_rate_id:rateValue, form_key:$( 'input[name="form_key"]').val() }, dataType:'json', url:'<?=/*@escapeNotVerified */$block->getTaxRateDeleteUrl() ?>', success:function(result, status) { $( 'body').trigger( 'processStop');if(result.success) { that.parent().remove();select.find( 'option').each(function() { if(this.value===rateValue) { $(this).remove();} });select.trigger( 'change.hiddenSelect');} else { if(result.error_message) alert({ content:result.error_message });else alert({ content:'<?=/*@escapeNotVerified */__( 'An error occurred') ?>' });} }, error:function() { $( 'body').trigger( 'processStop');alert({ content:'<?=/*@escapeNotVerified */__( 'An error occurred') ?>' });} };$.ajax(ajaxOptions);}) .on( 'click.mselectAdd'
graphQlQuery(string $query, array $variables=[], string $operationName='', array $headers=[])