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)
182182
183183 $ asciiArtItem = new AsciiArtItem ($ art , $ position );
184184
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+ }
192188
193189 return $ this ;
194190 }
Original file line number Diff line number Diff line change @@ -247,16 +247,16 @@ public function testAsciiArtWithSpecificPosition()
247247 $ this ->checkItems ($ menu , $ expected );
248248 }
249249
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 ()
255251 {
256252 $ builder = new CliMenuBuilder ;
257253 $ builder ->setWidth (1 );
258254 $ builder ->addAsciiArt ("// \n// " , AsciiArtItem::POSITION_LEFT );
259255 $ menu = $ builder ->build ();
256+
257+ foreach ($ menu ->getItems () as $ menuItem ) {
258+ $ this ->assertNotInstanceOf (AsciiArtItem::class, $ menuItem );
259+ }
260260 }
261261
262262 public function testEndThrowsExceptionIfNoParentBuilder ()
You can’t perform that action at this time.
0 commit comments