6 declare(strict_types=1);
24 public function testQueryAllFieldsDownloadableProductsWithDownloadableFileAndSample()
26 $productSku =
'downloadable-product';
29 products(filter:{sku: {eq:
"{$productSku}"}})
51 ...
on DownloadableProduct {
53 links_purchased_separately
55 downloadable_product_links{
68 downloadable_product_samples{
84 \
Magento\Downloadable\Model\Link::XML_PATH_CONFIG_IS_SHAREABLE,
95 $this->assertNull($downloadableProduct->getWeight());
96 $IsLinksPurchasedSeparately = $downloadableProduct->getLinksPurchasedSeparately();
97 $linksTitle = $downloadableProduct->getLinksTitle();
99 $IsLinksPurchasedSeparately,
100 $response[
'products'][
'items'][0][
'links_purchased_separately']
102 $this->assertEquals($linksTitle,
$response[
'products'][
'items'][0][
'links_title']);
103 $this->assertDownloadableProductLinks($downloadableProduct,
$response[
'products'][
'items'][0]);
104 $this->assertDownloadableProductSamples($downloadableProduct,
$response[
'products'][
'items'][0]);
111 public function testDownloadableProductQueryWithNoSample()
113 $productSku =
'downloadable-product';
116 products(filter:{sku: {eq:
"{$productSku}"}})
126 ...on PhysicalProductInterface{
141 ...
on DownloadableProduct {
143 links_purchased_separately
145 downloadable_product_links{
156 downloadable_product_samples{
177 \
Magento\Downloadable\Model\Link::XML_PATH_CONFIG_IS_SHAREABLE,
182 $IsLinksPurchasedSeparately = $downloadableProduct->getLinksPurchasedSeparately();
183 $linksTitle = $downloadableProduct->getLinksTitle();
185 $IsLinksPurchasedSeparately,
186 $response[
'products'][
'items'][0][
'links_purchased_separately']
188 $this->assertEquals($linksTitle,
$response[
'products'][
'items'][0][
'links_title']);
189 $this->assertEmpty(
$response[
'products'][
'items'][0][
'downloadable_product_samples']);
190 $this->assertNotEmpty(
191 $response[
'products'][
'items'][0][
'downloadable_product_links'],
192 "Precondition failed: 'downloadable_product_links' must not be empty" 195 $downloadableProductLinks = $downloadableProduct->getExtensionAttributes()->getDownloadableProductLinks();
196 $downloadableProductLink = $downloadableProductLinks[0];
198 $response[
'products'][
'items'][0][
'downloadable_product_links'][0],
200 'id' => $downloadableProductLink->getId(),
201 'is_shareable' =>
false,
202 'number_of_downloads' => $downloadableProductLink->getNumberOfDownloads(),
203 'sort_order' => $downloadableProductLink->getSortOrder(),
204 'title' => $downloadableProductLink->getTitle(),
205 'link_type' => strtoupper($downloadableProductLink->getLinkType()),
206 'price' => $downloadableProductLink->getPrice()
215 private function assertDownloadableProductLinks(
$product, $actualResponse)
217 $this->assertNotEmpty(
218 $actualResponse[
'downloadable_product_links'],
219 "Precondition failed: 'downloadable_product_links' must not be empty" 222 $downloadableProductLinks =
$product->getExtensionAttributes()->getDownloadableProductLinks();
223 $downloadableProductLink = $downloadableProductLinks[1];
226 $actualResponse[
'downloadable_product_links'][1],
228 'id' => $downloadableProductLink->getId(),
229 'sample_url' => $downloadableProductLink->getSampleUrl(),
230 'sample_type' => strtoupper($downloadableProductLink->getSampleType()),
231 'is_shareable' =>
false,
232 'number_of_downloads' => $downloadableProductLink->getNumberOfDownloads(),
233 'sort_order' => $downloadableProductLink->getSortOrder(),
234 'title' => $downloadableProductLink->getTitle(),
235 'link_type' => strtoupper($downloadableProductLink->getLinkType()),
236 'price' => $downloadableProductLink->getPrice()
245 private function assertDownloadableProductSamples(
$product, $actualResponse)
247 $this->assertNotEmpty(
248 $actualResponse[
'downloadable_product_samples'],
249 "Precondition failed: 'downloadable_product_samples' must not be empty" 252 $downloadableProductSamples =
$product->getExtensionAttributes()->getDownloadableProductSamples();
253 $downloadableProductSample = $downloadableProductSamples[0];
255 $actualResponse[
'downloadable_product_samples'][0],
257 'title' => $downloadableProductSample->getTitle(),
258 'sort_order' =>$downloadableProductSample->getSortOrder(),
259 'sample_type' => strtoupper($downloadableProductSample->getSampleType()),
260 'sample_file' => $downloadableProductSample->getSampleFile()
$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=[])