Maybe there is a method to the madness
As the designer and creator of the two, god is directly responsible for the actions of his creations. The whole apple tree test wasn't a test of the creation but the creators design
Assuming it all to be true and real - including god:
God is a designer and has designed an intelligent being with freewill. He was testing his products.
God being omnieverything and having 'inside information' on how the brain works, would have known exactly what would happen in this situation. His designs where simultaneously a success and failure; even in the face of death, freewill over powered the instructions he had given, but, his perfect creation was no longer perfect.
If he designed man perfectly, then why not design the world perfectly i.e. without evil, so there is balance?
Remember, this is the second time that one of his creations has gone against his instruction as a result of having freewill. He is only too aware of what will happen.
We are here for his entertainment.
Assuming it all to be true of course
Groovycat