The double spend case in TestBasicMining is meant to check that block template creation fails when two mempool transactions spend the same coin. It reuses the transaction from the preceding coinbase case, whose prevout was cleared with SetNull(), and only overwrites the prevout hash. The output index therefore stays COutPoint::NULL_INDEX, so both transactions spend an output of txFirst[0] that does not exist.
Set the output index to 0, so the first transaction is a valid spend and only the second one makes template creation fail.
Found while working on #36692 and https://github.com/yuvicc/bitcoin/pull/19.