22 private $columnResolverMock;
32 private $locationDirectoryMock;
39 $this->locationDirectoryMock = $this->getMockBuilder(LocationDirectory::class)
40 ->setMethods([
'hasCountryId',
'getCountryId',
'hasRegionId',
'getRegionId'])
41 ->disableOriginalConstructor()
43 $this->columnResolverMock = $this->getMockBuilder(ColumnResolver::class)
44 ->disableOriginalConstructor()
47 $this->locationDirectoryMock
56 $columns = $this->rowParser->getColumns();
57 $this->assertTrue(is_array(
$columns),
'Columns should be array, ' . gettype(
$columns) .
' given');
68 'dest_country_id' =>
'0',
69 'dest_region_id' => 0,
71 'condition_name' =>
'condition_short_name',
72 'condition_value' => 40.0,
75 $rowData = [
'a',
'b',
'c',
'd',
'e'];
78 $conditionShortName =
'condition_short_name';
79 $conditionFullName =
'condition_full_name';
84 [$conditionFullName, $rowData, 40],
95 $this->assertEquals($expectedResult,
$result);
111 $conditionShortName =
'condition_short_name';
112 $actualMessage =
null;
123 }
catch (\Exception $e) {
124 $actualMessage = $e->getMessage();
127 $this->assertEquals($expectedMessage, $actualMessage);
136 $rowData = [
'a',
'b',
'c',
'd',
'e'];
137 $conditionFullName =
'condition_full_name';
146 [$conditionFullName, $rowData, 40],
149 'The "XX" country in row number "120" is incorrect. Verify the country and try again.',
158 [$conditionFullName, $rowData, 40],
161 'The "AA" region or state in row number "120" is incorrect. Verify the region or state and try again.',
170 [$conditionFullName, $rowData,
'QQQ'],
173 'Please correct condition_full_name "QQQ" in the Row #120.',
182 [$conditionFullName, $rowData, 40],
185 'The "BBB" shipping price in row number "120" is incorrect. Verify the shipping price and try again.',
199 private function parse($rowData, $conditionFullName, $rowNumber,
$websiteId, $conditionShortName, $columnValueMap)
201 $this->columnResolverMock->expects($this->any())
202 ->method(
'getColumnValue')
203 ->willReturnMap($columnValueMap);
204 $result = $this->rowParser->parse(
210 $this->columnResolverMock
parseWithExceptionDataProvider()
testParseWithException(array $rowData, $conditionFullName, array $columnValueMap, $expectedMessage)