public function testpagarboleto() { $bondi1 = new colectivo("Semtur", "K", 11); $tarj = new tarjetaComun(); $tarj->recarga(196); $this->assertEquals(5.75, $tarj->pagarBoleto($bondi1, 1441300000)); }
public $linea; public $num; public function __construct($empresa, $linea, $num) { $this->empresa = $empresa; $this->linea = $linea; $this->num = $num; } } $bondi1 = new colectivo("Semtur", "K", 11); $bondi2 = new colectivo("Semtur", "K", 22); $bondi3 = new colectivo("Mixta", 146, 11); $bondi4 = new colectivo("Mixta", 145, 32); $tarj = new tarjetaComun(); $tarjmed = new tarjetaMedioBoleto(); $tarj->pagarBoleto($bondi1, 1441300000); /*no hay saldo, $0*/ $tarj->recarga(196); /*se recargan $230*/ $tarj->pagarBoleto($bondi1, 1441300000); /*boleto normal, 230-5.75=224.25*/ $tarj->pagarBoleto($bondi1, 1441300001); /*boleto normal, paga 2 boletos en el mismo bondi, 224.25-5.75=218.5*/ $tarj->pagarBoleto($bondi2, 1441300002); /*trasbordo, 218.5-1.9=216.6*/ $tarj->pagarBoleto($bondi2, 1441300003); /*boleto normal, paga 2 boletos en el mismo bondi, 216.6-5.75=210.85*/ $tarj->pagarBoleto($bondi3, 1441300004); /*boleto normal, es una empresa distinta, 210.85-5.75=205.1*/ $tarj->pagarBoleto($bondi4, 1441303605); /*boleto normal, pasó más de 1 hora, 205.1-5.75=199.35*/