Skip to content
Permalink
Browse files

Fix API docs and make tests smaller/simpler.

  • Loading branch information...
markstory committed Feb 3, 2016
1 parent 6a36f60 commit 0b33513724d6261350fd89486434dcec36a70571
Showing with 12 additions and 4 deletions.
  1. +1 −1 src/Database/Type/DateType.php
  2. +11 −3 tests/TestCase/Database/Type/DateTimeTypeTest.php
@@ -80,7 +80,7 @@ public function marshal($value)
*
* @param string $value The value to convert.
* @param \Cake\Database\Driver $driver The driver instance to convert with.
* @return \Carbon\Carbon
* @return \Cake\I18n\Date|\DateTime
*/
public function toPHP($value, Driver $driver)
{
@@ -48,11 +48,19 @@ public function setUp()
*
* @return void
*/
public function testToPHP()
public function testToPHPEmpty()
{
$this->assertNull($this->type->toPHP(null, $this->driver));
$this->assertNull($this->type->toPHP('0000-00-00 00:00:00', $this->driver));
}
/**
* Test toPHP
*
* @return void
*/
public function testToPHPString()
{
$result = $this->type->toPHP('2001-01-04 12:13:14', $this->driver);
$this->assertInstanceOf('Cake\I18n\Time', $result);
$this->assertEquals('2001', $result->format('Y'));
@@ -260,10 +268,10 @@ public function testToImmutableAndToMutable()
{
$this->type->useImmutable();
$this->assertInstanceOf('DateTimeImmutable', $this->type->marshal('2015-11-01 11:23:00'));
$this->assertInstanceOf('DateTimeImmutable', $this->type->toPhp('2015-11-01 11:23:00', $this->driver));
$this->assertInstanceOf('DateTimeImmutable', $this->type->toPHP('2015-11-01 11:23:00', $this->driver));
$this->type->useMutable();
$this->assertInstanceOf('DateTime', $this->type->marshal('2015-11-01 11:23:00'));
$this->assertInstanceOf('DateTime', $this->type->toPhp('2015-11-01 11:23:00', $this->driver));
$this->assertInstanceOf('DateTime', $this->type->toPHP('2015-11-01 11:23:00', $this->driver));
}
}

0 comments on commit 0b33513

Please sign in to comment.
You can’t perform that action at this time.