You are here

public function TestMapper::testGetInfo in Feeds Paragraphs 8

@covers ::getInfo

File

tests/src/Unit/TestMapper.php, line 118

Class

TestMapper
@group Feeds Paragraphs @coversDefaultClass \Drupal\feeds_para_mapper\Mapper

Namespace

Drupal\Tests\feeds_para_mapper\Unit

Code

public function testGetInfo() {

  // Test against a field with TargetInfo attached:
  $field = $this->fieldHelper
    ->getBundleFields('bundle_two')[0]
    ->reveal();
  $info = $this
    ->getTargetInfo();
  $info->plugin = array();
  $field
    ->set('target_info', $info);
  $res = $this->mapper
    ->getInfo($field, 'plugin');
  self::assertNotNull($res, "property should exist");
  $res = $this->mapper
    ->getInfo($field, 'test');
  self::assertNull($res, "property should not exist");

  // Test against a field with no TargetInfo attached:
  $field
    ->set('target_info', null);
  $res = $this->mapper
    ->getInfo($field, 'test');
  self::assertNull($res, "Should return null if no TargetInfo attached to the field");
}