implement Cell:isDate() for unification

This commit is contained in:
madflow 2017-12-21 08:52:34 +01:00 committed by Adrien Loison
parent e135b71473
commit 21e0e9e6b1
2 changed files with 17 additions and 0 deletions

View File

@ -182,6 +182,14 @@ class Cell
return $this->type === self::TYPE_STRING;
}
/**
* @return bool
*/
public function isDate()
{
return $this->type === self::TYPE_DATE;
}
/**
* @return bool
*/

View File

@ -54,6 +54,15 @@ class CellTest extends \PHPUnit\Framework\TestCase
$this->assertTrue((new Cell(false))->isBoolean());
}
/**
* @return void
*/
public function testCellTypeDate()
{
$this->assertTrue((new Cell(new \DateTime()))->isDate());
$this->assertTrue((new Cell(new \DateInterval('P2Y4DT6H8M')))->isDate());
}
/**
* @return void
*/