File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
src/Support/Testing/Fakes Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,11 @@ public function publish(?string $broker = null): ProducerBuilderFake
3434 return $ this ->makeProducerBuilderFake ($ broker );
3535 }
3636
37+ public function asyncPublish (?string $ broker = null ): ProducerBuilderFake
38+ {
39+ return $ this ->publish ($ broker );
40+ }
41+
3742 /** Return a ConsumerBuilder instance. */
3843 public function consumer (array $ topics = [], string $ groupId = null , string $ brokers = null ): BuilderFake
3944 {
Original file line number Diff line number Diff line change @@ -40,6 +40,30 @@ public function testItStorePublishedMessagesOnArray(): void
4040 $ this ->fake ->assertPublished ($ producer ->getMessage ());
4141 }
4242
43+ public function testItStoresMultipleMessages (): void
44+ {
45+ for ($ i = 0 ; $ i < 3 ; $ i ++) {
46+ $ this ->fake ->publish ()
47+ ->onTopic ('topic ' )
48+ ->withBody ('test ' )
49+ ->send ();
50+ }
51+
52+ $ this ->fake ->assertPublishedTimes (3 );
53+ }
54+
55+ public function testItStoresMultipleMessagesWhenPublishingAsync (): void
56+ {
57+ for ($ i = 0 ; $ i < 3 ; $ i ++) {
58+ $ this ->fake ->asyncPublish ()
59+ ->onTopic ('topic ' )
60+ ->withBody ('test ' )
61+ ->send ();
62+ }
63+
64+ $ this ->fake ->assertPublishedTimes (3 );
65+ }
66+
4367 public function testAssertPublished (): void
4468 {
4569 try {
You can’t perform that action at this time.
0 commit comments