Skip to content

Commit d23ff66

Browse files
author
Andrii Kasian
committed
MAGETWO-32622: Define Public API
- MAGETWO-37129: [TD] Samples and Links is mixed in API - fix Code Style
1 parent e94bda0 commit d23ff66

File tree

2 files changed

+53
-15
lines changed

2 files changed

+53
-15
lines changed

dev/tests/api-functional/testsuite/Magento/Downloadable/Api/LinkRepositoryTest.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -920,26 +920,12 @@ public function getListForAbsentProductProvider()
920920
]
921921
];
922922

923-
$sampleExpectation = [
924-
'fields' => [
925-
'title' => 'Downloadable Product Sample Title',
926-
'sort_order' => 0,
927-
'sample_file' => '/f/u/jellyfish_1_4.jpg',
928-
'sample_type' => 'file'
929-
]
930-
];
931-
932923
return [
933924
'links' => [
934925
'/downloadable-links',
935-
'GetLinks',
926+
'GetList',
936927
$linkExpectation,
937928
],
938-
'samples' => [
939-
'/downloadable-links/samples',
940-
'GetSamples',
941-
$sampleExpectation,
942-
],
943929
];
944930
}
945931
}

dev/tests/api-functional/testsuite/Magento/Downloadable/Api/SampleRepositoryTest.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,4 +515,56 @@ public function testDeleteThrowsExceptionIfThereIsNoDownloadableSampleWithGivenI
515515

516516
$this->_webApiCall($this->deleteServiceInfo, $requestData);
517517
}
518+
519+
/**
520+
* @magentoApiDataFixture Magento/Downloadable/_files/product_downloadable_with_files.php
521+
* @dataProvider getListForAbsentProductProvider
522+
*/
523+
public function testGetList($urlTail, $method, $expectations)
524+
{
525+
$sku = 'downloadable-product';
526+
527+
$serviceInfo = [
528+
'rest' => [
529+
'resourcePath' => '/V1/products/' . $sku . $urlTail,
530+
'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET,
531+
],
532+
'soap' => [
533+
'service' => 'downloadableSampleRepositoryV1',
534+
'serviceVersion' => 'V1',
535+
'operation' => 'downloadableSampleRepositoryV1' . $method,
536+
],
537+
];
538+
539+
$requestData = ['sku' => $sku];
540+
541+
$list = $this->_webApiCall($serviceInfo, $requestData);
542+
543+
$this->assertEquals(1, count($list));
544+
545+
$link = reset($list);
546+
foreach ($expectations['fields'] as $index => $value) {
547+
$this->assertEquals($value, $link[$index]);
548+
}
549+
}
550+
551+
public function getListForAbsentProductProvider()
552+
{
553+
$sampleExpectation = [
554+
'fields' => [
555+
'title' => 'Downloadable Product Sample Title',
556+
'sort_order' => 0,
557+
'sample_file' => '/f/u/jellyfish_1_4.jpg',
558+
'sample_type' => 'file'
559+
]
560+
];
561+
562+
return [
563+
'samples' => [
564+
'/downloadable-links/samples',
565+
'GetList',
566+
$sampleExpectation,
567+
],
568+
];
569+
}
518570
}

0 commit comments

Comments
 (0)