Skip to content

Commit ca3ab03

Browse files
author
Serhiy Shkolyarenko
committed
MAGETWO-54303: Issue with fetching shipping charges based on city
added unit tests
1 parent 57b41f2 commit ca3ab03

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

app/code/Magento/Fedex/Test/Unit/Model/CarrierTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,30 @@ protected function setUp()
148148
);
149149
}
150150

151+
public function testSetRequestWithoutCity()
152+
{
153+
$requestMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Address\RateRequest::class)
154+
->disableOriginalConstructor()
155+
->setMethods(['getDestCity'])
156+
->getMock();
157+
$requestMock->expects($this->once())
158+
->method('getDestCity')
159+
->willReturn(null);
160+
$this->_model->setRequest($requestMock);
161+
}
162+
163+
public function testSetRequestWithCity()
164+
{
165+
$requestMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Address\RateRequest::class)
166+
->disableOriginalConstructor()
167+
->setMethods(['getDestCity'])
168+
->getMock();
169+
$requestMock->expects($this->exactly(2))
170+
->method('getDestCity')
171+
->willReturn('Small Town');
172+
$this->_model->setRequest($requestMock);
173+
}
174+
151175
/**
152176
* Callback function, emulates getValue function
153177
* @param $path

0 commit comments

Comments
 (0)