GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : 134.29.175.74  /  Your IP : 216.73.216.160
Web Server : nginx/1.10.2
System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586
User : Administrator ( 0)
PHP Version : 7.1.0
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/nginx/html/Student/JimMartinson/Lab12/drupal/core/tests/Drupal/Tests/Component/Uuid/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/nginx/html/Student/JimMartinson/Lab12/drupal/core/tests/Drupal/Tests/Component/Uuid/UuidTest.php
<?php

namespace Drupal\Tests\Component\Uuid;

use Drupal\Component\Uuid\Uuid;
use Drupal\Component\Uuid\UuidInterface;
use Drupal\Component\Uuid\Com;
use Drupal\Component\Uuid\Pecl;
use Drupal\Component\Uuid\Php;
use Drupal\Tests\UnitTestCase;

/**
 * Tests the handling of Universally Unique Identifiers (UUIDs).
 *
 * @group Uuid
 */
class UuidTest extends UnitTestCase {

  /**
   * Tests generating valid UUIDs.
   *
   * @dataProvider providerUuidInstances
   */
  public function testGenerateUuid(UuidInterface $instance) {
    $this->assertTrue(Uuid::isValid($instance->generate()), sprintf('UUID generation for %s works.', get_class($instance)));
  }

  /**
   * Tests that generated UUIDs are unique.
   *
   * @dataProvider providerUuidInstances
   */
  public function testUuidIsUnique(UuidInterface $instance) {
    $this->assertNotEquals($instance->generate(), $instance->generate(), sprintf('Same UUID was not generated twice with %s.', get_class($instance)));
  }

  /**
   * Dataprovider for UUID instance tests.
   *
   * @return array
   */
  public function providerUuidInstances() {

    $instances = [];
    $instances[][] = new Php();

    // If valid PECL extensions exists add to list.
    if (function_exists('uuid_create') && !function_exists('uuid_make')) {
      $instances[][] = new Pecl();
    }

    // If we are on Windows add the com implementation as well.
    if (function_exists('com_create_guid')) {
      $instances[][] = new Com();
    }

    return $instances;
  }

  /**
   * Tests UUID validation.
   *
   * @param string $uuid
   *   The uuid to check against.
   * @param bool $is_valid
   *   Whether the uuid is valid or not.
   * @param string $message
   *   The message to display on failure.
   *
   * @dataProvider providerTestValidation
   */
  public function testValidation($uuid, $is_valid, $message) {
    $this->assertSame($is_valid, Uuid::isValid($uuid), $message);
  }

  /**
   * Dataprovider for UUID instance tests.
   *
   * @return array
   *   An array of arrays containing
   *   - The Uuid to check against.
   *   - (bool) Whether or not the Uuid is valid.
   *   - Failure message.
   */
  public function providerTestValidation() {
    return [
      // These valid UUIDs.
      ['6ba7b810-9dad-11d1-80b4-00c04fd430c8', TRUE, 'Basic FQDN UUID did not validate'],
      ['00000000-0000-0000-0000-000000000000', TRUE, 'Minimum UUID did not validate'],
      ['ffffffff-ffff-ffff-ffff-ffffffffffff', TRUE, 'Maximum UUID did not validate'],
      // These are invalid UUIDs.
      ['0ab26e6b-f074-4e44-9da-601205fa0e976', FALSE, 'Invalid format was validated'],
      ['0ab26e6b-f074-4e44-9daf-1205fa0e9761f', FALSE, 'Invalid length was validated'],
    ];
  }

}

Anon7 - 2022
AnonSec Team