Skip to content

Commit

Permalink
add a test for spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkingmedia committed Jan 6, 2017
1 parent bc2e828 commit a15f006
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/TestCase/Shell/Helper/TableHelperTest.php
Expand Up @@ -24,6 +24,20 @@
*/
class TableHelperTest extends TestCase
{
/**
* @var ConsoleOutput
*/
public $stub;

/**
* @var ConsoleIo
*/
public $io;

/**
* @var TableHelper
*/
public $helper;

/**
* setUp method
Expand Down Expand Up @@ -63,6 +77,28 @@ public function testDefaultOutput()
$this->assertEquals($expected, $this->stub->messages());
}

/**
* Test that output works when data contains just empty strings.
*/
public function testEmptyStrings()
{
$data = [
['Header 1', 'Header', 'Empty'],
['short', 'Longish thing', ''],
['Longer thing', 'short', ''],
];
$this->helper->output($data);
$expected = [
'+--------------+---------------+-------+',
'| <info>Header 1</info> | <info>Header</info> | <info>Empty</info> |',
'+--------------+---------------+-------+',
'| short | Longish thing | |',
'| Longer thing | short | |',
'+--------------+---------------+-------+',
];
$this->assertEquals($expected, $this->stub->messages());
}

/**
* Test output with multi-byte characters
*
Expand Down

0 comments on commit a15f006

Please sign in to comment.