You are here

public function TextTest::testGetSummary in Feeds 8.3

@covers ::getSummary

File

tests/src/Unit/Feeds/Target/TextTest.php, line 96

Class

TextTest
@coversDefaultClass \Drupal\feeds\Feeds\Target\Text @group feeds

Namespace

Drupal\Tests\feeds\Unit\Feeds\Target

Code

public function testGetSummary() {
  $storage = $this
    ->createMock(EntityStorageInterface::class);
  $storage
    ->expects($this
    ->any())
    ->method('loadByProperties')
    ->with([
    'status' => '1',
    'format' => 'plain_text',
  ])
    ->will($this
    ->onConsecutiveCalls([
    $this->filter
      ->reveal(),
  ], []));
  $manager = $this
    ->createMock(EntityTypeManagerInterface::class);
  $manager
    ->expects($this
    ->exactly(2))
    ->method('getStorage')
    ->will($this
    ->returnValue($storage));
  $container = new ContainerBuilder();
  $container
    ->set('entity_type.manager', $manager);
  \Drupal::setContainer($container);
  $this
    ->assertSame('Format: <em class="placeholder">Test filter</em>', (string) current($this->target
    ->getSummary()));
  $this
    ->assertEquals([], $this->target
    ->getSummary());
}