No, In addition to changing the test mode setting in the code, you need to change the test mode setting in your authorize.net account, you need to log into your authorize.net account and set the account to not use test mode.
The code you posted initially is for the Advanced Implementation Method (AIM) API with Authorize.net.
The code you posted a moment ago is for the Server Implementation Method (SIM)
Which are you using?