diff --git a/src/Label/vendor/malios/php-to-ascii-table/tests/BuilderTest.php b/src/Label/vendor/malios/php-to-ascii-table/tests/BuilderTest.php deleted file mode 100644 index b5dbfce3..00000000 --- a/src/Label/vendor/malios/php-to-ascii-table/tests/BuilderTest.php +++ /dev/null @@ -1,328 +0,0 @@ -addRow(['age' => 21, 'name' => 'John']); - - $person = new class implements \JsonSerializable { - - function jsonSerialize() - { - return [ - 'age' => 32, - 'name' => 'Bill' - ]; - } - }; - - $builder->addRow($person); - - $table = $builder->getTable(); - $rows = $table->getRows(); - - $this->assertEquals(21, $rows[0]->getCell('age')->getValue()); - $this->assertEquals('John', $rows[0]->getCell('name')->getValue()); - - $this->assertEquals(32, $rows[1]->getCell('age')->getValue()); - $this->assertEquals('Bill', $rows[1]->getCell('name')->getValue()); - } - - public function testAddInvalidRow() - { - $this->expectException(BuilderException::class); - - $person = new class { - public $name; - }; - - $person->name = 'Rick'; - - $builder = new Builder(); - $builder->addRow($person); - } - - public function testRenderEmptyTable() - { - $this->expectException(BuilderException::class); - - $builder = new Builder(); - $builder->renderTable(); - } - - public function testRender() - { - $builder = new Builder(); - $builder->addRows([ - [ - 'name' => 'John', - 'age' => 23, - 'sex' => 'male' - ], - [ - 'name' => 'Catherine', - 'age' => 22, - 'sex' => 'female' - ], - [ - 'name' => 'Johnathan', - 'age' => 44, - 'sex' => 'male' - ] - ]); - - $result = $builder->renderTable(); - - $expected = <<assertEquals($expected, $result); - } - - public function testRenderWithSomeEmptyCells() - { - $builder = new Builder(); - $builder->addRows([ - [ - 'name' => 'John', - 'age' => 23, - 'sex' => 'male' - ], - [ - 'name' => 'Catherine', - 'sex' => 'female' - ], - [ - 'name' => 'Johnathan', - 'age' => 44, - ] - ]); - - $result = $builder->renderTable(); - - $expected = <<assertEquals($expected, $result); - } - - public function testShowsOnlyVisibleColumns() - { - $builder = new Builder(); - $builder->addRows([ - [ - 'name' => 'John', - 'age' => 23, - 'sex' => 'male' - ], - [ - 'name' => 'Catherine', - 'age' => 22, - 'sex' => 'female' - ], - [ - 'name' => 'Johnathan', - 'age' => 44, - 'sex' => 'male' - ] - ]); - - $builder->showColumns(['name', 'age']); - $result = $builder->renderTable(); - - $expected = <<assertEquals($expected, $result); - } - - public function testRenderTableWithFloatingPoint() - { - $builder = new Builder(); - $builder->addRows([ - [ - 'Order No' => 'A0001', - 'Product Name' => 'Intel CPU', - 'Price' => 700.00, - 'Quantity' => 1 - ], - [ - 'Order No' => 'A0002', - 'Product Name' => 'Hard disk 10TB', - 'Price' => 500.00, - 'Quantity' => 2 - ], - [ - 'Order No' => 'A0003', - 'Product Name' => 'Dell Laptop', - 'Price' => 11600.00, - 'Quantity' => 8 - ], - [ - 'Order No' => 'A0004', - 'Product Name' => 'Intel CPU', - 'Price' => 5200.00, - 'Quantity' => 3 - ] - ]); - - $builder->addRow([ - 'Order No' => 'A0005', - 'Product Name' => 'A4Tech Mouse', - 'Price' => 100.00, - 'Quantity' => 10 - ]); - - $result = $builder->renderTable(); - - $expected = <<assertEquals($expected, $result); - } - - public function testRenderTableWithCyrillicWord() - { - $builder = new Builder(); - $builder->addRows([ - [ - 'name' => 'John', - 'age' => 21 - ], - [ - 'name' => 'Иван', - 'age' => 23 - ] - ]); - - $result = $builder->renderTable(); - - $expected = <<assertEquals($expected, $result); - } - - public function testRenderWithCyrillicColumnNames() - { - $builder = new Builder(); - $builder->addRows([ - [ - 'имя' => 'Джон', - 'год' => 21 - ], - [ - 'имя' => 'Иван', - 'год' => 23 - ] - ]); - - $result = $builder->renderTable(); - - $expected = <<assertEquals($expected, $result); - } - public function testRenderWithChineseColumnNames() - { - $builder = new Builder(); - $builder->addRows([ - [ - 'language' => 'English', - 'greeting' => 'Hello, World' - ], - [ - 'language' => 'mixed', - 'greeting' => 'Hello, 世界' - ] - ]); - - $result = $builder->renderTable(); - - $expected = <<assertEquals($expected, $result); - } - - public function testRenderWithTitle() - { - $builder = new Builder(); - $builder->addRows([ - [ - 'language' => 'English', - 'greeting' => 'Hello, World' - ], - [ - 'language' => 'mixed', - 'greeting' => 'Hello, 世界' - ] - ]); - $builder->setTitle('Greetings'); - - $result = $builder->renderTable(); - - $expected = <<assertEquals($expected, $result); - } -} diff --git a/src/Label/vendor/malios/php-to-ascii-table/tests/CellTest.php b/src/Label/vendor/malios/php-to-ascii-table/tests/CellTest.php deleted file mode 100644 index 66b823db..00000000 --- a/src/Label/vendor/malios/php-to-ascii-table/tests/CellTest.php +++ /dev/null @@ -1,52 +0,0 @@ -assertEquals('21', $cell->getValue()); - $this->assertEquals(2, $cell->getWidth()); - - $cell->setValue(123); - $this->assertEquals('123', $cell->getValue()); - $this->assertEquals(3, $cell->getWidth()); - - $ageObject = new class (2008) { - private $year; - - function __construct(int $year) - { - $this->year = $year; - } - - function __toString() - { - return strval(2017 - $this->year); - } - }; - - $cell->setValue($ageObject); - $this->assertEquals(1, $cell->getWidth()); - - $floatCell = new Cell('price', 100.00); - $this->assertEquals("100.00", $floatCell->getValue()); - - $floatCell->setValue(99.99); - $this->assertEquals("99.99", $floatCell->getValue()); - } - - public function testCellWidthWithMultiByteCharacters() - { - $cell = new Cell('name', 'Иван'); - $this->assertEquals(4, $cell->getWidth()); - - $cell = new Cell('message', 'Hello, 世界'); // 世界 - this string is with width 4 - $this->assertEquals(11, $cell->getWidth()); - } -} diff --git a/src/Label/vendor/malios/php-to-ascii-table/tests/RowTest.php b/src/Label/vendor/malios/php-to-ascii-table/tests/RowTest.php deleted file mode 100644 index f1bdd6ff..00000000 --- a/src/Label/vendor/malios/php-to-ascii-table/tests/RowTest.php +++ /dev/null @@ -1,24 +0,0 @@ -addCell(new Cell('name', 'John')); - $row->addCell(new Cell('name', 'Rick')); - - $this->assertCount(1, $row->getCells()); - - $cell = $row->getCells()->get('name'); - - $this->assertEquals($cell->getColumnName(), 'name'); - $this->assertEquals($cell->getValue(), 'Rick'); - } -} diff --git a/src/Label/vendor/malios/php-to-ascii-table/tests/TableTest.php b/src/Label/vendor/malios/php-to-ascii-table/tests/TableTest.php deleted file mode 100644 index 86661e04..00000000 --- a/src/Label/vendor/malios/php-to-ascii-table/tests/TableTest.php +++ /dev/null @@ -1,87 +0,0 @@ -setVisibleColumns(['name', 'age', 'location', 'sex']); - - $set = new Set(); - $set->add('name'); - $set->add('age'); - $set->add('location'); - $set->add('sex'); - - self::assertEquals(0, $set->diff($table->getVisibleColumns())->count()); - self::assertEquals(0, $table->getVisibleColumns()->diff($set)->count()); - } - - public function testGetVisibleColumnsWhenNotSet() - { - $row = new Row(); - $row->addCell(new Cell('name', 'Catherine')); - $row->addCell(new Cell('sex', 'female')); - $row->addCell(new Cell('height', 168)); - - $table = new Table(); - $table->addRow($row); - - $this->assertSame(['name', 'sex', 'height'], $table->getVisibleColumns()->toArray()); - } - - public function testGetAllColumns() - { - $row = new Row(); - $row->addCell(new Cell('name', 'Bill')); - $row->addCell(new Cell('age', 21)); - - $row2 = new Row(); - $row2->addCell(new Cell('name', 'John')); - $row2->addCell(new Cell('sex', 'male')); - - $row3 = new Row(); - $row3->addCell(new Cell('name', 'Catherine')); - $row3->addCell(new Cell('sex', 'female')); - $row3->addCell(new Cell('height', 168)); - - $table = new Table(); - $table->addRow($row); - $table->addRow($row2); - $table->addRow($row3); - - $this->assertSame(['name', 'age', 'sex', 'height'], $table->getAllColumns()->toArray()); - } - - public function testColumnWidth() - { - $row = new Row(); - $row->addCell(new Cell('name', 'Jon')); - $row->addCell(new Cell('age', 21)); - - $row2 = new Row(); - $row2->addCell(new Cell('name', 'John')); - $row2->addCell(new Cell('age', 32)); - - $row3 = new Row(); - $row3->addCell(new Cell('name', 'Johnathan')); - $row3->addCell(new Cell('age', 23)); - - $table = new Table(); - - $table->addRow($row); - $table->addRow($row2); - $table->addRow($row3); - - $this->assertEquals(3, $table->getColumnWidth('age')); - $this->assertEquals(9, $table->getColumnWidth('name')); - } -}