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
78
78
*/
79
79
private $ properties = [];
80
80
81
- public function __construct ()
81
+ public function __construct ($ body = '' , array $ properties = [], array $ headers = [] )
82
82
{
83
- $ this ->headers = [];
84
- $ this ->properties = [];
83
+ $ this ->body = $ body ;
84
+ $ this ->headers = $ headers ;
85
+ $ this ->properties = $ properties ;
86
+
85
87
$ this ->scope = static ::SCOPE_MESSAGE_BUS ;
86
88
}
87
89
Original file line number Diff line number Diff line change 7
7
8
8
class MessageTest extends TestCase
9
9
{
10
- public function testCouldBeConstructedWithoutAnyArguments ()
10
+ public function testCouldBeConstructedWithoutArguments ()
11
11
{
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 ());
13
26
}
14
27
15
28
public function testShouldAllowGetPreviouslySetBody ()
You can’t perform that action at this time.
0 commit comments