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

Drupal example source code file (uc_store.test)

This example Drupal source code file (uc_store.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, country_code, country_name, directory, file, function, import_file, imported, in, is, not, option, php, value

The uc_store.test Drupal example source code

// $Id: uc_store.test,v 2009/07/21 14:37:21 islandusurper Exp $

 * @file
 * Test functionality provided by uc_store.

 * Test the country import and update functions.
class UCCountriesTestCase extends DrupalWebTestCase {

  function getInfo() {
    return array(
      'name' => t('Country functionality'),
      'description' => t('Import, edit, and remove countries and their settings.'),
      'group' => t('Ubercart'),

  function setUp() {
    parent::setUp('token', 'uc_store');

    $admin_user = $this->drupalCreateUser(array('administer store'));

  function testCountry() {
    $import_file = 'belgium_56_3.cif';
    $country_name = 'Belgium';
    $country_code = 'BEL';

    $this->assertRaw('<option value="'. $import_file .'">'. $import_file .'</option>', t('Ensure country file is not imported yet.'));

    $edit = array(
      'import_file[]' => array($import_file => $import_file),
    $this->drupalPost('admin/store/settings/countries/edit', $edit, t('Import'));
    $this->assertText(t('Country file @file imported.', array('@file' => $import_file)), t('Country was imported successfully.'));
    $this->assertText($country_code, t('Country appears in the imported countries table.'));
    $this->assertNoRaw('<option value="'. $import_file .'">'. $import_file .'</option>', t('Country does not appear in list of files to be imported.'));

    $this->assertText(t('@name disabled.', array('@name' => $country_name)), t('Country was disabled.'));

    $this->assertText(t('@name enabled.', array('@name' => $country_name)), t('Country was enabled.'));

    $this->assertText(t('Are you sure you want to remove @name from the system?', array('@name' => $country_name)), t('Confirm form is displayed.'));

    $this->drupalPost('admin/store/settings/countries/56/remove', array(), t('Remove'));
    $this->assertText(t('@name removed.', array('@name' => $country_name)), t('Country removed.'));
    $this->assertRaw('<option value="'. $import_file .'">'. $import_file .'</option>', t('Ensure country file is not imported yet.'));
    $this->assertNoText($country_code, t('Country does not appear in imported countries table.'));


Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal uc_store.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.