21 'title' =>
'Downloadable Product Sample Title',
23 'file' => json_encode(
26 'file' =>
'/f/u/jellyfish_1_4.jpg',
27 'name' =>
'jellyfish_1_4.jpg',
39 \
Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE
47 'Downloadable Product' 49 'downloadable-product' 53 \
Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH
55 \
Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED
63 'title' =>
'Downloadable Product Link',
72 'number_of_downloads' => 15,
86 $content->setName(
'jellyfish_2_4.jpg');
104 if (!
$link->getSortOrder()) {
105 $link->setSortOrder(1);
107 if (
null ===
$link->getPrice()) {
110 if (
$link->getIsUnlimited()) {
111 $link->setNumberOfDownloads(0);
120 if (!$sampleData || (isset($sampleData[
'is_delete']) && (
bool)$sampleData[
'is_delete'])) {
123 unset($sampleData[
'sample_id']);
128 $sample->setId(
null);
129 $sample->setStoreId(
$product->getStoreId());
130 $sample->setSampleType($sampleData[
'type']);
131 $sample->setSampleUrl($sampleData[
'sample_url']);
136 \
Magento\Downloadable\Api\Data\File\ContentInterfaceFactory::class
141 $content->setName(
'jellyfish_1_4.jpg');
142 $sample->setSampleFileContent(
$content);
143 $sample->setSortOrder($sampleData[
'sort_order']);
151 if (
$product->getLinksPurchasedSeparately()) {
152 $product->setTypeHasRequiredOptions(
true)->setRequiredOptions(
true);
154 $product->setTypeHasRequiredOptions(
false)->setRequiredOptions(
false);
defined('TESTS_BP')||define('TESTS_BP' __DIR__
const LINK_SHAREABLE_CONFIG
static getObjectManager()