@@ -422,23 +422,69 @@ public function testMerge($sourceRawValue = 'bazRawValue')
422422 $ this ->assertEquals (true , $ target ->breakOnFailure (), 'breakOnFailure() value not match ' );
423423 $ this ->assertEquals (true , $ target ->isRequired (), 'isRequired() value not match ' );
424424 $ this ->assertEquals ($ sourceRawValue , $ target ->getRawValue (), 'getRawValue() value not match ' );
425+ $ this ->assertTrue ($ target ->hasValue (), 'hasValue() value not match ' );
425426 }
426427
427428 /**
428429 * Specific Input::merge extras
429430 */
430- public function testInputMerge ()
431+ public function testInputMergeWithoutValues ()
431432 {
432433 $ source = new Input ();
433434 $ source ->setContinueIfEmpty (true );
435+ $ this ->assertFalse ($ source ->hasValue (), 'Source should not have a value ' );
434436
435437 $ target = $ this ->input ;
436438 $ target ->setContinueIfEmpty (false );
439+ $ this ->assertFalse ($ target ->hasValue (), 'Target should not have a value ' );
437440
438441 $ return = $ target ->merge ($ source );
439442 $ this ->assertSame ($ target , $ return , 'merge() must return it self ' );
440443
441444 $ this ->assertEquals (true , $ target ->continueIfEmpty (), 'continueIfEmpty() value not match ' );
445+ $ this ->assertFalse ($ target ->hasValue (), 'hasValue() value not match ' );
446+ }
447+
448+ /**
449+ * Specific Input::merge extras
450+ */
451+ public function testInputMergeWithSourceValue ()
452+ {
453+ $ source = new Input ();
454+ $ source ->setContinueIfEmpty (true );
455+ $ source ->setValue (['foo ' ]);
456+
457+ $ target = $ this ->input ;
458+ $ target ->setContinueIfEmpty (false );
459+ $ this ->assertFalse ($ target ->hasValue (), 'Target should not have a value ' );
460+
461+ $ return = $ target ->merge ($ source );
462+ $ this ->assertSame ($ target , $ return , 'merge() must return it self ' );
463+
464+ $ this ->assertEquals (true , $ target ->continueIfEmpty (), 'continueIfEmpty() value not match ' );
465+ $ this ->assertEquals (['foo ' ], $ target ->getRawValue (), 'getRawValue() value not match ' );
466+ $ this ->assertTrue ($ target ->hasValue (), 'hasValue() value not match ' );
467+ }
468+
469+ /**
470+ * Specific Input::merge extras
471+ */
472+ public function testInputMergeWithTargetValue ()
473+ {
474+ $ source = new Input ();
475+ $ source ->setContinueIfEmpty (true );
476+ $ this ->assertFalse ($ source ->hasValue (), 'Source should not have a value ' );
477+
478+ $ target = $ this ->input ;
479+ $ target ->setContinueIfEmpty (false );
480+ $ target ->setValue (['foo ' ]);
481+
482+ $ return = $ target ->merge ($ source );
483+ $ this ->assertSame ($ target , $ return , 'merge() must return it self ' );
484+
485+ $ this ->assertEquals (true , $ target ->continueIfEmpty (), 'continueIfEmpty() value not match ' );
486+ $ this ->assertEquals (['foo ' ], $ target ->getRawValue (), 'getRawValue() value not match ' );
487+ $ this ->assertTrue ($ target ->hasValue (), 'hasValue() value not match ' );
442488 }
443489
444490 public function fallbackValueVsIsValidProvider ()
0 commit comments