You are here

RestfulCreateTaxonomyTermTestCase.test in RESTful 7

Same filename and directory in other branches
  1. 7.2 tests/RestfulCreateTaxonomyTermTestCase.test

Contains RestfulCreateTaxonomyTermTestCase

File

tests/RestfulCreateTaxonomyTermTestCase.test
View source
<?php

/**
 * @file
 * Contains RestfulCreateTaxonomyTermTestCase
 */
class RestfulCreateTaxonomyTermTestCase extends DrupalWebTestCase {
  public static function getInfo() {
    return array(
      'name' => 'Taxonomy term integration',
      'description' => 'Test the creation of a taxonomy term entity type.',
      'group' => 'RESTful',
    );
  }
  function setUp() {
    parent::setUp('restful_test');
  }

  /**
   * Test the creation of a taxonomy term entity type.
   */
  function testCreate() {
    $user1 = $this
      ->drupalCreateUser(array(
      'create article content',
    ));
    $this
      ->drupalLogin($user1);
    $handler = restful_get_restful_handler('test_tags');
    $handler
      ->setAccount($user1);
    $text1 = $this
      ->randomName();
    $request = array(
      'label' => $text1,
    );
    $result = $handler
      ->post('', $request);
    $id = $result[0]['id'];
    $this
      ->assertTrue($id, 'Term was created by a non-admin user.');
  }

}

Classes

Namesort descending Description
RestfulCreateTaxonomyTermTestCase @file Contains RestfulCreateTaxonomyTermTestCase