MB-7629: Fix some C89 compatibility issue in unit test code

According to C89, declare variables at the beginning of a scope block.

Change-Id: I500b80bb9bd66edd2c7da27111b9f0cfa0f8da52
Reviewed-on: http://review.couchbase.org/26998
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>