Put the summary of the bug you're having here
What I expected to happen was...:
What I expected to happen was the mob should not take damage of the player.
What actually happened was...:
What actually happened was the mob has take damage of the player.
Steps to Reproduce:
1. Create new world of type superflat.
2. Put command "give @a command_block"
3. Put command block in the floor and imput that command: "summon Pig ~ ~1 ~ {Invulnerable:1}"
4. Energize the command block with redstone block
5. Hit the mob with any weapon and see that dies
Players in creative can hurt the invulnerable mobs, that's intended, in survival/adventure you can't hurt it