/** * Regression test for float to int conversion error, where we lost accuracy * on straight cast of 25f (eg. 24.9999999964) to 24i * See also test in InvoicePaymentIntegrationTest, Jira issue WEB-193 */ public function test_regressiontest_for_float_to_int_conversion_errorS() { $config = Svea\SveaConfig::getDefaultConfig(); $order = WebPay::createOrder($config); $order->addOrderRow(WebPayItem::orderRow()->setAmountExVat(100.0)->setVatPercent(25)->setQuantity(1))->addFee(WebPayItem::shippingFee()->setAmountExVat(0.0)->setVatPercent(0))->addFee(WebPayItem::invoiceFee()->setAmountExVat(23.2)->setVatPercent(25)); $formatter = new WebServiceRowFormatter($order); $resultRows = $formatter->formatRows(); $testedRow = $resultRows[0]; $this->assertEquals(100, $testedRow->PricePerUnit); $this->assertEquals(25, $testedRow->VatPercent); $testedRow = $resultRows[1]; $this->assertEquals(0, $testedRow->PricePerUnit); $this->assertEquals(0, $testedRow->VatPercent); $testedRow = $resultRows[2]; $this->assertEquals(23.2, $testedRow->PricePerUnit); $this->assertEquals(25, $testedRow->VatPercent); }