stub = new StubConsoleOutput(); $this->io = new ConsoleIo($this->stub); $this->helper = new BannerHelper($this->io); } /** * Test that the callback is invoked until 100 is reached. */ public function testOutputInvalidPadding(): void { $this->expectException(InvalidArgumentException::class); $this->helper->withPadding(-1); } /** * Test output with all options */ public function testOutputSuccess(): void { $this->helper ->withPadding(5) ->withStyle('info.bg') ->output(['All done']); $expected = [ '', ' ', ' All done ', ' ', '', ]; $this->assertEquals($expected, $this->stub->messages()); } /** * Test that width is respected */ public function testOutputPadding(): void { $this->helper ->withPadding(1) ->withStyle('info.bg') ->output(['All done']); $expected = [ '', ' ', ' All done ', ' ', '', ]; $this->assertEquals($expected, $this->stub->messages()); } /** * Test that width is respected */ public function testOutputLongestLine(): void { $this->helper ->withPadding(1) ->withStyle('info.bg') ->output(['All done', 'This line is longer', 'tiny']); $expected = [ '', ' ', ' All done ', ' This line is longer ', ' tiny ', ' ', '', ]; $this->assertEquals($expected, $this->stub->messages()); } }