You are here

class ServicesResourceTaxonomyTests in Services 6.3

Same name and namespace in other branches
  1. 7.3 tests/functional/ServicesResourceTaxonomyTests.test \ServicesResourceTaxonomyTests

Run test cases for the endpoint with no authentication turned on.

Hierarchy

Expanded class hierarchy of ServicesResourceTaxonomyTests

File

tests/functional/ServicesResourceTaxonomyTests.test, line 15

View source
class ServicesResourceTaxonomyTests extends ServicesWebtestCase {

  // Class variables
  protected $privileged_user = NULL;

  // Endpoint details.
  protected $endpoint = NULL;

  /**
   * Implementation of setUp().
   */
  public function setUp() {
    parent::setUp('autoload', 'ctools', 'services', 'rest_server', 'inputstream');

    // Set up endpoint.
    $this->endpoint = $this
      ->saveNewEndpoint();

    // Set up privileged user and login.
    $this->privileged_user = $this
      ->drupalCreateUser(array(
      'administer taxonomy',
    ));
    $this
      ->drupalLogin($this->privileged_user);
  }

  /**
   * Implementation of getInfo().
   */
  public static function getInfo() {
    return array(
      'name' => t('Resource Taxonomy'),
      'description' => t('Test the resource Taxonomy methods and actions.'),
      'group' => t('Services'),
    );
  }

  /**
   * Test taxonomy vocabulary create method.
   */
  function testVocabularyCreate() {
    $path = $this->endpoint->path;
    $vocabulary = array(
      'name' => $this
        ->randomName(),
      'description' => $this
        ->randomString(),
      'help' => $this
        ->randomString(),
      'relations' => 1,
      'hierarchy' => 1,
      'multiple' => 1,
      'required' => 0,
      'module' => 'services',
      'weight' => 0,
    );
    $response = $this
      ->servicesPost($path . '/taxonomy_vocabulary', $vocabulary);
    $vid = db_result(db_query('SELECT vid FROM {vocabulary} WHERE name = "%s"', $vocabulary['name']));
    $vocabulary_load = (array) taxonomy_vocabulary_load($vid);
    $vocabulary_intersect = array_intersect_assoc($vocabulary, $vocabulary_load);
    $this
      ->assertEqual($vocabulary, $vocabulary_intersect, t('Taxonomy vocabulary created properly.'), 'TaxonomyVocabularyResource: Create');
  }

  /**
   * Test taxonomy vocabulary create method (Legacy).
   *
   * TODO: To be removed in future version.
   * @see http://drupal.org/node/1083242
   */
  function testVocabularyCreateLegacy() {
    $path = $this->endpoint->path;
    $vocabulary = array(
      'name' => $this
        ->randomName(),
      'description' => $this
        ->randomString(),
      'help' => $this
        ->randomString(),
      'relations' => 1,
      'hierarchy' => 1,
      'multiple' => 1,
      'required' => 0,
      'module' => 'services',
      'weight' => 0,
    );
    $response = $this
      ->servicesPost($path . '/taxonomy_vocabulary', array(
      'vocabulary' => $vocabulary,
    ));
    $vid = db_result(db_query('SELECT vid FROM {vocabulary} WHERE name = "%s"', $vocabulary['name']));
    $vocabulary_load = (array) taxonomy_vocabulary_load($vid);
    $vocabulary_intersect = array_intersect_assoc($response['body'], $vocabulary_load);
    $this
      ->assertEqual($vocabulary['name'], $response['body']['name'], t('Taxonomy vocabulary created properly.'), 'TaxonomyVocabularyResource: Create (Legacy)');
  }

  /**
   * Test taxonomy vocabulry retrieve method.
   */
  function testVocabularyRetrieve() {
    $path = $this->endpoint->path;
    $vocabulary = $this
      ->createVocabulary();
    $vid = $vocabulary['vid'];
    $response = $this
      ->servicesGet($path . '/taxonomy_vocabulary/' . $vid);
    $vocabulary_retrieve = (array) $response['body'];
    $vocabulary_intersect = array_intersect_assoc($vocabulary, $vocabulary_retrieve);
    $this
      ->assertEqual($vocabulary, $vocabulary_intersect, t('Taxonomy vocabulary retrieved properly.'), 'TaxonomyVocabularyResource: Retrieve');
  }

