19declare(strict_types=1);
23use PHPUnit\Framework\TestCase;
24use PHPUnit\Framework\Attributes\Test;
25use PHPUnit\Framework\Attributes\Small;
34 public function processMountInstructions(
string $a_raw_mount_instructions): array
44 $instructions =
'hello world';
47 $parsed_instructions = $doc_processor->parseInstructionsToAssocArray($instructions);
49 $this->assertEquals($instructions, $parsed_instructions[0]);
55 $instructions =
'This is a start [tag] with no end tag';
58 $parsed_instructions = $doc_processor->parseInstructionsToAssocArray($instructions);
60 $this->assertEquals($instructions, $parsed_instructions[0]);
66 $instructions =
'There is no start tag but an end [/tag] in the string';
69 $parsed_instructions = $doc_processor->parseInstructionsToAssocArray($instructions);
71 $this->assertEquals($instructions, $parsed_instructions[0]);
77 $instruction_text =
'This are the mount Instructions';
79 $start_tag =
"[$tag_title]";
80 $end_tag =
"[/$tag_title]";
81 $instructions = $start_tag . $instruction_text . $end_tag;
84 $parsed_instructions = $doc_processor->parseInstructionsToAssocArray($instructions);
86 $this->assertEquals($instruction_text, $parsed_instructions[$tag_title]);
92 $instruction_text =
'This are the mount Instructions';
93 $tag_title =
'tag with spaces';
94 $start_tag =
"[$tag_title]";
95 $end_tag =
"[/$tag_title]";
96 $instructions = $start_tag . $instruction_text . $end_tag;
99 $parsed_instructions = $doc_processor->parseInstructionsToAssocArray($instructions);
101 $this->assertEquals($instruction_text, $parsed_instructions[$tag_title]);
107 $instruction_text =
'This are the mount Instructions';
108 $tag_title =
'tag_w!th$pecial"chars?';
109 $start_tag =
"[$tag_title]";
110 $end_tag =
"[/$tag_title]";
111 $instructions = $start_tag . $instruction_text . $end_tag;
114 $parsed_instructions = $doc_processor->parseInstructionsToAssocArray($instructions);
116 $this->assertEquals($instruction_text, $parsed_instructions[$tag_title]);
122 $instruction_text =
'This are the mount Instructions';
124 $start_tag =
"[$tag_title]";
125 $end_tag =
"[/$tag_title]";
126 $instructions =
'This will be cut off' . $start_tag . $instruction_text . $end_tag .
'and this of will be cut off as well';
129 $parsed_instructions = $doc_processor->parseInstructionsToAssocArray($instructions);
131 $this->assertEquals($instruction_text, $parsed_instructions[$tag_title]);
137 $instruction_text =
'This are the mount Instructions';
139 $start_tag =
"[$tag_title]";
140 $end_tag =
"[/$tag_title]";
141 $instructions =
'Here is a [placeholder] hidden before the start tag' . $start_tag . $instruction_text . $end_tag;
142 $doc_processor = $this->createDocumentProcessorBaseObject();
144 $parsed_instructions = $doc_processor->parseInstructionsToAssocArray($instructions);
146 $this->assertEquals($instruction_text, $parsed_instructions[$tag_title]);
152 $instruction_text1 =
'This are the first instructions';
153 $instruction_text2 =
'This are the second instructions\'';
154 $tag_title1 =
'tag1';
155 $start_tag1 =
"[$tag_title1]";
156 $end_tag1 =
"[/$tag_title1]";
157 $tag_title2 =
'tag2';
158 $start_tag2 =
"[$tag_title2]";
159 $end_tag2 =
"[/$tag_title2]";
160 $instructions = $start_tag1 . $instruction_text1 . $end_tag1 . $start_tag2 . $instruction_text2 . $end_tag2;
161 $doc_processor = $this->createDocumentProcessorBaseObject();
163 $parsed_instructions = $doc_processor->parseInstructionsToAssocArray($instructions);
165 $this->assertEquals($instruction_text1, $parsed_instructions[$tag_title1]);
166 $this->assertEquals($instruction_text2, $parsed_instructions[$tag_title2]);
parseInstructionsToAssocArray_placeholderBeforeStartTag_returnArrayOnlyWithStringBetweenTags()
parseInstructionsToAssocArray_openTagAtStartCloseTagAtEnd_returnArrayOnlyWithInputString()
parseInstructionsToAssocArray_withTwoOpenAndCloseTags_returnArrayWithBothInstructions()
parseInstructionsToAssocArray_noOpenOnlyCloseTag_returnArrayOnlyWithInputString()
parseInstructionsToAssocArray_tagsContainSpaces_returnArrayOnlyWithInputString()
parseInstructionsToAssocArray_tagsContainSpecialChars_returnArrayOnlyWithInputString()
parseInstructionsToAssocArray_noOpenNoCloseTags_returnArrayOnlyWithInputString()
parseInstructionsToAssocArray_onlyOpenNoCloseTag_returnArrayOnlyWithInputString()
parseInstructionsToAssocArray_beforeStartTagAndAfterEndTagIsText_returnArrayOnlyWithStringBetweenTags()
createDocumentProcessorBaseObject()