Resolve #3443366 "Convert thunder processors"
Closes #3443366
Merge request reports
Activity
119 * reordered, explicit closing tag == self-closing tag, ...). As of PHP8.1, 120 * some PHPunit configurations do not report the actual XML comparison 121 * error. Pass TRUE: 122 * - if the format of the XML (e.g. the way a tag is closed) matters; 123 * - if the markup isn't valid XML; 124 * - (temporarily?) if it's not clear why a test is failing. 125 */ 126 protected function assertXmlEquals($expected_markup, $tested_markup, $compare_as_text = FALSE) { 127 if ($compare_as_text) { 128 Assert::assertEquals($this->trim($expected_markup), $this->trim($tested_markup)); 129 } 130 else { 131 Assert::assertXmlStringEqualsXmlString($this->trim($expected_markup), $this->trim($tested_markup)); 132 } 133 } 134 205 225 $custom_element = $this->getCustomElementGenerator() 206 226 ->generate($paragraph, 'full'); 207 227 $markup = $this->renderCustomElement($custom_element); 208 $expected_markup = <<<EOF 209 <pg-link href="http://example.com" title="Example site" type="link" view-mode="full"/> 210 EOF; 211 Assert::assertXmlStringEqualsXmlString($this->trim($expected_markup), $this->trim($markup)); 228 if (!$expected_markup) { 229 $expected_markup = <<<EOF 230 <pg-link href="http://example.com" title="Example site" type="link" view-mode="full"/> 231 EOF; 232 } 233 $this->assertXmlEquals($expected_markup, $markup); No functional changes here; just enabling the 'extending' test class to pass different expected markup.
Why: So much code is shared between this class and the Vue3 test, that it made sense to just make the Vue3 test extend this one (while auditing all the paragraph tests which I end up doing in this issue anyway). It makes it easier to see the actual differences in tests.
By the way, I noticed that the literal output from the above renderCustomElement() is
<pg-link ...></pg-link>
, not<pg-link .../>
. (Also in the twitter and video test.) Which is exactly the same as in the Vue3 test, but- this test is fine with that because it does 'XML', not literal strings
- the Vue3 test checks for
<pg-link ...></pg-link>
and does literal string comparison.
This likely means I could have just made both tests check against equal $expected_markup, but I chose to keep test behavior exactly the same. The only thing I'm doing is making one class extend the other. If people want to tweak what's actually tested/how, that's for a future issue to decide.