Skip to content

Commit 6aee5a1

Browse files
committed
Issue #69 Make sure we can still catch purposeful fractions of the minor currency unit.
1 parent 529b18f commit 6aee5a1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/Omnipay/Common/Message/AbstractRequestTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,18 @@ public function testAmountPrecision()
122122
$this->assertSame('0.01', $this->request->getAmount());
123123
}
124124

125+
/**
126+
* @expectedException Omnipay\Common\Exception\InvalidRequestException
127+
*
128+
* We still want to catch obvious fractions of the minor units that are
129+
* not precision errors at a much lower level.
130+
*/
131+
public function testAmountPrecisionTooHigh()
132+
{
133+
$this->assertSame($this->request, $this->request->setAmount('123.005'));
134+
$this->assertSame('123.005', $this->request->getAmount());
135+
}
136+
125137
public function testGetAmountNoDecimals()
126138
{
127139
$this->assertSame($this->request, $this->request->setCurrency('JPY'));

0 commit comments

Comments
 (0)