home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (xmlsitemap_taxonomy.test)

This example Drupal source code file (xmlsitemap_taxonomy.test) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

array, default, edit, function, modules, name, php, protected, save, taxonomy, vid, vocabularies, vocabulary, xmlsitemap

The xmlsitemap_taxonomy.test Drupal example source code

<?php
// $Id: xmlsitemap_taxonomy.test,v 1.3 2010/11/13 04:41:36 davereid Exp $

/**
 * @file
 * Unit tests for the xmlsitemap_taxonomy module.
 */

class XMLSitemapTaxonomyFunctionalTest extends XMLSitemapTestHelper {
  protected $normal_user;
  protected $terms = array();

  public static function getInfo() {
    return array(
      'name' => 'XML sitemap taxonomy',
      'description' => 'Functional tests for the XML sitemap taxonomy module.',
      'group' => 'XML sitemap',
    );
  }

  function setUp($modules = array()) {
    $modules[] = 'xmlsitemap_taxonomy';
    $modules[] = 'taxonomy';
    parent::setUp($modules);

    $this->admin_user = $this->drupalCreateUser(array('administer taxonomy', 'administer xmlsitemap'));
    $this->normal_user = $this->drupalCreateUser(array('access content'));
  }

  function testTaxonomySettings() {
    $this->drupalLogin($this->admin_user);

    $edit = array(
      'name' => $this->randomName(),
      'machine_name' => drupal_strtolower($this->randomName()),
      'xmlsitemap[status]' => '1',
      'xmlsitemap[priority]' => '1.0',
    );
    $this->drupalPost('admin/structure/taxonomy/add', $edit, 'Save');
    $this->assertText("Created new vocabulary {$edit['name']}.");

    $vocabularies = taxonomy_vocabulary_get_names();
    $vid = $vocabularies[$edit['machine_name']]->vid;
    $vocabulary = taxonomy_vocabulary_load($vid);

    $edit = array(
      'name' => $this->randomName(),
      'xmlsitemap[status]' => 'default',
      'xmlsitemap[priority]' => 'default',
    );
    $this->drupalPost("admin/structure/taxonomy/{$vocabulary->machine_name}/add", $edit, 'Save');
  }
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal xmlsitemap_taxonomy.test source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.