forked from codeigniter4/CodeIgniter4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request codeigniter4#4818 from paulbalandan/heredocs
Heredocs-related rules
- Loading branch information
Showing
12 changed files
with
483 additions
and
481 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,11 +21,11 @@ public function testBasicXML() | |
'foo' => 'bar', | ||
]; | ||
|
||
$expected = <<<EOH | ||
<?xml version="1.0"?> | ||
<response><foo>bar</foo></response> | ||
$expected = <<<'EOH' | ||
<?xml version="1.0"?> | ||
<response><foo>bar</foo></response> | ||
|
||
EOH; | ||
EOH; | ||
|
||
$this->assertEquals($expected, $this->xmlFormatter->format($data)); | ||
} | ||
|
@@ -36,11 +36,11 @@ public function testFormatXMLWithMultilevelArray() | |
'foo' => ['bar'], | ||
]; | ||
|
||
$expected = <<<EOH | ||
<?xml version="1.0"?> | ||
<response><foo><item0>bar</item0></foo></response> | ||
$expected = <<<'EOH' | ||
<?xml version="1.0"?> | ||
<response><foo><item0>bar</item0></foo></response> | ||
|
||
EOH; | ||
EOH; | ||
|
||
$this->assertEquals($expected, $this->xmlFormatter->format($data)); | ||
} | ||
|
@@ -51,23 +51,23 @@ public function testFormatXMLWithMultilevelArrayAndNumericKey() | |
['foo'], | ||
]; | ||
|
||
$expected = <<<EOH | ||
<?xml version="1.0"?> | ||
<response><item0><item0>foo</item0></item0></response> | ||
$expected = <<<'EOH' | ||
<?xml version="1.0"?> | ||
<response><item0><item0>foo</item0></item0></response> | ||
|
||
EOH; | ||
EOH; | ||
|
||
$this->assertEquals($expected, $this->xmlFormatter->format($data)); | ||
} | ||
|
||
public function testStringFormatting() | ||
{ | ||
$data = ['Something']; | ||
$expected = <<<EOH | ||
<?xml version="1.0"?> | ||
<response><item0>Something</item0></response> | ||
$expected = <<<'EOH' | ||
<?xml version="1.0"?> | ||
<response><item0>Something</item0></response> | ||
|
||
EOH; | ||
EOH; | ||
|
||
$this->assertEquals($expected, $this->xmlFormatter->format($data)); | ||
} | ||
|
@@ -78,11 +78,11 @@ public function testValidatingXmlTags() | |
'BBB096630BD' => 'foo', | ||
'096630FR' => 'bar', | ||
]; | ||
$expected = <<<EOH | ||
<?xml version="1.0"?> | ||
<response><BBB096630BD>foo</BBB096630BD><item096630FR>bar</item096630FR></response> | ||
$expected = <<<'EOH' | ||
<?xml version="1.0"?> | ||
<response><BBB096630BD>foo</BBB096630BD><item096630FR>bar</item096630FR></response> | ||
|
||
EOH; | ||
EOH; | ||
|
||
$this->assertEquals($expected, $this->xmlFormatter->format($data)); | ||
} | ||
|
@@ -96,10 +96,10 @@ public function testValidatingXmlTags() | |
public function testValidatingInvalidTags(string $expected, array $input) | ||
{ | ||
$expectedXML = <<<EOH | ||
<?xml version="1.0"?> | ||
<response><{$expected}>bar</{$expected}></response> | ||
<?xml version="1.0"?> | ||
<response><{$expected}>bar</{$expected}></response> | ||
EOH; | ||
EOH; | ||
|
||
$this->assertEquals($expectedXML, $this->xmlFormatter->format($input)); | ||
} | ||
|
@@ -171,43 +171,43 @@ public function testDeepNestedArrayToXml() | |
]; | ||
|
||
// do not change to tabs!! | ||
$expectedXML = <<<EOF | ||
<?xml version="1.0"?> | ||
<response> | ||
<data> | ||
<master> | ||
<name>Foo</name> | ||
<email>[email protected]</email> | ||
<dependents/> | ||
</master> | ||
<vote> | ||
<list/> | ||
</vote> | ||
<user> | ||
<account> | ||
<demo> | ||
<info> | ||
<is_banned>true</is_banned> | ||
<last_login>2020-08-31</last_login> | ||
<last_login_ip>127.0.0.1</last_login_ip> | ||
</info> | ||
</demo> | ||
</account> | ||
</user> | ||
<itemxml> | ||
<itemxml_version>1.0</itemxml_version> | ||
<itemxml_encoding>utf-8</itemxml_encoding> | ||
</itemxml> | ||
<item0> | ||
<misc>miscellaneous</misc> | ||
</item0> | ||
<item1> | ||
<misc_data>miscellaneous data</misc_data> | ||
</item1> | ||
</data> | ||
</response> | ||
EOF; | ||
$expectedXML = <<<'EOF' | ||
<?xml version="1.0"?> | ||
<response> | ||
<data> | ||
<master> | ||
<name>Foo</name> | ||
<email>[email protected]</email> | ||
<dependents/> | ||
</master> | ||
<vote> | ||
<list/> | ||
</vote> | ||
<user> | ||
<account> | ||
<demo> | ||
<info> | ||
<is_banned>true</is_banned> | ||
<last_login>2020-08-31</last_login> | ||
<last_login_ip>127.0.0.1</last_login_ip> | ||
</info> | ||
</demo> | ||
</account> | ||
</user> | ||
<itemxml> | ||
<itemxml_version>1.0</itemxml_version> | ||
<itemxml_encoding>utf-8</itemxml_encoding> | ||
</itemxml> | ||
<item0> | ||
<misc>miscellaneous</misc> | ||
</item0> | ||
<item1> | ||
<misc_data>miscellaneous data</misc_data> | ||
</item1> | ||
</data> | ||
</response> | ||
|
||
EOF; | ||
|
||
$dom = new DOMDocument('1.0'); | ||
$dom->preserveWhiteSpace = false; | ||
|
Oops, something went wrong.