function assertEqualFields($object, $fields) { foreach ($fields as $field_name => $field_value) { if ($object->{$field_name} != $field_value) { $this->fail(); } } }