X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrush%2Fdrush%2Ftests%2FtablesUnitTest.php;fp=vendor%2Fdrush%2Fdrush%2Ftests%2FtablesUnitTest.php;h=0000000000000000000000000000000000000000;hp=b61b2575b313b1d7f78178eac6f9422938a6caea;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/vendor/drush/drush/tests/tablesUnitTest.php b/vendor/drush/drush/tests/tablesUnitTest.php deleted file mode 100644 index b61b2575b..000000000 --- a/vendor/drush/drush/tests/tablesUnitTest.php +++ /dev/null @@ -1,111 +0,0 @@ -original_columns = drush_get_context('DRUSH_COLUMNS'); - - // Some table data we reuse between tests. - $this->numbers = array( - array('1', '12', '123'), - array('1234', '12345', '123456'), - array('1234567', '12345678', '123456789'), - ); - $this->words = array( - array('Drush is a command line shell', 'scripting interface', 'for Drupal'), - array('A veritable', 'Swiss Army knife', 'designed to make life easier for us'), - ); - } - - function tearDown() { - drush_set_context('DRUSH_COLUMNS', $this->original_columns); - } - - /** - * Tests drush_format_table() at various table widths with automatic column - * sizing. - * - * @see drush_format_table(). - */ - public function testFormatAutoWidths() { - // print "\n'" . str_replace("\n", "' . PHP_EOL . '", $output) . "'\n"; - drush_set_context('DRUSH_COLUMNS', 16); - $output = drush_format_table($this->numbers); - $expected = ' 1 12 123 ' . PHP_EOL . ' 123 123 1234 ' . PHP_EOL . ' 4 45 56 ' . PHP_EOL . ' 123 123 1234 ' . PHP_EOL . ' 456 456 5678 ' . PHP_EOL . ' 7 78 9 ' . PHP_EOL; - $this->assertEquals($expected, $output); - - drush_set_context('DRUSH_COLUMNS', 22); - $output = drush_format_table($this->numbers); - $expected = ' 1 12 123 ' . PHP_EOL . ' 1234 12345 123456 ' . PHP_EOL . ' 12345 12345 123456 ' . PHP_EOL . ' 67 678 789 ' . PHP_EOL; - $this->assertEquals($expected, $output); - - drush_set_context('DRUSH_COLUMNS', 24); - $output = drush_format_table($this->numbers); - $expected = ' 1 12 123 ' . PHP_EOL . ' 1234 12345 123456 ' . PHP_EOL . ' 123456 123456 123456 ' . PHP_EOL . ' 7 78 789 ' . PHP_EOL; - $this->assertEquals($expected, $output); - - drush_set_context('DRUSH_COLUMNS', 80); - $output = drush_format_table($this->numbers); - $expected = ' 1 12 123 ' . PHP_EOL . ' 1234 12345 123456 ' . PHP_EOL . ' 1234567 12345678 123456789 ' . PHP_EOL; - $this->assertEquals($expected, $output); - } - - /** - * Tests drush_format_table() at various table widths. - * - * @see drush_format_table(). - */ - public function testFormatWidths() { - // print "\n'" . str_replace("\n", "' . PHP_EOL . '", $output) . "'\n"; - drush_set_context('DRUSH_COLUMNS', 22); - $output = drush_format_table($this->numbers, FALSE, array(2)); - $expected = ' 1 12 123 ' . PHP_EOL . ' 12 12345 123456 ' . PHP_EOL . ' 34 ' . PHP_EOL . ' 12 1234567 1234567 ' . PHP_EOL . ' 34 8 89 ' . PHP_EOL . ' 56 ' . PHP_EOL . ' 7 ' . PHP_EOL; - $this->assertEquals($expected, $output); - - $output = drush_format_table($this->numbers, FALSE, array(10)); - $expected = ' 1 12 123 ' . PHP_EOL . ' 1234 123 123 ' . PHP_EOL . ' 45 456 ' . PHP_EOL . ' 1234567 123 123 ' . PHP_EOL . ' 456 456 ' . PHP_EOL . ' 78 789 ' . PHP_EOL; - $this->assertEquals($expected, $output); - - $output = drush_format_table($this->numbers, FALSE, array(2, 2)); - $expected = ' 1 12 123 ' . PHP_EOL . ' 12 12 123456 ' . PHP_EOL . ' 34 34 ' . PHP_EOL . ' 5 ' . PHP_EOL . ' 12 12 123456789 ' . PHP_EOL . ' 34 34 ' . PHP_EOL . ' 56 56 ' . PHP_EOL . ' 7 78 ' . PHP_EOL; - $this->assertEquals($expected, $output); - - $output = drush_format_table($this->numbers, FALSE, array(4, 4, 4)); - $expected = ' 1 12 123 ' . PHP_EOL . ' 1234 1234 1234 ' . PHP_EOL . ' 5 56 ' . PHP_EOL . ' 1234 1234 1234 ' . PHP_EOL . ' 567 5678 5678 ' . PHP_EOL . ' 9 ' . PHP_EOL; - $this->assertEquals($expected, $output); - } - - /** - * Tests drush_format_table() with a header. - * - * @see drush_format_table(). - */ - public function testFormatTableHeader() { - drush_set_context('DRUSH_COLUMNS', 16); - $rows = $this->numbers; - array_unshift($rows, array('A', 'B', 'C')); - $output = drush_format_table($rows, TRUE); - $expected = ' A B C ' . PHP_EOL . ' 1 12 123 ' . PHP_EOL . ' 123 123 1234 ' . PHP_EOL . ' 4 45 56 ' . PHP_EOL . ' 123 123 1234 ' . PHP_EOL . ' 456 456 5678 ' . PHP_EOL . ' 7 78 9 ' . PHP_EOL; - $this->assertEquals($expected, $output); - } - - /** - * Tests drush_format_table() with word wrapping. - * - * @see drush_format_table(). - */ - public function testFormatTableWordWrap() { - drush_set_context('DRUSH_COLUMNS', 60); - $output = drush_format_table($this->words); - $expected = ' Drush is a command scripting for Drupal ' . PHP_EOL . ' line shell interface ' . PHP_EOL . ' A veritable Swiss Army knife designed to make ' . PHP_EOL . ' life easier for us ' . PHP_EOL; - $this->assertEquals($expected, $output); - } -}