  /**
   * Test taxonomy vocabulary update.
   */
  function testVocabularyUpdate() {
    $path = $this->endpoint->path;
    $vocabulary = $this
      ->createVocabulary();
    $vid = $vocabulary['vid'];
    $vocabulary['name'] = $this
      ->randomName();
    $vocabulary['description'] = $this
      ->randomString();
    $response = $this
      ->servicesPUT($path . '/taxonomy_vocabulary/' . $vid, $vocabulary);
    $vocabulary_load = (array) taxonomy_vocabulary_load($vid, TRUE);
    $vocabulary_intersect = array_intersect_assoc($vocabulary, $vocabulary_load);
    $this
      ->assertEqual($vocabulary, $vocabulary_intersect, t('Taxonomy vocabulary updated properly.'), 'TaxonomyVocabularyResource: Update');
  }

  /**
   * Test taxonomy vocabulary update (Legacy).
   *
   * TODO: To be removed in future version.
   * @see http://drupal.org/node/1083242
   */
  function testVocabularyUpdateLegacy() {
    $path = $this->endpoint->path;
    $vocabulary = $this
      ->createVocabulary();
    $vid = $vocabulary['vid'];
    $vocabulary['name'] = $this
      ->randomName();
    $vocabulary['description'] = $this
      ->randomString();
    $response = $this
      ->servicesPUT($path . '/taxonomy_vocabulary/' . $vid, array(
      'vocabulary' => $vocabulary,
    ));
    $vocabulary_load = (array) taxonomy_vocabulary_load($vid, TRUE);
    $vocabulary_intersect = array_intersect_assoc($vocabulary, $vocabulary_load);
    $this
      ->assertEqual($vocabulary, $vocabulary_intersect, t('Taxonomy vocabulary updated properly.'), 'TaxonomyVocabularyResource: Update (Legacy)');
  }

  /**
   * Test taxonomy vocabulary delete method.
   */
  function testVocabularyDelete() {
    $path = $this->endpoint->path;
    $vocabulary = $this
      ->createVocabulary();
    $vid = $vocabulary['vid'];
    $this
      ->servicesDelete($path . '/taxonomy_vocabulary/' . $vid);
    $vocabulary_load = taxonomy_vocabulary_load($vid, TRUE);
    $this
      ->assertTrue(empty($vocabulary_load), t('Taxonomy vocabulary deleted properly.'), 'TaxonomyVocabularyResource: Delete');
  }

  /**
   * Test taxonomy vocabulary getTree method.
   */
  function testVocabularyGetTree() {
    $path = $this->endpoint->path;
    $vocabulary = $this
      ->createVocabulary();
    $vid = $vocabulary['vid'];
    $part_tree_parent = 0;

    // Generate taxonomy tree.
    for ($i = 0; $i < 10; $i++) {
      $parent = rand(0, 1) * db_result(db_query('SELECT tid FROM {term_data} WHERE vid = %d ORDER BY RAND() LIMIT 1', $vid));
      $edit = array(
        'name' => $this
          ->randomName(),
        'parent' => $parent,
        'vid' => $vid,
      );
      taxonomy_save_term($edit);
      if (!empty($parent)) {
        $part_tree_parent = $parent;
      }
    }

    // Add term as grandchild to test maxdepth.
    $children = taxonomy_get_children($part_tree_parent);
    $edit = array(
      'name' => $this
        ->randomName(),
      'parent' => key($children),
      'vid' => $vid,
    );
    taxonomy_save_term($edit);

    // Compare full tree.
    $vocabulary_tree = taxonomy_get_tree($vid);
    $response = $this
      ->servicesPost($path . '/taxonomy_vocabulary/getTree', array(
      'vid' => $vid,
    ));
    $vocabulary_tree_response = $response['body'];
    $this
      ->assertEqual($vocabulary_tree, $vocabulary_tree_response, t('Vocabulary full tree received properly.'), 'TaxonomyVocabularyResource: getTree');

    // Compare part tree.
    $vocabulary_tree = taxonomy_get_tree($vid, $part_tree_parent);
    $response = $this
      ->servicesPost($path . '/taxonomy_vocabulary/getTree', array(
      'vid' => $vid,
      'parent' => $part_tree_parent,
    ));
    $vocabulary_tree_response = $response['body'];
    $this
      ->assertEqual($vocabulary_tree, $vocabulary_tree_response, t('Vocabulary part tree received properly.'), 'TaxonomyVocabularyResource: getTree');

    // Compare part tree with maxdepth.
    $vocabulary_tree = taxonomy_get_tree($vid, $part_tree_parent, -1, 1);
    $response = $this
      ->servicesPost($path . '/taxonomy_vocabulary/getTree', array(
      'vid' => $vid,
      'parent' => $part_tree_parent,
      'maxdepth' => 1,
    ));
    $vocabulary_tree_response = $response['body'];
    $this
      ->assertEqual($vocabulary_tree, $vocabulary_tree_response, t('Vocabulary part tree with depth received properly.'), 'TaxonomyVocabularyResource: getTree');
  }

