Additional tests with default version, and with formats

This commit is contained in:
Alexey Kopytko 2016-06-16 13:06:51 +09:00
parent 760a4dd307
commit 30f5697ed7
3 changed files with 38 additions and 0 deletions

View File

@ -34,4 +34,42 @@ class Test_Spreadsheet_Excel_Writer_WorkbookTest extends Test_Spreadsheet_Excel_
$this->assertSameAsInFixture('example.xls', $workbook); $this->assertSameAsInFixture('example.xls', $workbook);
} }
public function testWriteWithFormat()
{
$workbook = $this->getNewWorkbook();
$workbook->setVersion(8);
$format = $workbook->addFormat();
$format->setFontFamily('Helvetica');
$format->setSize(16);
$format->setVAlign('vcenter');
$format->setBorder(1);
$sheet = $workbook->addWorksheet('Example report');
$sheet->setInputEncoding('utf-8');
$sheet->setColumn(0, 10, 35);
$sheet->writeString(0, 0, "Test string", $format);
$sheet->setRow(0, 40);
$sheet->writeString(1, 0, "こんにちわ");
$this->assertSameAsInFixture('with_format.xls', $workbook);
}
public function testWithDefaultVersion()
{
$workbook = $this->getNewWorkbook();
$sheet = $workbook->addWorksheet("Example");
for ($i = 0; $i < 10; $i++) {
for ($j = 0; $j < 10; $j++) {
$sheet->write($i, $j, "Row $i $j");
}
}
$this->assertSameAsInFixture('example2.xls', $workbook);
}
} }

BIN
test/fixture/example2.xls Normal file

Binary file not shown.

Binary file not shown.