|
@@ 31-40 (lines=10) @@
|
| 28 |
|
* @uses phpDocumentor\Reflection\DocBlock\Description |
| 29 |
|
* @dataProvider provideSimpleExampleDescriptions |
| 30 |
|
*/ |
| 31 |
|
public function testDescriptionCanParseASimpleString($contents) |
| 32 |
|
{ |
| 33 |
|
$tagFactory = m::mock(TagFactory::class); |
| 34 |
|
$tagFactory->shouldReceive('create')->never(); |
| 35 |
|
|
| 36 |
|
$factory = new DescriptionFactory($tagFactory); |
| 37 |
|
$description = $factory->create($contents, new Context('')); |
| 38 |
|
|
| 39 |
|
$this->assertSame($contents, $description->render()); |
| 40 |
|
} |
| 41 |
|
|
| 42 |
|
/** |
| 43 |
|
* @covers ::__construct |
|
@@ 48-57 (lines=10) @@
|
| 45 |
|
* @uses phpDocumentor\Reflection\DocBlock\Description |
| 46 |
|
* @dataProvider provideEscapeSequences |
| 47 |
|
*/ |
| 48 |
|
public function testEscapeSequences($contents, $expected) |
| 49 |
|
{ |
| 50 |
|
$tagFactory = m::mock(TagFactory::class); |
| 51 |
|
$tagFactory->shouldReceive('create')->never(); |
| 52 |
|
|
| 53 |
|
$factory = new DescriptionFactory($tagFactory); |
| 54 |
|
$description = $factory->create($contents, new Context('')); |
| 55 |
|
|
| 56 |
|
$this->assertSame($expected, $description->render()); |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
/** |
| 60 |
|
* @covers ::__construct |
|
@@ 116-150 (lines=35) @@
|
| 113 |
|
* @covers ::create |
| 114 |
|
* @uses phpDocumentor\Reflection\DocBlock\Description |
| 115 |
|
*/ |
| 116 |
|
public function testIfSuperfluousStartingSpacesAreRemoved() |
| 117 |
|
{ |
| 118 |
|
$factory = new DescriptionFactory(m::mock(TagFactory::class)); |
| 119 |
|
$descriptionText = <<<DESCRIPTION |
| 120 |
|
This is a multiline |
| 121 |
|
description that you commonly |
| 122 |
|
see with tags. |
| 123 |
|
|
| 124 |
|
It does have a multiline code sample |
| 125 |
|
that should align, no matter what |
| 126 |
|
|
| 127 |
|
All spaces superfluous spaces on the |
| 128 |
|
second and later lines should be |
| 129 |
|
removed but the code sample should |
| 130 |
|
still be indented. |
| 131 |
|
DESCRIPTION; |
| 132 |
|
|
| 133 |
|
$expectedDescription = <<<DESCRIPTION |
| 134 |
|
This is a multiline |
| 135 |
|
description that you commonly |
| 136 |
|
see with tags. |
| 137 |
|
|
| 138 |
|
It does have a multiline code sample |
| 139 |
|
that should align, no matter what |
| 140 |
|
|
| 141 |
|
All spaces superfluous spaces on the |
| 142 |
|
second and later lines should be |
| 143 |
|
removed but the code sample should |
| 144 |
|
still be indented. |
| 145 |
|
DESCRIPTION; |
| 146 |
|
|
| 147 |
|
$description = $factory->create($descriptionText, new Context('')); |
| 148 |
|
|
| 149 |
|
$this->assertSame($expectedDescription, $description->render()); |
| 150 |
|
} |
| 151 |
|
|
| 152 |
|
/** |
| 153 |
|
* Provides a series of example strings that the parser should correctly interpret and return. |