|
|
@@ -24,6 +24,20 @@ use Cake\TestSuite\TestCase;
|
|
|
*/
|
|
|
class TableHelperTest extends TestCase
|
|
|
{
|
|
|
+ /**
|
|
|
+ * @var ConsoleOutput
|
|
|
+ */
|
|
|
+ public $stub;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @var ConsoleIo
|
|
|
+ */
|
|
|
+ public $io;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @var TableHelper
|
|
|
+ */
|
|
|
+ public $helper;
|
|
|
|
|
|
/**
|
|
|
* setUp method
|
|
|
@@ -64,6 +78,28 @@ class TableHelperTest extends TestCase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 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
|
|
|
*
|
|
|
* @return void
|