6 declare(strict_types=1);
15 ->setTypeId(\
Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE)
17 ->setAttributeSetId(4)
19 ->setName(
'Downloadable Product')
20 ->setSku(
'downloadable-product')
22 ->setVisibility(\
Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
23 ->setStatus(\
Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
24 ->setLinksPurchasedSeparately(
true)
32 'Downloadable Product Link Title' 41 'title' =>
'Downloadable Product Link',
44 'link_url' =>
'http://example.com/downloadable.txt',
54 $link->setSortOrder(1);
56 $link->setNumberOfDownloads(0);
60 'title' =>
'Downloadable Product Link',
63 'url' =>
'http://sampleUrl.com',
67 'link_url' =>
'http://example.com/downloadable.txt',
69 'number_of_downloads' => 0,
97 $content->setName(
'jellyfish_2_4.jpg');
107 'title' =>
'Downloadable Product Sample Title',
109 'file' => json_encode(
112 'file' =>
'/f/u/jellyfish_1_4.jpg',
113 'name' =>
'jellyfish_1_4.jpg',
119 'sample_url' =>
null,
130 if (!$sampleData || (isset($sampleData[
'is_delete']) && (
bool)$sampleData[
'is_delete'])) {
133 unset($sampleData[
'sample_id']);
138 $sample->setId(
null);
139 $sample->setStoreId(
$product->getStoreId());
140 $sample->setSampleType($sampleData[
'type']);
141 $sample->setSampleUrl($sampleData[
'sample_url']);
146 \
Magento\Downloadable\Api\Data\File\ContentInterfaceFactory::class
151 $content->setName(
'jellyfish_1_4.jpg');
152 $sample->setSampleFileContent(
$content);
153 $sample->setSortOrder($sampleData[
'sort_order']);
defined('TESTS_BP')||define('TESTS_BP' __DIR__
const LINK_SHAREABLE_CONFIG
static getObjectManager()