1087 (ceil), recipient nets >= 1000. $calc = new FeeCalculator( 349, 49 ); $total = $calc->grossUp( 1000 ); $this->assertSame( 1087, $total ); $paypal_fee = (int) ceil( $total * 0.0349 ) + 49; $this->assertGreaterThanOrEqual( 1000, $total - $paypal_fee ); } public function test_zero_and_fee_for(): void { $calc = new FeeCalculator( 349, 49 ); $this->assertSame( 0, $calc->grossUp( 0 ) ); $this->assertSame( 87, $calc->feeFor( 1000 ) ); } public function test_rejects_bad_rates(): void { $this->expectException( \InvalidArgumentException::class ); new FeeCalculator( 10000, 0 ); } public function test_money_parsing_and_format(): void { $this->assertSame( 1050, Money::fromDecimalString( '10.5', 'USD' )->minor ); $this->assertSame( '10.99', ( new Money( 1099, 'USD' ) )->toDecimalString() ); $this->assertSame( '5', ( new Money( 5, 'JPY' ) )->toDecimalString() ); $this->assertSame( '0.05', ( new Money( 5, 'USD' ) )->toDecimalString() ); } public function test_money_rejects_garbage(): void { $this->expectException( \InvalidArgumentException::class ); Money::fromDecimalString( '1e3', 'USD' ); } }