@@ -103,12 +103,21 @@ public function testNestedInlineTagParsing()
103
103
$ parsedContents [1 ]
104
104
);
105
105
$ this ->assertSame ('. ' , $ parsedContents [2 ]);
106
+
107
+ $ parsedDescription = $ parsedContents [1 ]->getParsedDescription ();
108
+ $ this ->assertCount (3 , $ parsedDescription );
109
+ $ this ->assertSame ("inline tag with \n" , $ parsedDescription [0 ]);
110
+ $ this ->assertInstanceOf (
111
+ __NAMESPACE__ . '\Tag\LinkTag ' ,
112
+ $ parsedDescription [1 ]
113
+ );
114
+ $ this ->assertSame (' in it ' , $ parsedDescription [2 ]);
106
115
}
107
-
108
- public function testEmptyInlineTag ()
116
+
117
+ public function testLiteralOpeningDelimiter ()
109
118
{
110
119
$ fixture = <<<LONGDESC
111
- This is text for a description with an empty inline tag - {@} .
120
+ This is text for a description containing { that is literal .
112
121
LONGDESC ;
113
122
$ object = new LongDescription ($ fixture );
114
123
$ this ->assertSame ($ fixture , $ object ->getContents ());
@@ -118,29 +127,35 @@ public function testEmptyInlineTag()
118
127
$ this ->assertSame ($ fixture , $ parsedContents [0 ]);
119
128
}
120
129
121
- public function testNestedEmptyInlineTag ()
130
+ public function testNestedLiteralOpeningDelimiter ()
122
131
{
123
132
$ fixture = <<<LONGDESC
124
- This is text for a description with an {@internal inline tag with an empty
125
- inline tag - {@} in it }.
133
+ This is text for a description containing {@internal inline tag that has { that
134
+ is literal }.
126
135
LONGDESC ;
127
136
$ object = new LongDescription ($ fixture );
128
137
$ this ->assertSame ($ fixture , $ object ->getContents ());
129
138
130
139
$ parsedContents = $ object ->getParsedContents ();
131
140
$ this ->assertCount (3 , $ parsedContents );
132
141
$ this ->assertSame (
133
- 'This is text for a description with an ' ,
142
+ 'This is text for a description containing ' ,
134
143
$ parsedContents [0 ]
135
144
);
136
145
$ this ->assertInstanceOf (
137
146
__NAMESPACE__ . '\Tag ' ,
138
147
$ parsedContents [1 ]
139
148
);
140
149
$ this ->assertSame ('. ' , $ parsedContents [2 ]);
150
+
151
+ $ this ->assertSame (
152
+ array ('inline tag that has { that
153
+ is literal ' ),
154
+ $ parsedContents [1 ]->getParsedDescription ()
155
+ );
141
156
}
142
157
143
- public function testInlineTagDelimiters ()
158
+ public function testLiteralClosingDelimiter ()
144
159
{
145
160
$ fixture = <<<LONGDESC
146
161
This is text for a description with {} that is not a tag.
@@ -150,10 +165,13 @@ public function testInlineTagDelimiters()
150
165
151
166
$ parsedContents = $ object ->getParsedContents ();
152
167
$ this ->assertCount (1 , $ parsedContents );
153
- $ this ->assertSame ($ fixture , $ parsedContents [0 ]);
168
+ $ this ->assertSame (
169
+ 'This is text for a description with } that is not a tag. ' ,
170
+ $ parsedContents [0 ]
171
+ );
154
172
}
155
173
156
- public function testNestedInlineTagDelimiters ()
174
+ public function testNestedLiteralClosingDelimiter ()
157
175
{
158
176
$ fixture = <<<LONGDESC
159
177
This is text for a description with {@internal inline tag with {} that is not an
@@ -173,5 +191,55 @@ public function testNestedInlineTagDelimiters()
173
191
$ parsedContents [1 ]
174
192
);
175
193
$ this ->assertSame ('. ' , $ parsedContents [2 ]);
194
+
195
+ $ this ->assertSame (
196
+ array ('inline tag with } that is not an
197
+ inline tag ' ),
198
+ $ parsedContents [1 ]->getParsedDescription ()
199
+ );
200
+ }
201
+
202
+ public function testInlineTagEscapingSequence ()
203
+ {
204
+ $ fixture = <<<LONGDESC
205
+ This is text for a description with literal {{@}link}.
206
+ LONGDESC ;
207
+ $ object = new LongDescription ($ fixture );
208
+ $ this ->assertSame ($ fixture , $ object ->getContents ());
209
+
210
+ $ parsedContents = $ object ->getParsedContents ();
211
+ $ this ->assertCount (1 , $ parsedContents );
212
+ $ this ->assertSame (
213
+ 'This is text for a description with literal {@link}. ' ,
214
+ $ parsedContents [0 ]
215
+ );
216
+ }
217
+
218
+ public function testNestedInlineTagEscapingSequence ()
219
+ {
220
+ $ fixture = <<<LONGDESC
221
+ This is text for a description with an {@internal inline tag with literal
222
+ {{@}link{} in it}.
223
+ LONGDESC ;
224
+ $ object = new LongDescription ($ fixture );
225
+ $ this ->assertSame ($ fixture , $ object ->getContents ());
226
+
227
+ $ parsedContents = $ object ->getParsedContents ();
228
+ $ this ->assertCount (3 , $ parsedContents );
229
+ $ this ->assertSame (
230
+ 'This is text for a description with an ' ,
231
+ $ parsedContents [0 ]
232
+ );
233
+ $ this ->assertInstanceOf (
234
+ __NAMESPACE__ . '\Tag ' ,
235
+ $ parsedContents [1 ]
236
+ );
237
+ $ this ->assertSame ('. ' , $ parsedContents [2 ]);
238
+
239
+ $ this ->assertSame (
240
+ array ('inline tag with literal
241
+ {@link} in it ' ),
242
+ $ parsedContents [1 ]->getParsedDescription ()
243
+ );
176
244
}
177
245
}
0 commit comments