Skip to content

Commit 8a797a9

Browse files
committed
Added testes for "Fixed writeCell() after writeRow() in same row index throwing "Writing row backward" exception"
1 parent 1150117 commit 8a797a9

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

tests/FCsvWriterTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
use Imtigger\OneExcel\ColumnType;
44
use Imtigger\OneExcel\Driver;
5-
use Imtigger\OneExcel\Format;
65
use PHPUnit\Framework\TestCase;
76

87
final class FCsvWriterTest extends TestCase {
@@ -30,6 +29,7 @@ public function testCreate()
3029
$excel->writeCell(2, 1, 'World');
3130
$excel->writeCell(3, 2, 3.141592653, ColumnType::NUMERIC);
3231
$excel->writeRow(4, ['One', 'Excel']);
32+
$excel->writeCell(4, 2, 'Test');
3333

3434
$excel->output();
3535

@@ -41,6 +41,7 @@ public function testCreate()
4141
$this->assertEquals(3.141592653, $this->getCellValue($path, 'C3'));
4242
$this->assertEquals('One', $this->getCellValue($path, 'A4'));
4343
$this->assertEquals('Excel', $this->getCellValue($path, 'B4'));
44+
$this->assertEquals('Test', $this->getCellValue($path, 'C4'));
4445

4546
unlink($path);
4647
}
@@ -56,6 +57,7 @@ public function testTemplate()
5657
$excel->writeCell(3, 1, 'World');
5758
$excel->writeCell(4, 2, 3.141592653, ColumnType::NUMERIC);
5859
$excel->writeRow(5, ['One', 'Excel']);
60+
$excel->writeCell(5, 2, 'Test');
5961

6062
$excel->output();
6163

@@ -69,6 +71,7 @@ public function testTemplate()
6971
$this->assertEquals(3.141592653, $this->getCellValue($path, 'C4'));
7072
$this->assertEquals('One', $this->getCellValue($path, 'A5'));
7173
$this->assertEquals('Excel', $this->getCellValue($path, 'B5'));
74+
$this->assertEquals('Test', $this->getCellValue($path, 'C5'));
7275

7376
unlink($path);
7477
}

tests/LibXLWriterTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function testCreate()
4141
$excel->writeCell(2, 1, 'World');
4242
$excel->writeCell(3, 2, 3.141592653, ColumnType::NUMERIC);
4343
$excel->writeRow(4, ['One', 'Excel']);
44+
$excel->writeCell(4, 2, 'Test');
4445

4546
$excel->output();
4647

@@ -52,6 +53,7 @@ public function testCreate()
5253
$this->assertEquals(3.141592653, $this->getCellValue($path, 'C3'));
5354
$this->assertEquals('One', $this->getCellValue($path, 'A4'));
5455
$this->assertEquals('Excel', $this->getCellValue($path, 'B4'));
56+
$this->assertEquals('Test', $this->getCellValue($path, 'C4'));
5557

5658
unlink($path);
5759
}
@@ -70,6 +72,7 @@ public function testTemplate()
7072
$excel->writeCell(3, 1, 'World');
7173
$excel->writeCell(4, 2, 3.141592653, ColumnType::NUMERIC);
7274
$excel->writeRow(5, ['One', 'Excel']);
75+
$excel->writeCell(5, 2, 'Test');
7376

7477
$excel->output();
7578

@@ -83,6 +86,7 @@ public function testTemplate()
8386
$this->assertEquals(3.141592653, $this->getCellValue($path, 'C4'));
8487
$this->assertEquals('One', $this->getCellValue($path, 'A5'));
8588
$this->assertEquals('Excel', $this->getCellValue($path, 'B5'));
89+
$this->assertEquals('Test', $this->getCellValue($path, 'C5'));
8690

8791
unlink($path);
8892
}

tests/PhpSpreadsheetWriterTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public function testCreate()
2929
$excel->writeCell(2, 1, 'World');
3030
$excel->writeCell(3, 2, 3.141592653, ColumnType::NUMERIC);
3131
$excel->writeRow(4, ['One', 'Excel']);
32+
$excel->writeCell(4, 2, 'Test');
3233

3334
$excel->output();
3435

@@ -40,6 +41,7 @@ public function testCreate()
4041
$this->assertEquals(3.141592653, $this->getCellValue($path, 'C3'));
4142
$this->assertEquals('One', $this->getCellValue($path, 'A4'));
4243
$this->assertEquals('Excel', $this->getCellValue($path, 'B4'));
44+
$this->assertEquals('Test', $this->getCellValue($path, 'C4'));
4345

4446
unlink($path);
4547
}
@@ -55,6 +57,7 @@ public function testTemplate()
5557
$excel->writeCell(3, 1, 'World');
5658
$excel->writeCell(4, 2, 3.141592653, ColumnType::NUMERIC);
5759
$excel->writeRow(5, ['One', 'Excel']);
60+
$excel->writeCell(5, 2, 'Test');
5861

5962
$excel->output();
6063

@@ -68,6 +71,7 @@ public function testTemplate()
6871
$this->assertEquals(3.141592653, $this->getCellValue($path, 'C4'));
6972
$this->assertEquals('One', $this->getCellValue($path, 'A5'));
7073
$this->assertEquals('Excel', $this->getCellValue($path, 'B5'));
74+
$this->assertEquals('Test', $this->getCellValue($path, 'C5'));
7175

7276
unlink($path);
7377
}

tests/SpoutWriterTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
use Imtigger\OneExcel\ColumnType;
44
use Imtigger\OneExcel\Driver;
5-
use Imtigger\OneExcel\Format;
65
use PHPUnit\Framework\TestCase;
76

87
final class SpoutWriterTest extends TestCase {
@@ -30,6 +29,7 @@ public function testCreate()
3029
$excel->writeCell(2, 1, 'World');
3130
$excel->writeCell(3, 2, 3.141592653, ColumnType::NUMERIC);
3231
$excel->writeRow(4, ['One', 'Excel']);
32+
$excel->writeCell(4, 2, 'Test');
3333

3434
$excel->output();
3535

@@ -41,6 +41,7 @@ public function testCreate()
4141
$this->assertEquals(3.141592653, $this->getCellValue($path, 'C3'));
4242
$this->assertEquals('One', $this->getCellValue($path, 'A4'));
4343
$this->assertEquals('Excel', $this->getCellValue($path, 'B4'));
44+
$this->assertEquals('Test', $this->getCellValue($path, 'C4'));
4445

4546
unlink($path);
4647
}
@@ -56,6 +57,7 @@ public function testTemplate()
5657
$excel->writeCell(3, 1, 'World');
5758
$excel->writeCell(4, 2, 3.141592653, ColumnType::NUMERIC);
5859
$excel->writeRow(5, ['One', 'Excel']);
60+
$excel->writeCell(5, 2, 'Test');
5961

6062
$excel->output();
6163

@@ -69,6 +71,7 @@ public function testTemplate()
6971
$this->assertEquals(3.141592653, $this->getCellValue($path, 'C4'));
7072
$this->assertEquals('One', $this->getCellValue($path, 'A5'));
7173
$this->assertEquals('Excel', $this->getCellValue($path, 'B5'));
74+
$this->assertEquals('Test', $this->getCellValue($path, 'C5'));
7275

7376
unlink($path);
7477
}

0 commit comments

Comments
 (0)