/** * @test */ public function net_weight() { $log = DespatchLogEntry::first(); $this->assertInstanceOf(DespatchLogEntry::class, $log, "Despatch Log Entry Instance"); $removeCores = $log->jobCard->jobCosting->jc_remove_cores; $this->assertInternalType('bool', (bool) $removeCores, "Remove Core Bool"); $netWeigth = $log->net_weight; $this->assertInternalType('float', $netWeigth, "Net Weight Float"); $calcNetWeight = $removeCores == 1 ? $log->despatch_log_book_total - $log->despatch_log_book_pallet_kg - $log->jobCard->jobCosting->core_weight : $log->despatch_log_book_total - $log->despatch_log_book_pallet_kg; $this->assertEquals($calcNetWeight, $netWeigth, "Net Weight"); }