  /**
   * Test taxonomy term create method.
   */
  function testTermCreate() {
    $path = $this->endpoint->path;
    $vocabulary = $this
      ->createVocabulary();
    $term = array(
      'vid' => $vocabulary['vid'],
      'name' => $this
        ->randomName(),
      'description' => $this
        ->randomString(),
      'weight' => rand(0, 100),
      'parent' => NULL,
    );
    $response = $this
      ->servicesPost($path . '/taxonomy_term', $term);

    // Load term by name.
    $term_by_name = (array) current(taxonomy_get_term_by_name($term['name']));
    $term_intersect = array_intersect_assoc($term, $term_by_name);

    // As term_intersect will not have parent, we unset this property.
    $term_data = $term;
    unset($term_data['parent']);
    $this
      ->assertEqual($term_data, $term_intersect, t('Taxonomy term created properly.'), 'TaxonomyTermResource: Create');
  }

  /**
   * Test taxonomy term create method (Legacy).
   *
   * TODO: To be removed in future version.
   * @see http://drupal.org/node/1083242
   */
  function testTermCreateLegacy() {
    $path = $this->endpoint->path;
    $vocabulary = $this
      ->createVocabulary();
    $term = array(
      'vid' => $vocabulary['vid'],
      'name' => $this
        ->randomName(),
      'description' => $this
        ->randomString(),
      'weight' => rand(0, 100),
      'parent' => NULL,
    );
    $response = $this
      ->servicesPost($path . '/taxonomy_term', array(
      'term' => $term,
    ));

    // Load term by name.
    $term_by_name = (array) current(taxonomy_get_term_by_name($term['name']));
    $term_intersect = array_intersect_assoc($term, $term_by_name);

    // As term_intersect will not have parent, we unset this property.
    $term_data = $term;
    unset($term_data['parent']);
    $this
      ->assertEqual($term_data, $term_intersect, t('Taxonomy term created properly.'), 'TaxonomyTermResource: Create (Legacy)');
  }

  /**
   * Test taxonomy term retrieve method.
   */
  function testTermRetrieve() {
    $path = $this->endpoint->path;
    $vocabulary = $this
      ->createVocabulary();
    $term = $this
      ->createTerm($vocabulary['vid']);
    $response = $this
      ->servicesGet($path . '/taxonomy_term/' . $term['tid']);
    $term_retrieve = (array) $response['body'];
    $this
      ->assertEqual($term_retrieve, $term, t('Taxonomy term retrieved properly.'), 'TaxonomyTermResource: Retrieve');
  }

  /**
   * Test taxonomy term update method.
   */
  function testTermUpdate() {
    $path = $this->endpoint->path;
    $vocabulary = $this
      ->createVocabulary();
    $term = $this
      ->createTerm($vocabulary['vid']);
    $term_update_data = array(
      'name' => $this
        ->randomName(),
      'description' => $this
        ->randomString(),
      'weight' => rand(0, 100),
    );
    $this
      ->servicesPut($path . '/taxonomy_term/' . $term['tid'], $term_update_data);
    $term_update = (array) current(taxonomy_get_term_by_name($term_update_data['name']));

    // Ensure that terms have different names but same tid.
    $this
      ->assertTrue($term['tid'] == $term_update['tid'] && $term['name'] != $term_update['name'], t('Taxonomy term updated properly.'), 'TaxonomyTermResource: Update');
  }

  /**
   * Test taxonomy term update method (Legacy).
   *
   * TODO: To be removed in future version.
   * @see http://drupal.org/node/1083242
   */
  function testTermUpdateLegacy() {
    $path = $this->endpoint->path;
    $vocabulary = $this
      ->createVocabulary();
    $term = $this
      ->createTerm($vocabulary['vid']);
    $term_update_data = array(
      'name' => $this
        ->randomName(),
      'description' => $this
        ->randomString(),
      'weight' => rand(0, 100),
    );
    $this
      ->servicesPut($path . '/taxonomy_term/' . $term['tid'], array(
      'term' => $term_update_data,
    ));
    $term_update = (array) current(taxonomy_get_term_by_name($term_update_data['name']));

    // Ensure that terms have different names but same tid.
    $this
      ->assertTrue($term['tid'] == $term_update['tid'] && $term['name'] != $term_update['name'], t('Taxonomy term updated properly.'), 'TaxonomyTermResource: Update (Legacy)');
  }

