Skip to content

Commit 2b63106

Browse files
committed
"Uses" -> add more test only
1 parent e31c62d commit 2b63106

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

tests/unit/DocBlock/Tags/UsesTest.php

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Mockery as m;
1717
use phpDocumentor\Reflection\DocBlock\Description;
1818
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
19+
use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
1920
use phpDocumentor\Reflection\Fqsen;
2021
use phpDocumentor\Reflection\FqsenResolver;
2122
use phpDocumentor\Reflection\Types\Context;
@@ -129,6 +130,12 @@ public function testStringRepresentationIsReturned() : void
129130
*/
130131
public function testStringRepresentationIsReturnedWithoutDescription() : void
131132
{
133+
$fixture = new Uses(new Fqsen('\\'));
134+
135+
$this->assertSame('\\', (string) $fixture);
136+
137+
// ---
138+
132139
$fixture = new Uses(new Fqsen('\DateTime'));
133140

134141
$this->assertSame('\DateTime', (string) $fixture);
@@ -170,6 +177,66 @@ public function testFactoryMethod() : void
170177
$this->assertSame($description, $fixture->getDescription());
171178
}
172179

180+
/**
181+
* @uses \phpDocumentor\Reflection\DocBlock\Tags\See::<public>
182+
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
183+
* @uses \phpDocumentor\Reflection\FqsenResolver
184+
* @uses \phpDocumentor\Reflection\DocBlock\Description
185+
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Url
186+
* @uses \phpDocumentor\Reflection\Types\Context
187+
*
188+
* @covers ::create
189+
*/
190+
public function testFactoryMethodWithoutSpaceBeforeClass() : void
191+
{
192+
$fqsenResolver = new FqsenResolver();
193+
$tagFactory = new StandardTagFactory($fqsenResolver);
194+
$descriptionFactory = new DescriptionFactory($tagFactory);
195+
$context = new Context('');
196+
197+
$fixture = Uses::create(
198+
'Foo My Description ',
199+
$fqsenResolver,
200+
$descriptionFactory,
201+
$context
202+
);
203+
204+
$this->assertSame('\Foo My Description ', (string) $fixture);
205+
$this->assertInstanceOf(Fqsen::class, $fixture->getReference());
206+
$this->assertSame('\\Foo', (string) $fixture->getReference());
207+
$this->assertSame('My Description ', $fixture->getDescription() . '');
208+
}
209+
210+
/**
211+
* @uses \phpDocumentor\Reflection\DocBlock\Tags\See::<public>
212+
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
213+
* @uses \phpDocumentor\Reflection\FqsenResolver
214+
* @uses \phpDocumentor\Reflection\DocBlock\Description
215+
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Url
216+
* @uses \phpDocumentor\Reflection\Types\Context
217+
*
218+
* @covers ::create
219+
*/
220+
public function testFactoryMethodWithSpaceBeforeClass() : void
221+
{
222+
$fqsenResolver = new FqsenResolver();
223+
$tagFactory = new StandardTagFactory($fqsenResolver);
224+
$descriptionFactory = new DescriptionFactory($tagFactory);
225+
$context = new Context('');
226+
227+
$fixture = Uses::create(
228+
' Foo My Description ',
229+
$fqsenResolver,
230+
$descriptionFactory,
231+
$context
232+
);
233+
234+
$this->assertSame('\ Foo My Description ', (string) $fixture);
235+
$this->assertInstanceOf(Fqsen::class, $fixture->getReference());
236+
$this->assertSame('\\', (string) $fixture->getReference());
237+
$this->assertSame('Foo My Description ', $fixture->getDescription() . '');
238+
}
239+
173240
/**
174241
* @covers ::create
175242
*/

0 commit comments

Comments
 (0)