implement Cell:isDate() for unification

This commit is contained in:
madflow authored and Adrien Loison committed 2018-01-16 14:22:37 +01:00
1 parent e135b71473
commit 21e0e9e6b1
2 files changed
+17

No files matched your search

+8
View File
@@ -182,6 +182,14 @@ class Cell
return $this->type === self::TYPE_STRING; return $this->type === self::TYPE_STRING;
} }
/**
* @return bool
*/
public function isDate()
{
return $this->type === self::TYPE_DATE;
}
/** /**
* @return bool * @return bool
*/ */
+9
View File
@@ -54,6 +54,15 @@ class CellTest extends \PHPUnit\Framework\TestCase
$this->assertTrue((new Cell(false))->isBoolean()); $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 * @return void
*/ */