How do you setblock a command block that testsfor a named item in a player's inventory? [duplicate]
The problem is because you are trying to put quotes inside of eachother and the game doesn't know how to handle it. What you have to do is put backslashes before the quotes inside so it knows to use them in the command instead of as the main quote
/setblock -9456 83 10214 command_block 0 replace {Command:"/testfor @p {Inventory:[{id:\"minecraft:gold_nugget\",tag:{display:{Name:\"Golden Leaf\"}}}]}"}