If you have to use assert OR assert and allow one faillure , and NOT 2:
$failures = [];
try {
$this->assertNotEmpty( $body_obj->kamer_van_koophandel );
} catch( Exception $e) {
$failures[] = $e->getMessage();
}
try {
$this->assertNotEmpty( $body_obj->leverancier->extern_id );
} catch( Exception $e) {
$failures[] = $e->getMessage();
}
if( count( $failures ) == 2 ) {
throw new Exception (
count($failures)." assertions failed:\n\t".implode("\n\t", $failures)
);
}
@see https://stackoverflow.com/a/79505681/696680
Leave a Reply