You are here

public function UUIDAPITestCase::testApiFunctions in Universally Unique IDentifier 7

Tests uuid function calls.

File

./uuid.test, line 48
Test suite for UUID module.

Class

UUIDAPITestCase
Tests the UUID API functions.

Code

public function testApiFunctions() {

  // This is a valid UUID, we know that.
  $valid_uuid = '0ab26e6b-f074-4e44-9da6-1205fa0e9761';

  // Test the uuid_is_valid() function.
  $this
    ->assertUuid($valid_uuid, 'UUID validation works.');

  // The default generator is 'php'.
  $uuid = uuid_generate();
  $this
    ->assertUuid($uuid, 'PHP generator works.');

  // Test the 'mysql' generator.
  variable_set('uuid_generator', 'mysql');
  drupal_static_reset('uuid_generate');
  $uuid = uuid_generate();
  $this
    ->assertUuid($uuid, 'MySQL generator works.');
}