@@ -91,6 +91,31 @@ function it_adds_success_flashes_with_fallback_message(
9191 $ this ->addSuccessFlash ($ operation , $ context );
9292 }
9393
94+ function it_adds_success_flashes_with_custom_message (
95+ Request $ request ,
96+ SessionInterface $ session ,
97+ FlashBagInterface $ flashBag ,
98+ TranslatorBagInterface $ translator ,
99+ MessageCatalogueInterface $ messageCatalogue ,
100+ ): void {
101+ $ operation = (new Create (notificationMessage: 'app.dummy.shipped ' ))->withResource (new ResourceMetadata (alias: 'app.dummy ' , name: 'dummy ' , applicationName: 'app ' ));
102+ $ context = new Context (new RequestOption ($ request ->getWrappedObject ()));
103+
104+ $ request ->getSession ()->willReturn ($ session );
105+
106+ $ session ->getBag ('flashes ' )->willReturn ($ flashBag );
107+
108+ $ translator ->getCatalogue ()->willReturn ($ messageCatalogue );
109+
110+ $ messageCatalogue ->has ('app.dummy.shipped ' , 'flashes ' )->willReturn (true )->shouldBeCalled ();
111+
112+ $ translator ->trans ('app.dummy.shipped ' , ['%resource% ' => 'Dummy ' ], 'flashes ' )->willReturn ('Dummy was shipped successfully. ' )->shouldBeCalled ();
113+
114+ $ flashBag ->add ('success ' , 'Dummy was shipped successfully. ' )->shouldBeCalled ();
115+
116+ $ this ->addSuccessFlash ($ operation , $ context );
117+ }
118+
94119 function it_adds_success_flashes_with_default_message_when_translator_is_not_a_bag (
95120 Request $ request ,
96121 SessionInterface $ session ,
0 commit comments