public function EmailTest::testPrepareValue in Feeds 8.3
Basic test for the email target.
@covers ::prepareValue
File
- tests/
src/ Unit/ Feeds/ Target/ EmailTest.php, line 25
Class
- EmailTest
- @coversDefaultClass \Drupal\feeds\Feeds\Target\Email @group feeds
Namespace
Drupal\Tests\feeds\Unit\Feeds\TargetCode
public function testPrepareValue() {
$method = $this
->getMethod('Drupal\\feeds\\Feeds\\Target\\Email', 'prepareTarget')
->getClosure();
$configuration = [
'feed_type' => $this
->createMock('Drupal\\feeds\\FeedTypeInterface'),
'target_definition' => $method($this
->getMockFieldDefinition()),
];
$target = new Email($configuration, 'email', []);
$method = $this
->getProtectedClosure($target, 'prepareValue');
$values = [
'value' => 'string',
];
$method(0, $values);
$this
->assertSame($values['value'], '');
$values = [
'value' => 'admin@example.com',
];
$method(0, $values);
$this
->assertSame($values['value'], 'admin@example.com');
}