BooleanTest.php in Feeds 8.3
File
tests/src/Unit/Feeds/Target/BooleanTest.php
View source
<?php
namespace Drupal\Tests\feeds\Unit\Feeds\Target;
use Drupal\feeds\FeedTypeInterface;
use Drupal\feeds\Feeds\Target\Boolean;
class BooleanTest extends FieldTargetTestBase {
protected function getTargetClass() {
return Boolean::class;
}
public function testPrepareValue() {
$method = $this
->getMethod(Boolean::class, 'prepareTarget')
->getClosure();
$configuration = [
'feed_type' => $this
->createMock(FeedTypeInterface::class),
'target_definition' => $method($this
->getMockFieldDefinition()),
];
$target = new Boolean($configuration, 'boolean', []);
$values = [
'value' => 'string',
];
$method = $this
->getProtectedClosure($target, 'prepareValue');
$method(0, $values);
$this
->assertSame(1, $values['value']);
}
}