Skip to content

Tests: improve existing tests #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jan 28, 2022
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions tests/TokenizeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,81 @@ public function dataTextStrings()
'expected' => <<<'EOL'
<token_default><?php</token_default>
<token_keyword>echo </token_keyword><token_string>"Ahoj světe"</token_string><token_keyword>;</token_keyword>
EOL
),
'Double quoted text string with interpolation [1]' => array(
'original' => <<<'EOL'
<?php
echo "Ahoj $text and more text";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mixing czech and english data samples

EOL
,
'expected' => <<<'EOL'
<token_default><?php</token_default>
<token_keyword>echo </token_keyword><token_string>"Ahoj </token_string><token_default>$text</token_default><token_string> and more text"</token_string><token_keyword>;</token_keyword>
EOL
),
'Double quoted text string with interpolation [2]' => array(
'original' => <<<'EOL'
<?php
echo "$text and more text";
EOL
,
'expected' => <<<'EOL'
<token_default><?php</token_default>
<token_keyword>echo </token_keyword><token_string>"</token_string><token_default>$text</token_default><token_string> and more text"</token_string><token_keyword>;</token_keyword>
EOL
),
'Double quoted text string with interpolation [3]' => array(
'original' => <<<'EOL'
<?php
echo "Ahoj {$obj->prop} and more text";
EOL
,
'expected' => <<<'EOL'
<token_default><?php</token_default>
<token_keyword>echo </token_keyword><token_string>"Ahoj </token_string><token_keyword>{</token_keyword><token_default>$obj</token_default><token_keyword>-></token_keyword><token_default>prop</token_default><token_keyword>}</token_keyword><token_string> and more text"</token_string><token_keyword>;</token_keyword>
EOL
),
'Nowdoc' => array(
'original' => '<?php
echo <<<\'TXT\'
Text
TXT;
',
'expected' => <<<'EOL'
<token_default><?php</token_default>
<token_keyword>echo <<<'TXT'</token_keyword>
<token_string>Text</token_string>
<token_keyword>TXT;</token_keyword>

EOL
),
'Heredoc' => array(
'original' => '<?php
echo <<<TXT
Text
TXT;
',
'expected' => <<<'EOL'
<token_default><?php</token_default>
<token_keyword>echo <<<TXT</token_keyword>
<token_string>Text</token_string>
<token_keyword>TXT;</token_keyword>

EOL
),
'Heredoc with interpolation' => array(
'original' => '<?php
echo <<<TXT
Text $text
TXT;
',
'expected' => <<<'EOL'
<token_default><?php</token_default>
<token_keyword>echo <<<TXT</token_keyword>
<token_string>Text </token_string><token_default>$text</token_default>
<token_keyword>TXT;</token_keyword>

EOL
),
);
Expand Down