Skip to content

Commit b9da9aa

Browse files
committed
Tweak One Test
Fluke failure in CI push.
1 parent 089ffdf commit b9da9aa

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

tests/PhpSpreadsheetTests/Document/PropertiesTest.php

+21-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class PropertiesTest extends TestCase
1818
/** @var float */
1919
private $startTime;
2020

21-
protected function setup(): void
21+
protected function setUp(): void
2222
{
2323
do {
2424
// loop to avoid rare situation where timestamp changes
@@ -54,9 +54,16 @@ public function testSetCreator(): void
5454
*/
5555
public function testSetCreated($expectedCreationTime, $created): void
5656
{
57-
$expectedCreationTime = $expectedCreationTime ?? $this->startTime;
58-
59-
$this->properties->setCreated($created);
57+
if ($expectedCreationTime === null) {
58+
do {
59+
// loop to avoid rare situation where timestamp changes
60+
$expectedCreationTime = (float) (new DateTime())->format('U');
61+
$this->properties->setCreated($created);
62+
$endTime = (float) (new DateTime())->format('U');
63+
} while ($expectedCreationTime !== $endTime);
64+
} else {
65+
$this->properties->setCreated($created);
66+
}
6067
self::assertEquals($expectedCreationTime, $this->properties->getCreated());
6168
}
6269

@@ -86,9 +93,17 @@ public function testSetModifier(): void
8693
*/
8794
public function testSetModified($expectedModifiedTime, $modified): void
8895
{
89-
$expectedModifiedTime = $expectedModifiedTime ?? $this->startTime;
96+
if ($expectedModifiedTime === null) {
97+
do {
98+
// loop to avoid rare situation where timestamp changes
99+
$expectedModifiedTime = (float) (new DateTime())->format('U');
100+
$this->properties->setModified($modified);
101+
$endTime = (float) (new DateTime())->format('U');
102+
} while ($expectedModifiedTime !== $endTime);
103+
} else {
104+
$this->properties->setModified($modified);
105+
}
90106

91-
$this->properties->setModified($modified);
92107
self::assertEquals($expectedModifiedTime, $this->properties->getModified());
93108
}
94109

0 commit comments

Comments
 (0)