assertSame('1.0000', AgentCommissionService::rateSpread('5', '4')); $this->assertSame('0.0000', AgentCommissionService::rateSpread('4', '4')); $this->assertSame('0.0000', AgentCommissionService::rateSpread('4', '5')); } public function test_own_members_use_full_rate_and_child_members_use_spread(): void { $ownFlow = AgentCommissionService::amountByRate('1000', '5'); $childFlow = AgentCommissionService::amountByRate('1000', AgentCommissionService::rateSpread('5', '4')); $this->assertSame('50.0000', $ownFlow); $this->assertSame('10.0000', $childFlow); $this->assertSame('60.0000', bcadd($ownFlow, $childFlow, 4)); } public function test_profit_commission_uses_member_loss_only(): void { $this->assertSame('100.0000', AgentCommissionService::profitBase('-100')); $this->assertSame('0.0000', AgentCommissionService::profitBase('80')); $own = AgentCommissionService::amountByRate(AgentCommissionService::profitBase('-200'), '5'); $child = AgentCommissionService::amountByRate( AgentCommissionService::profitBase('-200'), AgentCommissionService::rateSpread('5', '4') ); $this->assertSame('10.0000', $own); $this->assertSame('2.0000', $child); } }