  /**
   * Test taxonomy term delete method.
   */
  function testTermDelete() {
    $path = $this->endpoint->path;
    $vocabulary = $this
      ->createVocabulary();
    $term = $this
      ->createTerm($vocabulary['vid']);
    $this
      ->servicesDelete($path . '/taxonomy_term/' . $term['tid']);
    $term_load = taxonomy_get_term($term['tid'], TRUE);
    $this
      ->assertTrue(empty($term_load), t('Taxonomy term deleted properly.'), 'TaxonomyTermResource: Delete');
  }

  /**
   * Test taxonomy term selectNodes method.
   */
  function testTermSelectNodes() {
    $path = $this->endpoint->path;
    $vocabulary = array(
      'name' => $this
        ->randomName(),
      'description' => $this
        ->randomString(),
      'help' => $this
        ->randomString(),
      'relations' => 1,
      'hierarchy' => 1,
      'multiple' => 1,
      'required' => 0,
      'module' => 'services',
      'weight' => 0,
      'nodes' => array(
        'page' => 'page',
      ),
    );
    taxonomy_save_vocabulary($vocabulary);
    $vid = db_result(db_query('SELECT vid FROM {vocabulary} WHERE name = "%s"', $vocabulary['name']));
    $term1 = $this
      ->createTerm($vid);
    $term2 = $this
      ->createTerm($vid);
    $nodes = array();
    $nodes_term1 = array();
    $nodes_term2 = array();
    $nodes_term1_term2 = array();
    $nodes_noterm = array();

    // Create 7 page nodes with term1 attached.
    for ($i = 0; $i < 7; $i++) {
      $node = $this
        ->drupalCreateNode(array(
        'taxonomy' => array(
          $vid => array(
            $term1['tid'],
          ),
        ),
      ));
      $nodes[$node->nid] = $node;
      $nodes_term1[] = $node->nid;
    }

    // Create 7 page nodes with term2 attached.
    for ($i = 0; $i < 7; $i++) {
      $node = $this
        ->drupalCreateNode(array(
        'taxonomy' => array(
          $vid => array(
            $term2['tid'],
          ),
        ),
      ));
      $nodes[$node->nid] = $node;
      $nodes_term2[] = $node->nid;
    }

    // Create 7 page nodes with both term1 and term2 attached.
    for ($i = 0; $i < 7; $i++) {
      $node = $this
        ->drupalCreateNode(array(
        'taxonomy' => array(
          $vid => array(
            $term1['tid'],
            $term2['tid'],
          ),
        ),
      ));
      $nodes[$node->nid] = $node;
      $nodes_term1_term2[] = $node->nid;
    }

    // Create 7 page nodes without any terms.
    for ($i = 0; $i < 7; $i++) {
      $node = $this
        ->drupalCreateNode();
      $nodes[$node->nid] = $node;
      $nodes_noterm[] = $node->nid;
    }

    // If pager is FALSE query is limited by 'feed_default_items' variable.
    variable_set('feed_default_items', 100);

    // Select 14 nodes with term1 attached.
    $response = $this
      ->servicesPost($path . '/taxonomy_term/selectNodes', array(
      'tids' => $term1['tid'],
      'pager' => FALSE,
    ));
    $response_nodes = $this
      ->getNodeNids($response['body']);
    sort($response_nodes);
    $term1_nodes = array_merge($nodes_term1, $nodes_term1_term2);
    sort($term1_nodes);
    $this
      ->assertEqual($response_nodes, $term1_nodes, t('selectNodes selected proper nodes by one term.'), 'TaxonomyTermResource: selectNodes');

    // Ensure pager works.
    $response = $this
      ->servicesPost($path . '/taxonomy_term/selectNodes', array(
      'tids' => $term1['tid'],
      'pager' => TRUE,
    ));
    $this
      ->assertEqual(count($response['body']), 10, t('selectNodes pager works.'), 'TaxonomyTermResource: selectNodes');

    // Test 'or' operator.
    $response = $this
      ->servicesPost($path . '/taxonomy_term/selectNodes', array(
      'tids' => $term1['tid'] . ',' . $term2['tid'],
      'pager' => FALSE,
    ));
    $response_nodes = $this
      ->getNodeNids($response['body']);
    sort($response_nodes);
    $term1_or_term2_nodes = array_merge($nodes_term1, $nodes_term1_term2, $nodes_term2);
    sort($term1_or_term2_nodes);
    $this
      ->assertEqual($response_nodes, $term1_or_term2_nodes, t('selectNodes selected proper nodes "term1 or term2".'), 'TaxonomyTermResource: selectNodes');

    // Test 'and' operator and order.
    $response = $this
      ->servicesPost($path . '/taxonomy_term/selectNodes', array(
      'tids' => array(
        $term1['tid'],
        $term2['tid'],
      ),
      'pager' => FALSE,
      'operator' => 'and',
      'order' => 'n.nid ASC',
    ));
    $response_nodes = $this
      ->getNodeNids($response['body']);
    $this
      ->assertEqual($response_nodes, $nodes_term1_term2, t('selectNodes selected proper nodes "term1 and term2" and proper order.'), 'TaxonomyTermResource: selectNodes');
  }

