From a12bbb153054f46b3ff1f6beabb9d0d8182cb849 Mon Sep 17 00:00:00 2001
From: Jaime Perez Crespo <jaime.perez@uninett.no>
Date: Wed, 27 May 2015 22:19:11 +0200
Subject: [PATCH] Add tests for SimpleSAML\Utils\Random.

---
 tests/lib/SimpleSAML/Utils/RandomTest.php | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 tests/lib/SimpleSAML/Utils/RandomTest.php

diff --git a/tests/lib/SimpleSAML/Utils/RandomTest.php b/tests/lib/SimpleSAML/Utils/RandomTest.php
new file mode 100644
index 000000000..fe82f3894
--- /dev/null
+++ b/tests/lib/SimpleSAML/Utils/RandomTest.php
@@ -0,0 +1,18 @@
+<?php
+
+
+/**
+ * Tests for SimpleSAML\Utils\Random.
+ */
+class RandomTest extends PHPUnit_Framework_TestCase
+{
+
+    public function testGenerateID()
+    {
+        // check that it always starts with an underscore
+        $this->assertStringStartsWith('_', SimpleSAML\Utils\Random::generateID());
+
+        // check the length
+        $this->assertEquals(SimpleSAML\Utils\Random::ID_LENGTH, strlen(SimpleSAML\Utils\Random::generateID()));
+    }
+}
-- 
GitLab