Skip to content

Commit 1376019

Browse files
nicolassingbarryvdh
authored andcommitted
cast returned value to integer (#168)
1 parent 5914cfe commit 1376019

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Common/Message/AbstractRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ public function getAmountInteger()
383383
$money = $this->getMoney();
384384

385385
if ($money !== null) {
386-
return $money->getAmount();
386+
return (int) $money->getAmount();
387387
}
388388
}
389389

tests/Omnipay/Common/Message/AbstractRequestTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,14 @@ public function testGetAmountNoDecimalsRounding()
191191
public function testGetAmountInteger()
192192
{
193193
$this->assertSame($this->request, $this->request->setAmount('13.66'));
194-
$this->assertSame('1366', $this->request->getAmountInteger());
194+
$this->assertSame(1366, $this->request->getAmountInteger());
195195
}
196196

197197
public function testGetAmountIntegerNoDecimals()
198198
{
199199
$this->assertSame($this->request, $this->request->setCurrency('JPY'));
200200
$this->assertSame($this->request, $this->request->setAmount('1366'));
201-
$this->assertSame('1366', $this->request->getAmountInteger());
201+
$this->assertSame(1366, $this->request->getAmountInteger());
202202
}
203203

204204
/**

0 commit comments

Comments
 (0)