You are here

public function FeedsWebTestCase::getNid in Feeds 7

Same name and namespace in other branches
  1. 6 tests/feeds.test \FeedsWebTestCase::getNid()
  2. 7.2 tests/feeds.test \FeedsWebTestCase::getNid()

Helper function, retrieves node id from a URL.

2 calls to FeedsWebTestCase::getNid()
FeedsMapperOGTestCase::testInheritOG in tests/feeds_mapper_og.test
Test inheriting groups from the feed node.
FeedsWebTestCase::createFeedNode in tests/feeds.test.inc
Create a test feed node. Test user has to have sufficient permissions:

File

tests/feeds.test.inc, line 332
Common functionality for all Feeds tests.

Class

FeedsWebTestCase
Test basic Data API functionality.

Code

public function getNid($url) {
  $matches = array();
  preg_match('/node\\/(\\d+?)$/', $url, $matches);
  $nid = $matches[1];
  if (!is_numeric($nid)) {
    $this
      ->error(t('Could not find node id, found @nid instead.', array(
      '@nid' => $nid,
    )));
  }
  return $nid;
}