You are here

function RestfulCreateTaxonomyTermTestCase::testCreate in RESTful 7

Same name and namespace in other branches
  1. 7.2 tests/RestfulCreateTaxonomyTermTestCase.test \RestfulCreateTaxonomyTermTestCase::testCreate()

Test the creation of a taxonomy term entity type.

File

tests/RestfulCreateTaxonomyTermTestCase.test, line 25
Contains RestfulCreateTaxonomyTermTestCase

Class

RestfulCreateTaxonomyTermTestCase
@file Contains RestfulCreateTaxonomyTermTestCase

Code

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.');
}