Skip to content

Commit 5a6ff24

Browse files
jrfnlgrogy
authored andcommitted
Tests: add tests covering namespaced names
1 parent 9e9cd82 commit 5a6ff24

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

tests/HighlighterTest.php

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,4 +279,64 @@ public function testWhitespace()
279279
'<token_html> </token_html>'
280280
);
281281
}
282+
283+
public function testFunctionCall()
284+
{
285+
$this->compare(
286+
<<<'EOL'
287+
<?php
288+
echo functionName();
289+
EOL
290+
,
291+
<<<'EOL'
292+
<token_default><?php</token_default>
293+
<token_keyword>echo </token_keyword><token_default>functionName</token_default><token_keyword>();</token_keyword>
294+
EOL
295+
);
296+
}
297+
298+
public function testFQNFunctionCall()
299+
{
300+
$this->compare(
301+
<<<'EOL'
302+
<?php
303+
echo \My\Package\functionName();
304+
EOL
305+
,
306+
<<<'EOL'
307+
<token_default><?php</token_default>
308+
<token_keyword>echo \</token_keyword><token_default>My</token_default><token_keyword>\</token_keyword><token_default>Package</token_default><token_keyword>\</token_keyword><token_default>functionName</token_default><token_keyword>();</token_keyword>
309+
EOL
310+
);
311+
}
312+
313+
public function testNamespaceRelativeFunctionCall()
314+
{
315+
$this->compare(
316+
<<<'EOL'
317+
<?php
318+
echo namespace\functionName();
319+
EOL
320+
,
321+
<<<'EOL'
322+
<token_default><?php</token_default>
323+
<token_keyword>echo namespace\</token_keyword><token_default>functionName</token_default><token_keyword>();</token_keyword>
324+
EOL
325+
);
326+
}
327+
328+
public function testQualifiedFunctionCall()
329+
{
330+
$this->compare(
331+
<<<'EOL'
332+
<?php
333+
echo Package\functionName();
334+
EOL
335+
,
336+
<<<'EOL'
337+
<token_default><?php</token_default>
338+
<token_keyword>echo </token_keyword><token_default>Package</token_default><token_keyword>\</token_keyword><token_default>functionName</token_default><token_keyword>();</token_keyword>
339+
EOL
340+
);
341+
}
282342
}

0 commit comments

Comments
 (0)