@@ -155,4 +155,39 @@ public function testActivities() : void
155155 \array_keys ($ this ->collector ->getActivities ()[0 ]) // @phpstan-ignore-line
156156 );
157157 }
158+
159+ public function testValidationCollectorInstance () : void
160+ {
161+ $ validation = new Validation ();
162+ self ::assertNull ($ validation ->getDebugCollector ());
163+ $ validation ->setDebugCollector ($ this ->collector );
164+ self ::assertInstanceOf (
165+ ValidationCollector::class,
166+ $ validation ->getDebugCollector ()
167+ );
168+ }
169+
170+ public function testSetErrorInDebugData () : void
171+ {
172+ $ data = $ this ->collector ->getData ();
173+ self ::assertEmpty ($ data );
174+ $ this ->collector ->setErrorInDebugData ('email ' , 'Email error. ' );
175+ $ data = $ this ->collector ->getData ();
176+ self ::assertCount (0 , $ data );
177+ $ this ->collector ->addData ([
178+ 'start ' => 1676932480 ,
179+ 'end ' => 1676932490 ,
180+ 'validated ' => false ,
181+ 'errors ' => ['foo ' => 'Foo error. ' ],
182+ 'type ' => 'all ' ,
183+ ]);
184+ $ data = $ this ->collector ->getData ();
185+ self ::assertCount (1 , $ data [0 ]['errors ' ]);
186+ $ this ->collector ->setErrorInDebugData ('email ' , 'Email error. ' );
187+ $ data = $ this ->collector ->getData ();
188+ self ::assertCount (2 , $ data [0 ]['errors ' ]);
189+ $ this ->collector ->setErrorInDebugData ('bar ' , 'Bar error. ' , 1 );
190+ $ data = $ this ->collector ->getData ();
191+ self ::assertCount (1 , $ data [1 ]['errors ' ]);
192+ }
158193}
0 commit comments