Skip to content

Commit b20db76

Browse files
author
Cari Spruiell
committed
MAGETWO-64047: WebAPI: It's impossible to empty numeric fields after they're set
- fix tests
1 parent 373186e commit b20db76

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function afterSave($object)
128128
$attribute = $this->getAttribute();
129129
$attributeCode = $attribute->getAttributeCode();
130130
$value = $object->getData($attributeCode);
131-
if ($value === null || (float)$value > 0) {
131+
if ($value === null || (float)$value > 0) {
132132
if ($attribute->isScopeWebsite() && $object->getStoreId() != \Magento\Store\Model\Store::DEFAULT_STORE_ID) {
133133
if ($this->isUseDefault($object)) {
134134
$value = null;

dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,6 +1275,11 @@ public function testSpecialPrice()
12751275
*/
12761276
public function testResetSpecialPrice()
12771277
{
1278+
$this->_markTestAsRestOnly(
1279+
'In order to properly run this test for SOAP, XML must be used to specify <value></value> ' .
1280+
'for the special_price value. Otherwise, the null value gets processed as a string and ' .
1281+
'cast to a double value of 0.0.'
1282+
);
12781283
$productData = $this->getSimpleProductData();
12791284
$productData['custom_attributes'] = [
12801285
['attribute_code' => self::KEY_SPECIAL_PRICE, 'value' => 5.00]

0 commit comments

Comments
 (0)