File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ public function findById(string $id) : Message
109109
110110 $ message = new MessageHydrator ();
111111
112- return $ message ->hydrate ($ item [0 ][1 ][0 ], Message::class);
112+ return $ message ->hydrate ($ item [0 ][1 ][0 ] ?? [] , Message::class);
113113 }
114114
115115 /**
Original file line number Diff line number Diff line change 55
66use Asiries335 \redisSteamPhp \ClientRedisStreamPhpInterface ;
77use Asiries335 \redisSteamPhp \Data \Collection ;
8+ use Asiries335 \redisSteamPhp \Data \Message ;
89use Asiries335 \redisSteamPhp \Stream ;
910use PHPUnit \Framework \TestCase ;
1011
@@ -127,4 +128,25 @@ public function testDeleteMessage() : void
127128
128129 $ this ->assertIsInt ($ result );
129130 }
131+
132+ /**
133+ * Find by id message
134+ *
135+ * @throws \Exception
136+ *
137+ * @return void
138+ */
139+ public function testFindById () : void
140+ {
141+ $ key = '1c-234234f3w ' ;
142+
143+ // Empty.
144+ $ this ->client ->shouldReceive ('call ' )->andReturn ([]);
145+
146+ $ stream = new Stream ($ this ->client , self ::TEST_NAME_STREAM );
147+
148+ $ message = $ stream ->findById ($ key );
149+
150+ $ this ->assertEquals (new Message (), $ message );
151+ }
130152}
You can’t perform that action at this time.
0 commit comments