| @@ 139-152 (lines=14) @@ | ||
| 136 | $this->assertEquals($expected, $result); |
|
| 137 | } |
|
| 138 | ||
| 139 | public function testGetRegionCode() |
|
| 140 | { |
|
| 141 | $expected = 'CA'; |
|
| 142 | ||
| 143 | $address = $this->getMockBuilder(Address::class)->disableOriginalConstructor()->getMock(); |
|
| 144 | $address->method('getRegionCode')->willReturn('California'); |
|
| 145 | $address->method('getCountryId')->willReturn('US'); |
|
| 146 | ||
| 147 | $this->region->method('getId')->willReturn('5'); |
|
| 148 | $this->region->method('getCode')->willReturn($expected); |
|
| 149 | ||
| 150 | $result = $this->customer->getRegionCode($address); |
|
| 151 | $this->assertEquals($expected, $result); |
|
| 152 | } |
|
| 153 | ||
| 154 | public function testGetRegionCodeDirectPass() |
|
| 155 | { |
|
| @@ 125-138 (lines=14) @@ | ||
| 122 | $this->assertEquals($expected, $result); |
|
| 123 | } |
|
| 124 | ||
| 125 | public function testGetAppointedIdByTxid() |
|
| 126 | { |
|
| 127 | $expected = '54321'; |
|
| 128 | ||
| 129 | $select = $this->getMockBuilder(Select::class)->disableOriginalConstructor()->getMock(); |
|
| 130 | $select->method('from')->willReturn($select); |
|
| 131 | $select->method('where')->willReturn($select); |
|
| 132 | ||
| 133 | $this->connection->method('select')->willReturn($select); |
|
| 134 | $this->connection->method('fetchOne')->willReturn($expected); |
|
| 135 | ||
| 136 | $result = $this->classToTest->getAppointedIdByTxid('12345'); |
|
| 137 | $this->assertEquals($expected, $result); |
|
| 138 | } |
|
| 139 | } |
|
| 140 | ||