File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ public function getMarking($subject): Marking
6161 }
6262
6363 if ($ this ->singleState ) {
64- $ marking = [$ marking => 1 ];
64+ $ marking = [( string ) $ marking => 1 ];
6565 }
6666
6767 return new Marking ($ marking );
Original file line number Diff line number Diff line change @@ -52,4 +52,35 @@ public function testGetSetMarkingWithSingleState()
5252
5353 $ this ->assertEquals ($ marking , $ marking2 );
5454 }
55+
56+ public function testGetMarkingWithValueObject ()
57+ {
58+ $ subject = new Subject ($ this ->createValueObject ('first_place ' ));
59+
60+ $ markingStore = new MethodMarkingStore (true );
61+
62+ $ marking = $ markingStore ->getMarking ($ subject );
63+
64+ $ this ->assertInstanceOf (Marking::class, $ marking );
65+ $ this ->assertCount (1 , $ marking ->getPlaces ());
66+ $ this ->assertSame ('first_place ' , (string ) $ subject ->getMarking ());
67+ }
68+
69+ private function createValueObject (string $ markingValue )
70+ {
71+ return new class ($ markingValue ) {
72+ /** @var string */
73+ private $ markingValue ;
74+
75+ public function __construct (string $ markingValue )
76+ {
77+ $ this ->markingValue = $ markingValue ;
78+ }
79+
80+ public function __toString ()
81+ {
82+ return $ this ->markingValue ;
83+ }
84+ };
85+ }
5586}
You can’t perform that action at this time.
0 commit comments