  /**
   * Helper. Create taxonomy vocabulary.
   */
  function createVocabulary() {
    $vocabulary = array(
      'name' => $this
        ->randomName(),
      'description' => $this
        ->randomString(),
      'help' => $this
        ->randomString(),
      'relations' => 1,
      'hierarchy' => 1,
      'multiple' => 1,
      'required' => 0,
      'module' => 'services',
      'weight' => 0,
    );
    taxonomy_save_vocabulary($vocabulary);
    $vid = db_result(db_query('SELECT vid FROM {vocabulary} WHERE name = "%s"', $vocabulary['name']));
    return (array) taxonomy_vocabulary_load($vid, TRUE);
  }

  /**
   * Helper. Create taxonomy term.
   */
  function createTerm($vid) {
    $term = array(
      'vid' => $vid,
      'name' => $this
        ->randomName(),
      'description' => $this
        ->randomString(),
      'weight' => rand(0, 100),
      'parent' => NULL,
    );
    taxonomy_save_term($term);

    // Load term by name.
    return (array) current(taxonomy_get_term_by_name($term['name']));
  }

  /**
   * Helper. Get array of nids from nodes array.
   */
  function getNodeNids($nodes) {
    $return = array();
    foreach ($nodes as $node) {
      $return[] = $node->nid;
    }
    return $return;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DrupalTestCase::$assertions protected property Assertions thrown in that test case.
DrupalTestCase::$databasePrefix protected property The database prefix of this test run.
DrupalTestCase::$originalFileDirectory protected property The original file directory, before it was changed for testing purposes.
DrupalTestCase::$originalPrefix protected property The original database prefix, before it was changed for testing purposes.
DrupalTestCase::$results public property Current results of this test case.
DrupalTestCase::$skipClasses protected property This class is skipped when looking for the source of an assertion.
DrupalTestCase::$testId protected property The test run ID.
DrupalTestCase::$timeLimit protected property Time limit for the test.
DrupalTestCase::assert protected function Internal helper: stores the assert.
DrupalTestCase::assertEqual protected function Check to see if two values are equal.
DrupalTestCase::assertFalse protected function Check to see if a value is false (an empty string, 0, NULL, or FALSE).
DrupalTestCase::assertIdentical protected function Check to see if two values are identical.
DrupalTestCase::assertNotEqual protected function Check to see if two values are not equal.
DrupalTestCase::assertNotIdentical protected function Check to see if two values are not identical.
DrupalTestCase::assertNotNull protected function Check to see if a value is not NULL.
DrupalTestCase::assertNull protected function Check to see if a value is NULL.
DrupalTestCase::assertTrue protected function Check to see if a value is not false (not an empty string, 0, NULL, or FALSE).
DrupalTestCase::deleteAssert public static function Delete an assertion record by message ID.
DrupalTestCase::error protected function Fire an error assertion.
DrupalTestCase::errorHandler public function Handle errors during test runs.
DrupalTestCase::exceptionHandler protected function Handle exceptions.
DrupalTestCase::fail protected function Fire an assertion that is always negative.
DrupalTestCase::generatePermutations public static function Converts a list of possible parameters into a stack of permutations.
DrupalTestCase::getAssertionCall protected function Cycles through backtrace until the first non-assertion method is found.
DrupalTestCase::insertAssert public static function Store an assertion from outside the testing context.
DrupalTestCase::pass protected function Fire an assertion that is always positive.
DrupalTestCase::randomName public static function Generates a random string containing letters and numbers.
DrupalTestCase::randomString public static function Generates a random string of ASCII characters of codes 32 to 126.
DrupalTestCase::run public function Run all tests in this class.
DrupalTestCase::verbose protected function Logs verbose message in a text file.
DrupalWebTestCase::$additionalCurlOptions protected property Additional cURL options.
DrupalWebTestCase::$content protected property The content of the page currently loaded in the internal browser.
DrupalWebTestCase::$cookieFile protected property The current cookie file used by cURL.
DrupalWebTestCase::$curlHandle protected property The handle of the current cURL connection.
DrupalWebTestCase::$drupalSettings protected property The value of the Drupal.settings JavaScript variable for the page currently loaded in the internal browser.
DrupalWebTestCase::$elements protected property The parsed version of the page.
DrupalWebTestCase::$generatedTestFiles protected property Whether the files were copied to the test files directory.
DrupalWebTestCase::$headers protected property The headers of the page currently loaded in the internal browser.
DrupalWebTestCase::$httpauth_credentials protected property HTTP authentication credentials (<username>:<password>).
DrupalWebTestCase::$httpauth_method protected property HTTP authentication method
DrupalWebTestCase::$loggedInUser protected property The current user logged in using the internal browser.
DrupalWebTestCase::$originalUser protected property The original user, before it was changed to a clean uid = 1 for testing purposes.
DrupalWebTestCase::$plainTextContent protected property The content of the page currently loaded in the internal browser (plain text version).
DrupalWebTestCase::$profile protected property The profile to install as a basis for testing.
DrupalWebTestCase::$redirect_count protected property The number of redirects followed during the handling of a request.
DrupalWebTestCase::$session_id protected property The current session ID, if available.
DrupalWebTestCase::$session_name protected property The current session name, if available.
DrupalWebTestCase::$url protected property The URL currently loaded in the internal browser.
DrupalWebTestCase::assertField protected function Asserts that a field exists with the given name or id.
DrupalWebTestCase::assertFieldById protected function Asserts that a field exists in the current page with the given id and value.
DrupalWebTestCase::assertFieldByName protected function Asserts that a field exists in the current page with the given name and value.
DrupalWebTestCase::assertFieldByXPath protected function Asserts that a field exists in the current page by the given XPath.
DrupalWebTestCase::assertFieldChecked protected function Asserts that a checkbox field in the current page is checked.
DrupalWebTestCase::assertLink protected function Pass if a link with the specified label is found, and optional with the specified index.
DrupalWebTestCase::assertLinkByHref protected function Pass if a link containing a given href (part) is found.
DrupalWebTestCase::assertMail protected function Asserts that the most recently sent e-mail message has the given value.
DrupalWebTestCase::assertMailPattern protected function Asserts that the most recently sent e-mail message has the pattern in it.
DrupalWebTestCase::assertMailString protected function Asserts that the most recently sent e-mail message has the string in it.
DrupalWebTestCase::assertNoDuplicateIds protected function Asserts that each HTML ID is used for just a single element.
DrupalWebTestCase::assertNoField protected function Asserts that a field does not exist with the given name or id.
DrupalWebTestCase::assertNoFieldById protected function Asserts that a field does not exist with the given id and value.
DrupalWebTestCase::assertNoFieldByName protected function Asserts that a field does not exist with the given name and value.
DrupalWebTestCase::assertNoFieldByXPath protected function Asserts that a field does not exist in the current page by the given XPath.
DrupalWebTestCase::assertNoFieldChecked protected function Asserts that a checkbox field in the current page is not checked.
DrupalWebTestCase::assertNoLink protected function Pass if a link with the specified label is not found.
DrupalWebTestCase::assertNoLinkByHref protected function Pass if a link containing a given href (part) is not found.
DrupalWebTestCase::assertNoOptionSelected protected function Asserts that a select option in the current page is not checked.
DrupalWebTestCase::assertNoPattern protected function Will trigger a pass if the perl regex pattern is not present in raw content.
DrupalWebTestCase::assertNoRaw protected function Pass if the raw text is NOT found on the loaded page, fail otherwise. Raw text refers to the raw HTML that the page generated.
DrupalWebTestCase::assertNoResponse protected function Asserts the page did not return the specified response code.
DrupalWebTestCase::assertNoText protected function Pass if the text is NOT found on the text version of the page. The text version is the equivalent of what a user would see when viewing through a web browser. In other words the HTML has been filtered out of the contents.
DrupalWebTestCase::assertNoTitle protected function Pass if the page title is not the given string.
DrupalWebTestCase::assertNoUniqueText protected function Pass if the text is found MORE THAN ONCE on the text version of the page.
DrupalWebTestCase::assertOptionSelected protected function Asserts that a select option in the current page is checked.
DrupalWebTestCase::assertPattern protected function Will trigger a pass if the Perl regex pattern is found in the raw content.
DrupalWebTestCase::assertRaw protected function Pass if the raw text IS found on the loaded page, fail otherwise. Raw text refers to the raw HTML that the page generated.
DrupalWebTestCase::assertResponse protected function Asserts the page responds with the specified response code.
DrupalWebTestCase::assertText protected function Pass if the text IS found on the text version of the page. The text version is the equivalent of what a user would see when viewing through a web browser. In other words the HTML has been filtered out of the contents.
DrupalWebTestCase::assertTextHelper protected function Helper for assertText and assertNoText.
DrupalWebTestCase::assertTitle protected function Pass if the page title is the given string.
DrupalWebTestCase::assertUniqueText protected function Pass if the text is found ONLY ONCE on the text version of the page.
DrupalWebTestCase::assertUniqueTextHelper protected function Helper for assertUniqueText and assertNoUniqueText.
DrupalWebTestCase::assertUrl protected function Pass if the internal browser's URL matches the given path.
DrupalWebTestCase::buildXPathQuery protected function Builds an XPath query.
DrupalWebTestCase::checkForMetaRefresh protected function Check for meta refresh tag and if found call drupalGet() recursively. This function looks for the http-equiv attribute to be set to "Refresh" and is case-sensitive.
DrupalWebTestCase::checkPermissions protected function Check to make sure that the array of permissions are valid.
DrupalWebTestCase::clickLink protected function Follows a link by name.
DrupalWebTestCase::constructFieldXpath protected function Helper function: construct an XPath for the given set of attributes and value.
DrupalWebTestCase::cronRun protected function Runs cron in the Drupal installed by Simpletest.
DrupalWebTestCase::curlClose protected function Close the cURL handler and unset the handler.
DrupalWebTestCase::curlHeaderCallback protected function Reads headers and registers errors received from the tested site.
DrupalWebTestCase::curlInitialize protected function Initializes the cURL connection.
DrupalWebTestCase::drupalCompareFiles protected function Compare two files based on size and file name.
DrupalWebTestCase::drupalCreateContentType protected function Creates a custom content type based on default settings.
DrupalWebTestCase::drupalCreateNode protected function Creates a node based on default settings.
DrupalWebTestCase::drupalCreateRole protected function Internal helper function; Create a role with specified permissions.
DrupalWebTestCase::drupalCreateUser protected function Create a user with a given set of permissions. The permissions correspond to the names given on the privileges page.
DrupalWebTestCase::drupalGet protected function Retrieves a Drupal path or an absolute path.
DrupalWebTestCase::drupalGetContent protected function Gets the current raw HTML of requested page.
DrupalWebTestCase::drupalGetHeader protected function Gets the value of an HTTP response header. If multiple requests were required to retrieve the page, only the headers from the last request will be checked by default. However, if TRUE is passed as the second argument, all requests will be processed…
DrupalWebTestCase::drupalGetHeaders protected function Gets the HTTP response headers of the requested page. Normally we are only interested in the headers returned by the last request. However, if a page is redirected or HTTP authentication is in use, multiple requests will be required to retrieve the…
DrupalWebTestCase::drupalGetMails protected function Gets an array containing all e-mails sent during this test case.
DrupalWebTestCase::drupalGetNodeByTitle function Get a node from the database based on its title.
DrupalWebTestCase::drupalGetSettings protected function Gets the value of the Drupal.settings JavaScript variable for the currently loaded page.
DrupalWebTestCase::drupalGetTestFiles protected function Get a list files that can be used in tests.
DrupalWebTestCase::drupalGetToken protected function Generate a token for the currently logged in user.
DrupalWebTestCase::drupalHead protected function Retrieves only the headers for a Drupal path or an absolute path.
DrupalWebTestCase::drupalLogin protected function Log in a user with the internal browser.
DrupalWebTestCase::drupalLogout protected function
DrupalWebTestCase::drupalPost protected function Execute a POST request on a Drupal page. It will be done as usual POST request with SimpleBrowser.
DrupalWebTestCase::drupalSetContent protected function Sets the raw HTML content. This can be useful when a page has been fetched outside of the internal browser and assertions need to be made on the returned page.
DrupalWebTestCase::drupalSetSettings protected function Sets the value of the Drupal.settings JavaScript variable for the currently loaded page.
DrupalWebTestCase::getAbsoluteUrl protected function Takes a path and returns an absolute path.
DrupalWebTestCase::getAllOptions protected function Get all option elements, including nested options, in a select.
DrupalWebTestCase::getSelectedItem protected function Get the selected value from a select field.
DrupalWebTestCase::getUrl protected function Get the current url from the cURL handler.
DrupalWebTestCase::handleForm protected function Handle form input related to drupalPost(). Ensure that the specified fields exist and attempt to create POST data in the correct manner for the particular field type.
DrupalWebTestCase::parse protected function Parse content returned from curlExec using DOM and SimpleXML.
DrupalWebTestCase::refreshVariables protected function Refresh the in-memory set of variables. Useful after a page request is made that changes a variable in a different thread.
DrupalWebTestCase::resetAll protected function Reset all data structures after having enabled new modules.
DrupalWebTestCase::tearDown protected function Delete created files and temporary files directory, delete the tables created by setUp(), and reset the database prefix.
DrupalWebTestCase::verboseEmail protected function Outputs to verbose the most recent $count emails sent.
DrupalWebTestCase::xpath protected function Perform an xpath search on the contents of the internal browser. The search is relative to the root element (HTML tag normally) of the page.
DrupalWebTestCase::__construct function Constructor for DrupalWebTestCase. Overrides DrupalTestCase::__construct
ServicesResourceTaxonomyTests::$endpoint protected property
ServicesResourceTaxonomyTests::$privileged_user protected property
ServicesResourceTaxonomyTests::createTerm function Helper. Create taxonomy term.
ServicesResourceTaxonomyTests::createVocabulary function Helper. Create taxonomy vocabulary.
ServicesResourceTaxonomyTests::getInfo public static function Implementation of getInfo().
ServicesResourceTaxonomyTests::getNodeNids function Helper. Get array of nids from nodes array.
ServicesResourceTaxonomyTests::setUp public function Implementation of setUp(). Overrides DrupalWebTestCase::setUp
ServicesResourceTaxonomyTests::testTermCreate function Test taxonomy term create method.
ServicesResourceTaxonomyTests::testTermCreateLegacy function Test taxonomy term create method (Legacy).
ServicesResourceTaxonomyTests::testTermDelete function Test taxonomy term delete method.
ServicesResourceTaxonomyTests::testTermRetrieve function Test taxonomy term retrieve method.
ServicesResourceTaxonomyTests::testTermSelectNodes function Test taxonomy term selectNodes method.
ServicesResourceTaxonomyTests::testTermUpdate function Test taxonomy term update method.
ServicesResourceTaxonomyTests::testTermUpdateLegacy function Test taxonomy term update method (Legacy).
ServicesResourceTaxonomyTests::testVocabularyCreate function Test taxonomy vocabulary create method.
ServicesResourceTaxonomyTests::testVocabularyCreateLegacy function Test taxonomy vocabulary create method (Legacy).
ServicesResourceTaxonomyTests::testVocabularyDelete function Test taxonomy vocabulary delete method.
ServicesResourceTaxonomyTests::testVocabularyGetTree function Test taxonomy vocabulary getTree method.
ServicesResourceTaxonomyTests::testVocabularyRetrieve function Test taxonomy vocabulry retrieve method.
ServicesResourceTaxonomyTests::testVocabularyUpdate function Test taxonomy vocabulary update.
ServicesResourceTaxonomyTests::testVocabularyUpdateLegacy function Test taxonomy vocabulary update (Legacy).
ServicesWebTestCase::curlExec protected function Performs a cURL exec with the specified options after calling curlConnect(). Overrides DrupalWebTestCase::curlExec
ServicesWebTestCase::parseHeader function Parse header.
ServicesWebTestCase::populateEndpointFAPI public function Creates a data array for populating an endpoint creation form. 1
ServicesWebTestCase::saveNewEndpoint public function 1
ServicesWebTestCase::servicesDelete protected function
ServicesWebTestCase::servicesGet protected function
ServicesWebTestCase::servicesPost protected function
ServicesWebTestCase::servicesPut protected function