Writer\Ods\Content: Set "CompatibilityMode" before and after running the tests in
order to avoid conflicts with other tests
This commit is contained in:
parent
93b5337bda
commit
219e4e6258
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace PhpOffice\PhpSpreadsheetTests\Writer\Ods\Content;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\DataType;
|
||||
use PhpOffice\PhpSpreadsheet\Shared\Date;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
|
@ -16,6 +17,25 @@ class ContentTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
public $samplesPath = __DIR__ . '/../../../data/Writer/Ods';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $compatibilityMode;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->compatibilityMode = Functions::getCompatibilityMode();
|
||||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE);
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
parent::tearDown();
|
||||
Functions::setCompatibilityMode($this->compatibilityMode);
|
||||
}
|
||||
|
||||
public function testWriteEmptySpreadsheet()
|
||||
{
|
||||
$content = new Content();
|
||||
|
@ -40,7 +60,11 @@ class ContentTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$worksheet1->setCellValue('A2', true); // Boolean
|
||||
$worksheet1->setCellValue('B2', false); // Boolean
|
||||
$worksheet1->setCellValue('C2', '=IF(A3, CONCATENATE(A1, " ", A2), CONCATENATE(A2, " ", A1))'); // Formula
|
||||
$worksheet1->setCellValueExplicit(
|
||||
'C2',
|
||||
'=IF(A3, CONCATENATE(A1, " ", A2), CONCATENATE(A2, " ", A1))',
|
||||
DataType::TYPE_FORMULA
|
||||
); // Formula
|
||||
|
||||
$worksheet1->setCellValue('D2', Date::PHPToExcel(1488635026)); // Date
|
||||
$worksheet1->getStyle('D2')
|
||||
|
|
|
@ -79,8 +79,8 @@
|
|||
<table:table-cell table:style-name="ce0" office:value-type="boolean" office:value="">
|
||||
<text:p></text:p>
|
||||
</table:table-cell>
|
||||
<table:table-cell table:style-name="ce10" table:formula="of:=IF(A3, CONCATENATE(A1, " ", A2), CONCATENATE(A2, " ", A1))" office:value-type="string" office:value="1 TRUE">
|
||||
<text:p>1 TRUE</text:p>
|
||||
<table:table-cell table:style-name="ce10" table:formula="of:=IF(A3, CONCATENATE(A1, " ", A2), CONCATENATE(A2, " ", A1))" office:value-type="string" office:value="1 1">
|
||||
<text:p>1 1</text:p>
|
||||
</table:table-cell>
|
||||
<table:table-cell table:style-name="ce1" office:value-type="float" office:value="42798.572060185">
|
||||
<text:p>42798.572060185</text:p>
|
||||
|
|
Loading…
Reference in New Issue