Skip to content

Commit 1a28e45

Browse files
Update doc blocks for static tests
1 parent c4fb81f commit 1a28e45

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

lib/internal/Magento/Framework/App/DeploymentConfig/Writer/PhpFormatter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ class PhpFormatter implements FormatterInterface
2121
public function format($data, array $comments = [])
2222
{
2323
if (!empty($comments) && is_array($data)) {
24-
return "<?php\nreturn array (\n" . $this->formatData($data, $comments, ' ') . "\n);\n";
24+
return "<?php\nreturn array (\n" . $this->formatData($data, $comments) . "\n);\n";
2525
}
2626
return "<?php\nreturn " . var_export($data, true) . ";\n";
2727
}
2828

2929
/**
3030
* Format supplied data
3131
*
32-
* @param $data
33-
* @param $comments
32+
* @param string[] $data
33+
* @param string[] $comments
3434
* @param string $prefix
3535
* @return string
3636
*/
37-
protected function formatData($data, $comments, $prefix = '')
37+
private function formatData($data, $comments = [], $prefix = ' ')
3838
{
3939
$elements = [];
4040

lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfig/Writer/PhpFormatterTest.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
namespace Magento\Framework\App\Test\Unit\DeploymentConfig\Writer;
87

98
use Magento\Framework\App\DeploymentConfig\Writer\PhpFormatter;
@@ -12,8 +11,8 @@ class PhpFormatterTest extends \PHPUnit_Framework_TestCase
1211
{
1312
/**
1413
* @dataProvider formatWithCommentDataProvider
15-
* @param string|array $data
16-
* @param array $comments
14+
* @param string[] $data
15+
* @param string[] $comments
1716
* @param string $expectedResult
1817
*/
1918
public function testFormat($data, $comments, $expectedResult)
@@ -22,6 +21,9 @@ public function testFormat($data, $comments, $expectedResult)
2221
$this->assertEquals($expectedResult, $formatter->format($data, $comments));
2322
}
2423

24+
/**
25+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
26+
*/
2527
public function formatWithCommentDataProvider()
2628
{
2729
$array = [
@@ -45,9 +47,9 @@ public function formatWithCommentDataProvider()
4547
];
4648
$comments1 = ['ns2' => 'comment for namespace 2'];
4749
$comments2 = [
48-
'ns1' => 'comment for namespace 1',
49-
'ns2' => "comment for namespace 2.\nNext comment for namespace 2",
50-
'ns3' => 'comment for namespace 3',
50+
'ns1' => 'comment for\' namespace 1',
51+
'ns2' => "comment for namespace 2.\nNext comment for' namespace 2",
52+
'ns3' => 'comment for" namespace 3',
5153
'ns4' => 'comment for namespace 4',
5254
'ns5' => 'comment for unexisted namespace 5',
5355
];
@@ -88,7 +90,7 @@ public function formatWithCommentDataProvider()
8890
return array (
8991
/**
9092
* For the section: ns1
91-
* comment for namespace 1
93+
* comment for' namespace 1
9294
*/
9395
'ns1' =>
9496
array (
@@ -106,7 +108,7 @@ public function formatWithCommentDataProvider()
106108
/**
107109
* For the section: ns2
108110
* comment for namespace 2.
109-
* Next comment for namespace 2
111+
* Next comment for' namespace 2
110112
*/
111113
'ns2' =>
112114
array (
@@ -117,7 +119,7 @@ public function formatWithCommentDataProvider()
117119
),
118120
/**
119121
* For the section: ns3
120-
* comment for namespace 3
122+
* comment for" namespace 3
121123
*/
122124
'ns3' => 'just text',
123125
/**

0 commit comments

Comments
 (0)