File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,11 @@ public function in(array $values): bool
150
150
return false ;
151
151
}
152
152
153
+ public function toFormat (string $ format ): self
154
+ {
155
+ return new static ($ this ->getValue ($ format ));
156
+ }
157
+
153
158
/**
154
159
* @return string[]
155
160
*/
Original file line number Diff line number Diff line change @@ -478,4 +478,21 @@ public function allFormatsDataProvider(): array
478
478
],
479
479
];
480
480
}
481
+
482
+ /** @test */
483
+ public function get_new_instance_in_specific_format ()
484
+ {
485
+ /* *** Initialisation *** */
486
+ $ base = FakeMagicConstant::TYPE_ARRAY_FORMATS ();
487
+
488
+ /* *** Process *** */
489
+ $ instanceFormatA = $ base ->toFormat (FakeMagicConstant::FORMAT_A );
490
+ $ instanceFormatB = $ base ->toFormat (FakeMagicConstant::FORMAT_B );
491
+ $ instanceFormatC = $ base ->toFormat (FakeMagicConstant::FORMAT_C );
492
+
493
+ /* *** Assertion *** */
494
+ self ::assertSame ('value A ' , $ instanceFormatA ->getValue ());
495
+ self ::assertSame ('value B ' , $ instanceFormatB ->getValue ());
496
+ self ::assertSame ('value C ' , $ instanceFormatC ->getValue ());
497
+ }
481
498
}
You can’t perform that action at this time.
0 commit comments