Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
superhaggis authored Feb 21, 2019
1 parent ebc893c commit 2e51498
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/PhpWord/Element/TrackChangeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,22 @@ public function testConstructDefault()
$this->assertEquals($date, $oTrackChange->getDate());
$this->assertEquals(TrackChange::INSERTED, $oTrackChange->getChangeType());
}

/**
* New instance with invalid \DateTime (produced by \DateTime::createFromFormat(...))
*/
public function testConstructDefaultWithInvalidDate()
{
$author = 'Test User';
$date = false;
$oTrackChange = new TrackChange(TrackChange::INSERTED, $author, $date);

$oText = new Text('dummy text');
$oText->setTrackChange($oTrackChange);

$this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\TrackChange', $oTrackChange);
$this->assertEquals($author, $oTrackChange->getAuthor());
$this->assertEquals($date, null);
$this->assertEquals(TrackChange::INSERTED, $oTrackChange->getChangeType());
}
}

0 comments on commit 2e51498

Please sign in to comment.