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