Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- Broadened `XMLReader::getElement` and `getElements` `$contextNode` parameter to `?\DOMNode` (was `?\DOMElement`) - @slayerfx GH-35
- Restricted `XMLReader::getElement` return type to `DOMElement|null` using `instanceof` check - @slayerfx GH-35
- Fixed date setters (`Task`, `DocumentInformations`, `DocumentProperties`) storing `strtotime()` `false` for unparseable date strings; now stored as `null` to match the typed `?int` getters (revealed by the samples job) - @slayerfx GH-45
- Fixed flaky date tests (`Task`, `DocumentInformations`, `DocumentProperties`) comparing two separate `time()` calls, which failed whenever the second changed between them; the argument-less setters are now asserted against a time range - @slayerfx GH-60

### Miscellaneous
- Added ProjectLibre writer for `.pod` files (writes an embedded MSPDI part) - @slayerfx GH-58
Expand Down
10 changes: 8 additions & 2 deletions tests/PhpProject/Tests/DocumentInformationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ public function testEndDate(): void
$value = time();

$object = new DocumentInformations();
$before = time();
$this->assertInstanceOf('PhpOffice\\PhpProject\\DocumentInformations', $object->setEndDate());
$this->assertEquals($value, $object->getEndDate());
$after = time();
$this->assertGreaterThanOrEqual($before, $object->getEndDate());
$this->assertLessThanOrEqual($after, $object->getEndDate());
$this->assertInstanceOf('PhpOffice\\PhpProject\\DocumentInformations', $object->setEndDate((string) $value));
$this->assertEquals($value, $object->getEndDate());
$this->assertInstanceOf('PhpOffice\\PhpProject\\DocumentInformations', $object->setEndDate('2014-08-05 19:30:00'));
Expand All @@ -50,8 +53,11 @@ public function testStartDate(): void
$value = time();

$object = new DocumentInformations();
$before = time();
$this->assertInstanceOf('PhpOffice\\PhpProject\\DocumentInformations', $object->setStartDate());
$this->assertEquals($value, $object->getStartDate());
$after = time();
$this->assertGreaterThanOrEqual($before, $object->getStartDate());
$this->assertLessThanOrEqual($after, $object->getStartDate());
$this->assertInstanceOf('PhpOffice\\PhpProject\\DocumentInformations', $object->setStartDate((string) $value));
$this->assertEquals($value, $object->getStartDate());
$this->assertInstanceOf('PhpOffice\\PhpProject\\DocumentInformations', $object->setStartDate('2014-08-05 19:30:00'));
Expand Down
10 changes: 8 additions & 2 deletions tests/PhpProject/Tests/DocumentPropertiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,11 @@ public function testGetSetCreated(): void
$value = time();

$object = new DocumentProperties();
$before = time();
$this->assertInstanceOf('PhpOffice\\PhpProject\\DocumentProperties', $object->setCreated());
$this->assertEquals($value, $object->getCreated());
$after = time();
$this->assertGreaterThanOrEqual($before, $object->getCreated());
$this->assertLessThanOrEqual($after, $object->getCreated());
$this->assertInstanceOf('PhpOffice\\PhpProject\\DocumentProperties', $object->setCreated((string) $value));
$this->assertEquals($value, $object->getCreated());
$this->assertInstanceOf('PhpOffice\\PhpProject\\DocumentProperties', $object->setCreated('2014-08-05 19:30:00'));
Expand Down Expand Up @@ -246,8 +249,11 @@ public function testGetSetModified(): void
$value = time();

$object = new DocumentProperties();
$before = time();
$this->assertInstanceOf('PhpOffice\\PhpProject\\DocumentProperties', $object->setModified());
$this->assertEquals($value, $object->getModified());
$after = time();
$this->assertGreaterThanOrEqual($before, $object->getModified());
$this->assertLessThanOrEqual($after, $object->getModified());
$this->assertInstanceOf('PhpOffice\\PhpProject\\DocumentProperties', $object->setModified((string) $value));
$this->assertEquals($value, $object->getModified());
$this->assertInstanceOf('PhpOffice\\PhpProject\\DocumentProperties', $object->setModified('2014-08-05 19:30:00'));
Expand Down
14 changes: 10 additions & 4 deletions tests/PhpProject/Tests/TaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ public function testGetSetEndDate(): void
$object = new Task();

$value = time();

$this->assertEquals('', $object->getEndDate());
$before = time();
$this->assertInstanceOf('PhpOffice\\PhpProject\\Task', $object->setEndDate());
$this->assertEquals($value, $object->getEndDate());
$after = time();
$this->assertGreaterThanOrEqual($before, $object->getEndDate());
$this->assertLessThanOrEqual($after, $object->getEndDate());
$this->assertInstanceOf('PhpOffice\\PhpProject\\Task', $object->setEndDate($value));
$this->assertEquals($value, $object->getEndDate());
$this->assertInstanceOf('PhpOffice\\PhpProject\\Task', $object->setEndDate((string)$value));
Expand Down Expand Up @@ -109,10 +112,13 @@ public function testGetSetStartDate(): void
$object = new Task();

$value = time();

$this->assertEquals('', $object->getStartDate());
$before = time();
$this->assertInstanceOf('PhpOffice\\PhpProject\\Task', $object->setStartDate());
$this->assertEquals($value, $object->getStartDate());
$after = time();
$this->assertGreaterThanOrEqual($before, $object->getStartDate());
$this->assertLessThanOrEqual($after, $object->getStartDate());
$this->assertInstanceOf('PhpOffice\\PhpProject\\Task', $object->setStartDate($value));
$this->assertEquals($value, $object->getStartDate());
$this->assertInstanceOf('PhpOffice\\PhpProject\\Task', $object->setStartDate((string)$value));
Expand Down