How do i test for an entity relative to a player

You should use /execute to have the command executed from the player rather than the command block:

/execute @a ~ ~ ~ /testfor @e[type=Shulker,name=Code,r=1]