/**
  * Assert Link block for downloadable product on front-end
  *
  * @param CatalogProductView $downloadableProductView
  * @param CatalogProductDownloadable $product
  * @return void
  */
 public function processAssert(CatalogProductView $downloadableProductView, CatalogProductDownloadable $product)
 {
     $downloadableProductView->init($product);
     $downloadableProductView->open();
     $linksBlock = $downloadableProductView->getDownloadableViewBlock()->getDownloadableLinksBlock();
     $fields = $product->getData();
     // Title for for Link block
     \PHPUnit_Framework_Assert::assertEquals($linksBlock->getTitleForLinkBlock(), $fields['downloadable_links']['title'], 'Title for for Link block for downloadable product on front-end is not correct.');
     $this->sortDownloadableArray($fields['downloadable_links']['downloadable']['link']);
     foreach ($fields['downloadable_links']['downloadable']['link'] as $index => $link) {
         $index++;
         // Titles for each links
         // Links are displaying according to Sort Order
         \PHPUnit_Framework_Assert::assertEquals($linksBlock->getItemTitle($index), $link['title'], 'Link item ' . $index . ' with title "' . $link['title'] . '" is not visible.');
         // If Links can be Purchase Separately, check-nob is presented near each link
         // If Links CANNOT be Purchase Separately, check-nob is not presented near each link
         if ($fields['downloadable_links']['links_purchased_separately'] == "Yes") {
             \PHPUnit_Framework_Assert::assertTrue($linksBlock->isVisibleItemCheckbox($index), 'Item ' . $index . ' link block CANNOT be Purchase Separately.');
             // Price is equals passed according to fixture
             $link['price'] = sprintf('$%1.2f', $link['price']);
             \PHPUnit_Framework_Assert::assertEquals($linksBlock->getItemPrice($index), $link['price'], 'Link item ' . $index . ' price is not visible.');
         } elseif ($fields['downloadable_links']['links_purchased_separately'] == "No") {
             \PHPUnit_Framework_Assert::assertFalse($linksBlock->isVisibleItemCheckbox($index), 'Item ' . $index . ' link block can be Purchase Separately.');
         }
     }
 }
 /**
  * Assert Sample block for downloadable product on front-end
  *
  * @param CatalogProductView $productView
  * @param CatalogProductDownloadable $product
  * @return void
  */
 public function processAssert(CatalogProductView $productView, CatalogProductDownloadable $product)
 {
     $productView->init($product);
     $productView->open();
     $sampleBlock = $productView->getDownloadableViewBlock()->getDownloadableSamplesBlock();
     $fields = $product->getData();
     // Title for for sample block
     \PHPUnit_Framework_Assert::assertEquals($sampleBlock->getTitleForSampleBlock(), $fields['downloadable_sample']['title'], 'Title for for Samples block for downloadable product on front-end is not correct.');
     $this->sortDownloadableArray($fields['downloadable_sample']['downloadable']['sample']);
     foreach ($fields['downloadable_sample']['downloadable']['sample'] as $index => $sample) {
         // Titles for each sample
         // Samples are displaying according to Sort Order
         \PHPUnit_Framework_Assert::assertEquals($sampleBlock->getItemTitle(++$index), $sample['title'], 'Sample item ' . $index . ' with title "' . $sample['title'] . '" is not visible.');
     }
 }