Skip to content

Commit 7be9367

Browse files
magento-engcom-teamnmalevanec
authored andcommitted
Add MagentoStyle as Console Input/output helper object... #11504
- fixed broken Travis tests
1 parent 30be269 commit 7be9367

File tree

1 file changed

+16
-49
lines changed

1 file changed

+16
-49
lines changed

setup/src/Magento/Setup/Test/Unit/Console/Style/MagentoStyleTest.php

Lines changed: 16 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ public function testBlockStyle()
6262
);
6363
// @codingStandardsIgnoreStart
6464
$expected = PHP_EOL . PHP_EOL . PHP_EOL .
65-
'<testBlockStyle>testBlockPrefix[testBlockType] test first message '
66-
. PHP_EOL . '<testBlockStyle>testBlockPrefix '
67-
. PHP_EOL . '<testBlockStyle>testBlockPrefix test second message '
65+
'\<testBlockStyle\>testBlockPrefix\[testBlockType\] test first message\s+'
66+
. PHP_EOL . '\<testBlockStyle\>testBlockPrefix\s+'
67+
. PHP_EOL . '\<testBlockStyle\>testBlockPrefix \s+ test second message\s+'
6868
. PHP_EOL . PHP_EOL;
6969
// @codingStandardsIgnoreEnd
70-
$this->assertEquals($expected, $this->testOutput->output, 'Block does not match output');
70+
$this->assertRegExp('/' . $expected . '/', $this->testOutput->output, 'Block does not match output');
7171
}
7272

