Skip to content

Commit 14fb2d8

Browse files
author
Dmytro Poperechnyy
committed
MAGETWO-33060: Refactor __() to return Phrase object
- Method getSpecifyOptionMessage returns Phrase object;
1 parent c5552e4 commit 14fb2d8

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $produ
809809
}
810810
}
811811

812-
return $this->getSpecifyOptionMessage();
812+
return (string)$this->getSpecifyOptionMessage();
813813
}
814814

815815
/**
@@ -834,7 +834,7 @@ public function checkProductBuyState($product)
834834
}
835835
}
836836
if (empty($attributes)) {
837-
throw new \Magento\Framework\Model\Exception($this->getSpecifyOptionMessage());
837+
throw new \Magento\Framework\Model\Exception((string)$this->getSpecifyOptionMessage());
838838
}
839839
}
840840
return $this;
@@ -843,11 +843,11 @@ public function checkProductBuyState($product)
843843
/**
844844
* Retrieve message for specify option(s)
845845
*
846-
* @return string
846+
* @return \Magento\Framework\Phrase
847847
*/
848848
public function getSpecifyOptionMessage()
849849
{
850-
return (string)__('Please specify the product\'s option(s).');
850+
return __('Please specify the product\'s option(s).');
851851
}
852852

853853
/**

dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/ConfigurableTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,10 @@ public function testPrepareForCart()
291291

292292
public function testGetSpecifyOptionMessage()
293293
{
294-
$this->assertEquals('Please specify the product\'s option(s).', $this->_model->getSpecifyOptionMessage());
294+
$this->assertEquals(
295+
'Please specify the product\'s option(s).',
296+
(string)$this->_model->getSpecifyOptionMessage()
297+
);
295298
}
296299

297300
/**

0 commit comments

Comments
 (0)