File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -182,13 +182,9 @@ public function addAsciiArt($art, $position = AsciiArtItem::POSITION_CENTER)
182
182
183
183
$ asciiArtItem = new AsciiArtItem ($ art , $ position );
184
184
185
- Assertion::lessOrEqualThan (
186
- $ asciiArtItem ->getArtLength (),
187
- $ this ->getMenuStyle ()->getContentWidth (),
188
- 'The provided Ascii art does not fit in the menu '
189
- );
190
-
191
- $ this ->addMenuItem ($ asciiArtItem );
185
+ if ($ asciiArtItem ->getArtLength () <= $ this ->getMenuStyle ()->getContentWidth ()) {
186
+ $ this ->addMenuItem ($ asciiArtItem );
187
+ }
192
188
193
189
return $ this ;
194
190
}
Original file line number Diff line number Diff line change @@ -247,16 +247,16 @@ public function testAsciiArtWithSpecificPosition()
247
247
$ this ->checkItems ($ menu , $ expected );
248
248
}
249
249
250
- /**
251
- * @expectedException Assert\InvalidArgumentException
252
- * @expectedExceptionMessage The provided Ascii art does not fit in the menu
253
- */
254
- public function testAddAsciiArtDetectsArtThatDoesNotFit ()
250
+ public function testAddAsciiArtDetectsArtThatDoesNotFitAndSkipsIt ()
255
251
{
256
252
$ builder = new CliMenuBuilder ;
257
253
$ builder ->setWidth (1 );
258
254
$ builder ->addAsciiArt ("// \n// " , AsciiArtItem::POSITION_LEFT );
259
255
$ menu = $ builder ->build ();
256
+
257
+ foreach ($ menu ->getItems () as $ menuItem ) {
258
+ $ this ->assertNotInstanceOf (AsciiArtItem::class, $ menuItem );
259
+ }
260
260
}
261
261
262
262
public function testEndThrowsExceptionIfNoParentBuilder ()
You can’t perform that action at this time.
0 commit comments