File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -78,10 +78,12 @@ class Message
7878 */
7979 private $ properties = [];
8080
81- public function __construct ()
81+ public function __construct ($ body = '' , array $ properties = [], array $ headers = [] )
8282 {
83- $ this ->headers = [];
84- $ this ->properties = [];
83+ $ this ->body = $ body ;
84+ $ this ->headers = $ headers ;
85+ $ this ->properties = $ properties ;
86+
8587 $ this ->scope = static ::SCOPE_MESSAGE_BUS ;
8688 }
8789
Original file line number Diff line number Diff line change 77
88class MessageTest extends TestCase
99{
10- public function testCouldBeConstructedWithoutAnyArguments ()
10+ public function testCouldBeConstructedWithoutArguments ()
1111 {
12- new Message ();
12+ $ message = new Message ();
13+
14+ $ this ->assertSame ('' , $ message ->getBody ());
15+ $ this ->assertSame ([], $ message ->getProperties ());
16+ $ this ->assertSame ([], $ message ->getHeaders ());
17+ }
18+
19+ public function testCouldBeConstructedWithOptionalArguments ()
20+ {
21+ $ message = new Message ('theBody ' , ['barProp ' => 'barPropVal ' ], ['fooHeader ' => 'fooHeaderVal ' ]);
22+
23+ $ this ->assertSame ('theBody ' , $ message ->getBody ());
24+ $ this ->assertSame (['barProp ' => 'barPropVal ' ], $ message ->getProperties ());
25+ $ this ->assertSame (['fooHeader ' => 'fooHeaderVal ' ], $ message ->getHeaders ());
1326 }
1427
1528 public function testShouldAllowGetPreviouslySetBody ()
You can’t perform that action at this time.
0 commit comments