The undulator system in the European X-ray Free Electron Laser is mainly comprised of 5-m long undulator segments and 1.1 m long intersections in between. The longitudinal component of the electrons' velocity is reduced when traveling inside an undulator due to the wiggle motion. Therefore the optical phase is detuned. The detune effect is also from the undulator fringe field where electron longitudinal speed also deviates from the oscillation condition. The total detune effect is compensated by a magnetic device called phase shifter, which is correspondingly set for a specific undulator gap. In this paper we investigate the homogeneity of the fringe field from different undulators. Different phase matching criteria are studied. The field fitting technique for the phase matching in high accuracy is demonstrated in detail. The impact by air coil is also studied. Eventually the matching test by spontaneous radiation simulation is made. A test method for high sensitivity to matching error is proposed.