Merge branch '2.0'

This commit is contained in:
Jeremy Mikola 2013-03-07 17:54:21 -05:00
commit b12b92845c
2 changed files with 3 additions and 3 deletions

View file

@ -149,7 +149,7 @@ class ModelToElasticaAutoTransformerTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(true, $data['bool']);
$this->assertEquals(false, $data['falseBool']);
$expectedDate = new \DateTime('1979-05-05');
$this->assertEquals($expectedDate->format('U'), $data['date']);
$this->assertEquals($expectedDate->format('c'), $data['date']);
}
public function testThatCanTransformObjectWithIteratorValue()
@ -186,7 +186,7 @@ class ModelToElasticaAutoTransformerTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(
array(
'key1' => 'value1',
'key2' => array('value2', false, 123, 8.9, $expectedDate->format('U')),
'key2' => array('value2', false, 123, 8.9, $expectedDate->format('c')),
), $data['multiArray']
);
}

View file

@ -107,7 +107,7 @@ class ModelToElasticaAutoTransformer implements ModelToElasticaTransformerInterf
$normalizeValue = function(&$v)
{
if ($v instanceof \DateTime) {
$v = $v->format('v');
$v = $v->format('c');
} elseif (!is_scalar($v) && !is_null($v)) {
$v = (string)$v;
}