This repository was archived by the owner on Mar 17, 2023. It is now read-only.
File tree 2 files changed +4
-0
lines changed
tests/Unit/EventSubscriber
2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ public function pushDataToBoard(IncomingMonitoringDataEvent $incomingMonitoringD
64
64
{
65
65
$ incomingMonitoringData = $ incomingMonitoringDataEvent ->getMonitoringData ();
66
66
$ monitoringDataDocument = $ this ->monitoringDataRepository ->find ($ incomingMonitoringData ->getId ());
67
+ $ this ->monitoringDataRepository ->getDocumentManager ()->refresh ($ monitoringDataDocument );
67
68
if (!$ monitoringDataDocument ) {
68
69
throw new Exception (
69
70
sprintf ('Could not find Document for id %s in %s ' , $ incomingMonitoringData ->getId (), __METHOD__ )
Original file line number Diff line number Diff line change 16
16
use App \Service \Board \MonitoringDataPush as MonitoringDataDtoPush ;
17
17
use App \Service \GrowTiles \MonitoringDataPush as MonitoringDataDocumentPush ;
18
18
use DateTimeImmutable ;
19
+ use Doctrine \ODM \MongoDB \DocumentManager ;
19
20
use PHPUnit \Framework \TestCase ;
20
21
21
22
class BoardSubscriberTest extends TestCase
@@ -62,6 +63,7 @@ public function testPushDataToBoard(): void
62
63
$ priority = 1 ;
63
64
$ idletimeOut = 60 ;
64
65
$ date = new DateTimeImmutable ();
66
+ $ documentManager = $ this ->prophesize (DocumentManager::class);
65
67
$ incomingMonitoringData = new MonitoringDataDto (
66
68
$ id ,
67
69
$ status ,
@@ -100,6 +102,7 @@ public function testPushDataToBoard(): void
100
102
$ outgoingMonitoringData
101
103
);
102
104
105
+ $ this ->monitoringDataRepository ->getDocumentManager ()->willReturn ($ documentManager );
103
106
$ this ->monitoringDataDtoPush ->invoke ($ outgoingMonitoringData )->shouldBeCalled ();
104
107
105
108
$ this ->subject ->pushDataToBoard ($ incomingEvent );
You can’t perform that action at this time.
0 commit comments