/** * @param mixed $labelText * @param string $attributeCode * @param string $expectedResult * @dataProvider getLabelDataProvider */ public function testGetLocalizedLabel($labelText, $attributeCode, $expectedResult) { $this->attributeMock->expects($this->exactly(2))->method('getFrontendLabel')->willReturn($labelText); $this->attributeMock->expects($this->any())->method('getAttributeCode')->willReturn($attributeCode); $this->assertInstanceOf('\\Magento\\Framework\\Phrase', $this->model->getLocalizedLabel()); $this->assertSame($expectedResult, (string) $this->model->getLocalizedLabel()); }
public function testGetValue() { $attributeValue = '11-11-2011'; $date = new \DateTime($attributeValue); $object = new \Magento\Framework\Object(['datetime' => $attributeValue]); $this->attributeMock->expects($this->any())->method('getData')->with('frontend_input')->will($this->returnValue('text')); $this->localeDateMock->expects($this->once())->method('formatDateTime')->with($date, \IntlDateFormatter::MEDIUM, \IntlDateFormatter::NONE, null, null, null)->willReturn($attributeValue); $this->assertEquals($attributeValue, $this->model->getValue($object)); }