From 099fda54c030c7a90f223a5dd0d28a7993114106 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Fri, 11 Jun 2021 01:45:18 +0800 Subject: [PATCH] Convert Heredoc to Nowdoc syntax where possible --- tests/system/API/ResponseTraitTest.php | 10 +++--- tests/system/Format/XMLFormatterTest.php | 12 +++---- tests/system/Helpers/FormHelperTest.php | 44 ++++++++++++------------ tests/system/Helpers/HTMLHelperTest.php | 44 ++++++++++++------------ tests/system/View/ParserFilterTest.php | 2 +- utils/PhpCsFixer/CodeIgniter4.php | 1 + 6 files changed, 57 insertions(+), 56 deletions(-) diff --git a/tests/system/API/ResponseTraitTest.php b/tests/system/API/ResponseTraitTest.php index 79d8235ea8a3..8701922e734c 100644 --- a/tests/system/API/ResponseTraitTest.php +++ b/tests/system/API/ResponseTraitTest.php @@ -102,7 +102,7 @@ public function testNoFormatterJSON() $this->assertEquals('A Custom Reason', $this->response->getReason()); $this->assertEquals(201, $this->response->getStatusCode()); - $expected = <<formatter = null; $controller = $this->makeController(); $payload = ['answer' => 42]; - $expected = <<name = 'Tom'; $payload->id = 1; - $expected = <<assertEquals('CodeIgniter\Format\XMLFormatter', get_class($this->formatter)); $controller->respondCreated(['id' => 3], 'A Custom Reason'); - $expected = << 3 diff --git a/tests/system/Format/XMLFormatterTest.php b/tests/system/Format/XMLFormatterTest.php index fe30d56b7fc7..7cedeb9acdf0 100644 --- a/tests/system/Format/XMLFormatterTest.php +++ b/tests/system/Format/XMLFormatterTest.php @@ -21,7 +21,7 @@ public function testBasicXML() 'foo' => 'bar', ]; - $expected = << bar @@ -36,7 +36,7 @@ public function testFormatXMLWithMultilevelArray() 'foo' => ['bar'], ]; - $expected = << bar @@ -51,7 +51,7 @@ public function testFormatXMLWithMultilevelArrayAndNumericKey() ['foo'], ]; - $expected = << foo @@ -63,7 +63,7 @@ public function testFormatXMLWithMultilevelArrayAndNumericKey() public function testStringFormatting() { $data = ['Something']; - $expected = << Something @@ -78,7 +78,7 @@ public function testValidatingXmlTags() 'BBB096630BD' => 'foo', '096630FR' => 'bar', ]; - $expected = << foobar @@ -171,7 +171,7 @@ public function testDeepNestedArrayToXml() ]; // do not change to tabs!! - $expectedXML = << diff --git a/tests/system/Helpers/FormHelperTest.php b/tests/system/Helpers/FormHelperTest.php index 1990d1bfc2f6..4bf1224b0b7e 100644 --- a/tests/system/Helpers/FormHelperTest.php +++ b/tests/system/Helpers/FormHelperTest.php @@ -38,7 +38,7 @@ public function testFormOpenBasic() EOH; } else { - $expected = << EOH; @@ -62,7 +62,7 @@ public function testFormOpenHasLocale() $request->uri = new URI('http://example.com/'); Services::injectMock('request', $request); - $expected = << EOH; @@ -96,7 +96,7 @@ public function testFormOpenWithoutAction() EOH; } else { - $expected = << EOH; @@ -130,7 +130,7 @@ public function testFormOpenWithoutMethod() EOH; } else { - $expected = << EOH; @@ -165,7 +165,7 @@ public function testFormOpenWithHidden() EOH; } else { - $expected = << @@ -205,7 +205,7 @@ public function testFormOpenMultipart() EOH; } else { - $expected = << EOH; @@ -238,7 +238,7 @@ public function testFormHiddenArrayInput() $data = [ 'foo' => 'bar', ]; - $expected = << @@ -252,7 +252,7 @@ public function testFormHiddenArrayValues() $data = [ 'foo' => 'bar', ]; - $expected = << @@ -327,7 +327,7 @@ public function testFormTextareaWithValueAttribute() 'name' => 'foo', 'value' => 'bar', ]; - $expected = <<bar EOH; @@ -472,7 +472,7 @@ public function testFormDropdownInferred() // ------------------------------------------------------------------------ public function testFormDropdownWithSelectedAttribute() { - $expected = << @@ -491,7 +491,7 @@ public function testFormDropdownWithSelectedAttribute() // ------------------------------------------------------------------------ public function testFormDropdownWithOptionsAttribute() { - $expected = << @@ -509,7 +509,7 @@ public function testFormDropdownWithOptionsAttribute() // ------------------------------------------------------------------------ public function testFormDropdownWithEmptyArrayOptionValue() { - $expected = << @@ -583,7 +583,7 @@ public function testFormFieldset() // ------------------------------------------------------------------------ public function testFormFieldsetWithNoLegent() { - $expected = << EOH; @@ -596,7 +596,7 @@ public function testFormFieldsetWithAttributes() $attributes = [ 'name' => 'bar', ]; - $expected = << Foo @@ -607,7 +607,7 @@ public function testFormFieldsetWithAttributes() // ------------------------------------------------------------------------ public function testFormFieldsetClose() { - $expected = << EOH; $this->assertEquals($expected, form_fieldset_close('')); @@ -630,7 +630,7 @@ public function testFormCheckboxArrayData() 'value' => 'bar', 'checked' => true, ]; - $expected = << EOH; @@ -645,7 +645,7 @@ public function testFormCheckboxArrayDataWithCheckedFalse() 'value' => 'bar', 'checked' => false, ]; - $expected = << EOH; @@ -673,7 +673,7 @@ public function testFormSubmit() // ------------------------------------------------------------------------ public function testFormLabel() { - $expected = <<What is your Name EOH; $this->assertEquals($expected, form_label('What is your Name', 'username')); @@ -685,7 +685,7 @@ public function testFormLabelWithAttributes() $attributes = [ 'id' => 'label1', ]; - $expected = <<bar EOH; $this->assertEquals($expected, form_label('bar', 'foo', $attributes)); @@ -716,7 +716,7 @@ public function testFormButtonWithDataArray() 'name' => 'foo', 'content' => 'bar', ]; - $expected = <<bar EOH; @@ -726,7 +726,7 @@ public function testFormButtonWithDataArray() // ------------------------------------------------------------------------ public function testFormClose() { - $expected = << EOH; $this->assertEquals($expected, form_close('')); @@ -739,7 +739,7 @@ public function testFormDatalist() 'foo1', 'bar1', ]; - $expected = <<