Skip to content

Commit 4fc236a

Browse files
author
Yu Tang
committed
MAGETWO-28253: Downloadable Integration API
- Fix static build errors
1 parent 8fa4fd6 commit 4fc236a

File tree

7 files changed

+18
-8
lines changed

7 files changed

+18
-8
lines changed

app/code/Magento/Downloadable/Model/LinkRepository.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ public function save($sku, LinkInterface $link, $isGlobalScopeContent = false)
226226
* @param \Magento\Catalog\Api\Data\ProductInterface $product
227227
* @param LinkInterface $link
228228
* @param bool $isGlobalScopeContent
229+
* @return int
229230
*/
230231
protected function saveLink(
231232
\Magento\Catalog\Api\Data\ProductInterface $product,

app/code/Magento/Downloadable/Model/SampleRepository.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ public function save(
105105
}
106106
}
107107

108+
/**
109+
* @param \Magento\Catalog\Api\Data\ProductInterface $product
110+
* @param SampleInterface $sample
111+
* @param bool $isGlobalScopeContent
112+
* @return int
113+
*/
108114
protected function saveSample(
109115
\Magento\Catalog\Api\Data\ProductInterface $product,
110116
SampleInterface $sample,
@@ -142,10 +148,12 @@ protected function saveSample(
142148
/**
143149
* @param \Magento\Catalog\Api\Data\ProductInterface $product
144150
* @param SampleInterface $sample
145-
* @param $isGlobalScopeContent
146-
* @return mixed
151+
* @param bool $isGlobalScopeContent
152+
* @return int
147153
* @throws InputException
148154
* @throws NoSuchEntityException
155+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
156+
* @SuppressWarnings(PHPMD.NPathComplexity)
149157
*/
150158
protected function updateSample(
151159
\Magento\Catalog\Api\Data\ProductInterface $product,

app/code/Magento/Downloadable/Test/Unit/Model/Link/ContentValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected function setUp()
5252
);
5353
$this->linkFileMock = $this->getMock('\Magento\Downloadable\Api\Data\File\ContentInterface');
5454
$this->sampleFileMock = $this->getMock('\Magento\Downloadable\Api\Data\File\ContentInterface');
55-
$this->validator = new \Magento\Downloadable\Model\Link\ContentValidator($this->fileValidatorMock, $this->urlValidatorMock);
55+
$this->validator = new ContentValidator($this->fileValidatorMock, $this->urlValidatorMock);
5656
}
5757

5858
public function testIsValid()

app/code/Magento/Downloadable/Test/Unit/Model/Plugin/AroundProductRepositorySaveTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,7 @@ public function testAroundSaveWithOnlyLinks()
266266
public function testAroundSaveWithOnlySamples()
267267
{
268268
$productSku = "downloadable_product";
269-
$existingLinkId = '2';
270269
$existingSampleId = '5';
271-
$toBeDeletedLinkId = '3';
272270
$toBeDeletedSampleId = '4';
273271

274272
$this->productMock->expects($this->once())->method('getTypeId')

app/code/Magento/Downloadable/Test/Unit/Model/Product/TypeHandler/LinkTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public function testSave($product, array $data, array $modelData)
6868

6969
/**
7070
* @return array
71+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
7172
*/
7273
public function saveDataProvider()
7374
{

app/code/Magento/Downloadable/Test/Unit/Model/Sample/ContentValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ protected function setUp()
5151
false
5252
);
5353
$this->sampleFileMock = $this->getMock('\Magento\Downloadable\Api\Data\File\ContentInterface');
54-
$this->validator = new \Magento\Downloadable\Model\Sample\ContentValidator($this->fileValidatorMock, $this->urlValidatorMock);
54+
$this->validator = new ContentValidator($this->fileValidatorMock, $this->urlValidatorMock);
5555
}
5656

5757
public function testIsValid()

app/code/Magento/Downloadable/Test/Unit/Model/SampleRepositoryTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ public function testUpdate()
201201
'',
202202
false
203203
);
204-
$this->sampleFactoryMock->expects($this->once())->method('create')->will($this->returnValue($existingSampleMock));
204+
$this->sampleFactoryMock->expects($this->once())->method('create')
205+
->will($this->returnValue($existingSampleMock));
205206
$sampleMock = $this->getSampleMock($sampleData);
206207
$this->contentValidatorMock->expects($this->any())->method('isValid')->with($sampleMock)
207208
->will($this->returnValue(true));
@@ -254,7 +255,8 @@ public function testUpdateThrowsExceptionIfTitleIsEmptyAndScopeIsGlobal()
254255
$existingSampleMock->expects($this->any())->method('getId')->will($this->returnValue($sampleId));
255256
$existingSampleMock->expects($this->once())->method('load')->with($sampleId)->will($this->returnSelf());
256257
$existingSampleMock->expects($this->any())->method('getProductId')->will($this->returnValue($productId));
257-
$this->sampleFactoryMock->expects($this->once())->method('create')->will($this->returnValue($existingSampleMock));
258+
$this->sampleFactoryMock->expects($this->once())->method('create')
259+
->will($this->returnValue($existingSampleMock));
258260
$sampleMock = $this->getSampleMock($sampleData);
259261
$this->contentValidatorMock->expects($this->any())->method('isValid')->with($sampleMock)
260262
->will($this->returnValue(true));

0 commit comments

Comments
 (0)