You are here

public function EntryTest::test in Feeds 8.3

@covers ::setXpath @covers ::setEntryElement @covers ::getGeoPoint

File

tests/src/Unit/Zend/Extension/Georss/EntryTest.php, line 19

Class

EntryTest
@coversDefaultClass \Drupal\feeds\Zend\Extension\Georss\Entry @group feeds

Namespace

Drupal\Tests\feeds\Unit\Zend\Extension\Georss

Code

public function test() {
  $text = '<feed xmlns:georss="http://www.georss.org/georss">';
  $text .= '<entry><georss:point>45.256 -71.92</georss:point></entry>';
  $text .= '</feed>';
  $doc = new \DOMDocument();
  $doc
    ->loadXML($text);
  $entry = new Entry();
  $entry
    ->setXpath(new \DOMXPath($doc));
  $entry
    ->setEntryElement($doc
    ->getElementsByTagName('entry')
    ->item(0));
  $point = $entry
    ->getGeoPoint();
  $this
    ->assertSame(45.256, $point['lat']);
  $this
    ->assertSame(-71.92, $point['lon']);
}