I was experiencing a similar condition and then read this portion of the thread. Testing command line worked, testing the service directly didn't, saving and scheduling the immediate check did. Odd...that's just what happened.
Testing from the CCM is not 100% reliable (it doesn't work with all checks) and it's not supposed to be a substitute for testing from the CLI.
Save and Apply Configuration. Go to Home->Service Detail, click on the service and schedule an immediate check to see if you are going to get the correct output this time.
This is most likely due to the fact that the "test check command" in the ui runs with different permission than your check may require. This is done for security reasons, so it is WAI. Just be aware that checks that require elevated privs may not work from the ui.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.