The right of innocent passage through a coastal state's territorial seas without any prior notification or consent applies to all types of ships, including warships.
This is codified in the United Nations Conventions on the Law of the Sea. New Zealand's own legislation, which enforces UNCLOS, and signs UNCLOS into law for New Zealand is the United Nations Convention on the Law of the Sea Act 1996
Per UNCLOS, Warships may not enter "internal" waters. Internal waters are defined as waters which fall inside the maritime baseline.
It is worth mentioning that several UNCLOS signat