You are here

public function FeedsSubscriberTest::testAfterParseWithEmptyArray in Feeds Tamper 8.2

@covers ::afterParse

File

tests/src/Unit/EventSubscriber/FeedsSubscriberTest.php, line 133

Class

FeedsSubscriberTest
@coversDefaultClass \Drupal\feeds_tamper\EventSubscriber\FeedsSubscriber @group feeds_tamper

Namespace

Drupal\Tests\feeds_tamper\Unit\EventSubscriber

Code

public function testAfterParseWithEmptyArray() {
  $tamper = $this
    ->createMock(TamperInterface::class);
  $tamper
    ->expects($this
    ->any())
    ->method('tamper')
    ->will($this
    ->returnValue('Foo'));
  $this->tamperMeta
    ->expects($this
    ->once())
    ->method('getTampersGroupedBySource')
    ->will($this
    ->returnValue([
    'alpha' => [
      $this
        ->createTamperMock('Foo'),
    ],
  ]));

  // Add an item to the parser result.
  $item = new DynamicItem();
  $item
    ->set('alpha', []);
  $this->event
    ->getParserResult()
    ->addItem($item);
  $this->subscriber
    ->afterParse($this->event);
  $this
    ->assertEquals('Foo', $item
    ->get('alpha'));
}