public function DateTimeTest::testPrepareValue in Feeds 8.3
Tests preparing a value that succeeds.
@covers ::prepareValue
File
- tests/
src/ Unit/ Feeds/ Target/ DateTimeTest.php, line 52
Class
- DateTimeTest
- @coversDefaultClass \Drupal\feeds\Feeds\Target\DateTime @group feeds
Namespace
Drupal\Tests\feeds\Unit\Feeds\TargetCode
public function testPrepareValue() {
$method = $this
->getMethod('Drupal\\feeds\\Feeds\\Target\\DateTime', 'prepareTarget')
->getClosure();
$this->targetDefinition = $method($this
->getMockFieldDefinition([
'datetime_type' => 'date',
]));
$configuration = [
'feed_type' => $this->feedType,
'target_definition' => $this->targetDefinition,
];
$target = new DateTime($configuration, 'datetime', []);
$method = $this
->getProtectedClosure($target, 'prepareValue');
$values = [
'value' => 1411606273,
];
$method(0, $values);
$this
->assertSame(date(DateTimeItemInterface::DATE_STORAGE_FORMAT, 1411606273), $values['value']);
}