@@ -167,6 +167,34 @@ public function testFactoryMethod() : void
167
167
* @uses \phpDocumentor\Reflection\Types\Context
168
168
*/
169
169
public function testFactoryMethodWithGenericWithSpace ()
170
+ {
171
+ $ this ->expectException (\InvalidArgumentException::class);
172
+ $ this ->expectExceptionMessage ('"\array<string, string>" is not a valid Fqsen. ' );
173
+
174
+ $ descriptionFactory = m::mock (DescriptionFactory::class);
175
+ $ resolver = new TypeResolver ();
176
+ $ context = new Context ('' );
177
+
178
+ $ description = new Description ('My Description ' );
179
+ $ descriptionFactory ->shouldReceive ('create ' )
180
+ ->with ('My Description ' , $ context )
181
+ ->andReturn ($ description );
182
+
183
+ Return_::create ('array<string, string> My Description ' , $ resolver , $ descriptionFactory , $ context );
184
+ }
185
+
186
+ /**
187
+ * @see self::testFactoryMethodWithGenericWithSpace()
188
+ *
189
+ * @covers ::create
190
+ * @uses \phpDocumentor\Reflection\DocBlock\Tags\Return_::<public>
191
+ * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
192
+ * @uses \phpDocumentor\Reflection\TypeResolver
193
+ * @uses \phpDocumentor\Reflection\DocBlock\Description
194
+ * @uses \phpDocumentor\Reflection\Types\String_
195
+ * @uses \phpDocumentor\Reflection\Types\Context
196
+ */
197
+ public function testFactoryMethodWithGenericWithSpaceAndAddedEmojisToVerifyMultiByteBehaviour ()
170
198
{
171
199
$ this ->expectException (\InvalidArgumentException::class);
172
200
$ this ->expectExceptionMessage ('"\array😁<string,😁 😁string>" is not a valid Fqsen. ' );
@@ -180,7 +208,34 @@ public function testFactoryMethodWithGenericWithSpace()
180
208
->with ('My Description ' , $ context )
181
209
->andReturn ($ description );
182
210
183
- Return_::create ('array😁<string,😁 string> My Description ' , $ resolver , $ descriptionFactory , $ context );
211
+ Return_::create ('array😁<string,😁 😁string> My Description ' , $ resolver , $ descriptionFactory , $ context );
212
+ }
213
+
214
+ /**
215
+ * @covers ::create
216
+ * @uses \phpDocumentor\Reflection\DocBlock\Tags\Return_::<public>
217
+ * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
218
+ * @uses \phpDocumentor\Reflection\TypeResolver
219
+ * @uses \phpDocumentor\Reflection\DocBlock\Description
220
+ * @uses \phpDocumentor\Reflection\Types\String_
221
+ * @uses \phpDocumentor\Reflection\Types\Context
222
+ */
223
+ public function testFactoryMethodWithEmojisToVerifyMultiByteBehaviour ()
224
+ {
225
+ $ descriptionFactory = m::mock (DescriptionFactory::class);
226
+ $ resolver = new TypeResolver ();
227
+ $ context = new Context ('' );
228
+
229
+ $ description = new Description ('My Description ' );
230
+ $ descriptionFactory ->shouldReceive ('create ' )
231
+ ->with ('My Description ' , $ context )
232
+ ->andReturn ($ description );
233
+
234
+ $ fixture = Return_::create ('\My😁Class My Description ' , $ resolver , $ descriptionFactory , $ context );
235
+
236
+ $ this ->assertSame ('\My😁Class My Description ' , (string ) $ fixture );
237
+ $ this ->assertEquals ('\My😁Class ' , $ fixture ->getType ());
238
+ $ this ->assertSame ($ description , $ fixture ->getDescription ());
184
239
}
185
240
186
241
/**
0 commit comments