You are here

public function BooleanTest::testPrepareValue in Feeds 8.3

@covers ::prepareValue

File

tests/src/Unit/Feeds/Target/BooleanTest.php, line 24

Class

BooleanTest
@coversDefaultClass \Drupal\feeds\Feeds\Target\Boolean @group feeds

Namespace

Drupal\Tests\feeds\Unit\Feeds\Target

Code

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']);
}