7373
/**
@@ -79,7 +79,6 @@ public function testTitleStyle()
7979
{
8080
$this->magentoStyle->title('My Title');
8181
$expected = PHP_EOL . PHP_EOL . PHP_EOL . ' My Title' . PHP_EOL . ' ========' . PHP_EOL . PHP_EOL;
82-
8382
$this->assertEquals($expected, $this->testOutput->output, 'Title does not match output');
8483
}
8584

@@ -92,7 +91,6 @@ public function testSectionStyle()
9291
{
9392
$this->magentoStyle->section('My Section');
9493
$expected = PHP_EOL . PHP_EOL . PHP_EOL . ' My Section' . PHP_EOL . ' ----------' . PHP_EOL . PHP_EOL;
95-
9694
$this->assertEquals($expected, $this->testOutput->output, 'Section does not match output');
9795
}
9896

@@ -105,7 +103,6 @@ public function testListingStyle()
105103
{
106104
$this->magentoStyle->listing(['test first element', 'test second element']);
107105
$expected = PHP_EOL . ' * test first element' . PHP_EOL . ' * test second element' . PHP_EOL . PHP_EOL;
108-
109106
$this->assertEquals($expected, $this->testOutput->output, 'Listing does not match output');
110107
}
111108

@@ -130,13 +127,8 @@ public function testTextStyle()
130127
public function testCommentStyle()
131128
{
132129
$this->magentoStyle->comment('test comment');
133-
// @codingStandardsIgnoreStart
134-
$expected = PHP_EOL . PHP_EOL . PHP_EOL .
135-
' test comment '
136-
. PHP_EOL . PHP_EOL;
137-
// @codingStandardsIgnoreEnd
138-
139-
$this->assertEquals($expected, $this->testOutput->output, 'Comment does not match output');
130+
$expected = PHP_EOL . PHP_EOL . PHP_EOL . '\s+test comment\s+' . PHP_EOL . PHP_EOL;
131+
$this->assertRegExp('/' . $expected . '/', $this->testOutput->output, 'Comment does not match output');
140132
}
141133

142134
/**
@@ -147,13 +139,8 @@ public function testCommentStyle()
147139
public function testSuccessStyle()
148140
{
149141
$this->magentoStyle->success('test success message');
150-
// @codingStandardsIgnoreStart
151-
$expected = PHP_EOL . PHP_EOL . PHP_EOL .
152-
' [SUCCESS] test success message '
153-
. PHP_EOL . PHP_EOL;
154-
// @codingStandardsIgnoreEnd
155-
156-
$this->assertEquals($expected, $this->testOutput->output, 'Success message does not match output');
142+
$expected = PHP_EOL . PHP_EOL . PHP_EOL . ' \[SUCCESS\] test success message\s+' . PHP_EOL . PHP_EOL;
143+
$this->assertRegExp('/' . $expected . '/', $this->testOutput->output, 'Success message does not match output');
157144
}
158145

159146
/**
@@ -164,13 +151,8 @@ public function testSuccessStyle()
164151
public function testErrorStyle()
165152
{
166153
$this->magentoStyle->error('test error message');
167-
// @codingStandardsIgnoreStart
168-
$expected = PHP_EOL . PHP_EOL . PHP_EOL .
169-
' [ERROR] test error message '
170-
. PHP_EOL . PHP_EOL;
171-
// @codingStandardsIgnoreEnd
172-
173-
$this->assertEquals($expected, $this->testOutput->output, 'Error message does not match output');
154+
$expected = PHP_EOL . PHP_EOL . PHP_EOL . '\s+\[ERROR\] test error message\s+' . PHP_EOL . PHP_EOL;
155+
$this->assertRegExp('/' . $expected . '/', $this->testOutput->output, 'Error message does not match output');
174156
}
175157

176158
/**
@@ -181,13 +163,8 @@ public function testErrorStyle()
181163
public function testWarningStyle()
182164
{
183165
$this->magentoStyle->warning('test warning message');
184-
// @codingStandardsIgnoreStart
185-
$expected = PHP_EOL . PHP_EOL . PHP_EOL .
186-
' [WARNING] test warning message '
187-
. PHP_EOL . PHP_EOL;
188-
// @codingStandardsIgnoreEnd
189-
190-
$this->assertEquals($expected, $this->testOutput->output, 'Warning message does not match output');
166+
$expected = PHP_EOL . PHP_EOL . PHP_EOL . '\s+\[WARNING\] test warning message\s+' . PHP_EOL . PHP_EOL;
167+
$this->assertRegExp('/' . $expected . '/', $this->testOutput->output, 'Warning message does not match output');
191168
}
192169

193170
/**
@@ -198,13 +175,8 @@ public function testWarningStyle()
198175
public function testNoteStyle()
199176
{
200177
$this->magentoStyle->note('test note message');
201-
// @codingStandardsIgnoreStart
202-
$expected = PHP_EOL . PHP_EOL . PHP_EOL .
203-
' [NOTE] test note message '
204-
. PHP_EOL . PHP_EOL;
205-
// @codingStandardsIgnoreEnd
206-
207-
$this->assertEquals($expected, $this->testOutput->output, 'Note message does not match output');
178+
$expected = PHP_EOL . PHP_EOL . PHP_EOL . '\s+\[NOTE\] test note message\s+' . PHP_EOL . PHP_EOL;
179+
$this->assertRegExp('/' . $expected . '/', $this->testOutput->output, 'Note message does not match output');
208180
}
209181

210182
/**
@@ -215,13 +187,8 @@ public function testNoteStyle()
215187
public function testCautionStyle()
216188
{
217189
$this->magentoStyle->caution('test caution message');
218-
// @codingStandardsIgnoreStart
219-
$expected = PHP_EOL . PHP_EOL . PHP_EOL .
220-
' ! [CAUTION] test caution message '
221-
. PHP_EOL . PHP_EOL;
222-
// @codingStandardsIgnoreEnd
223-
224-
$this->assertEquals($expected, $this->testOutput->output, 'Caution message does not match output');
190+
$expected = PHP_EOL . PHP_EOL . PHP_EOL . '\s+! \[CAUTION\] test caution message\s+' . PHP_EOL . PHP_EOL;
191+
$this->assertRegExp('/' . $expected . '/', $this->testOutput->output, 'Caution message does not match output');
225192
}
226193

227194
/**

0 commit comments

Comments
 (0)