@@ -422,23 +422,69 @@ public function testMerge($sourceRawValue = 'bazRawValue')
422
422
$ this ->assertEquals (true , $ target ->breakOnFailure (), 'breakOnFailure() value not match ' );
423
423
$ this ->assertEquals (true , $ target ->isRequired (), 'isRequired() value not match ' );
424
424
$ this ->assertEquals ($ sourceRawValue , $ target ->getRawValue (), 'getRawValue() value not match ' );
425
+ $ this ->assertTrue ($ target ->hasValue (), 'hasValue() value not match ' );
425
426
}
426
427
427
428
/**
428
429
* Specific Input::merge extras
429
430
*/
430
- public function testInputMerge ()
431
+ public function testInputMergeWithoutValues ()
431
432
{
432
433
$ source = new Input ();
433
434
$ source ->setContinueIfEmpty (true );
435
+ $ this ->assertFalse ($ source ->hasValue (), 'Source should not have a value ' );
434
436
435
437
$ target = $ this ->input ;
436
438
$ target ->setContinueIfEmpty (false );
439
+ $ this ->assertFalse ($ target ->hasValue (), 'Target should not have a value ' );
437
440
438
441
$ return = $ target ->merge ($ source );
439
442
$ this ->assertSame ($ target , $ return , 'merge() must return it self ' );
440
443
441
444
$ 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 ' );
442
488
}
443
489
444
490
public function fallbackValueVsIsValidProvider ()
0 commit comments