You are here

public function XmlParserTest::testEmptyFeed in Feeds extensible parsers 8

Tests empty feed handling.

File

tests/src/Unit/Feeds/Parser/XmlParserTest.php, line 279

Class

XmlParserTest
@coversDefaultClass \Drupal\feeds_ex\Feeds\Parser\XmlParser @group feeds_ex

Namespace

Drupal\Tests\feeds_ex\Unit\Feeds\Parser

Code

public function testEmptyFeed() {
  $this->parser
    ->parse($this->feed, new RawFetcherResult(' ', $this->fileSystem), $this->state);
  $messages = $this->parser
    ->getMessenger()
    ->getMessages();
  $this
    ->assertCount(1, $messages, 'The expected number of messages.');
  $this
    ->assertSame((string) $messages[0]['message'], 'The feed is empty.', 'Message text is correct.');
  $this
    ->assertSame($messages[0]['type'], 'warning', 'Message type is warning.');
  $this
    ->assertFalse($messages[0]['repeat'], 'Repeat is set to false.');
}