You are here

public function FeedsWebTestBase::getNid in Feeds 8.2

Helper function, retrieves node id from a URL.

1 call to FeedsWebTestBase::getNid()
FeedsWebTestBase::createFeedNode in lib/Drupal/feeds/Tests/FeedsWebTestBase.php
Create a test feed node. Test user has to have sufficient permissions:

File

lib/Drupal/feeds/Tests/FeedsWebTestBase.php, line 528
Common functionality for all Feeds tests.

Class

FeedsWebTestBase
Test basic Data API functionality.

Namespace

Drupal\feeds\Tests

Code

public function getNid($url) {
  $matches = array();
  preg_match('/node\\/(\\d+?)$/', $url, $matches);
  $nid = $matches[1];

  // Test for actual integerness.
  $this
    ->assertTrue($nid === (string) (int) $nid, 'Node id is an integer.');
  return $nid;
}