add publishEvent metamethod in unit test