Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/cydrobolt/polr.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChaoyi Zha <summermontreal@gmail.com>2016-02-14 07:06:09 +0300
committerChaoyi Zha <summermontreal@gmail.com>2016-02-14 07:06:09 +0300
commit73617a2fe7a628924f79530c5f568a93fc1a6b70 (patch)
tree1f5c1e0daa6fe87b514f64860fe292c1764b72bb
parent10cbd908835a0c91a511ff80c0da1b6e7f696f10 (diff)
Add BaseHelperTest
-rw-r--r--.travis.yml1
-rw-r--r--tests/BaseHelperTest.php39
2 files changed, 39 insertions, 1 deletions
diff --git a/.travis.yml b/.travis.yml
index 0006510..bc7dbf0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,5 @@
language: php
php:
- - '5.5'
- '5.6'
- '7.0'
services:
diff --git a/tests/BaseHelperTest.php b/tests/BaseHelperTest.php
new file mode 100644
index 0000000..a40551a
--- /dev/null
+++ b/tests/BaseHelperTest.php
@@ -0,0 +1,39 @@
+<?php
+use App\Helpers\BaseHelper;
+
+class BaseHelperTest extends TestCase
+{
+ /**
+ * Test BaseHelper
+ *
+ * @return void
+ */
+
+ private static function checkBaseGen($num) {
+ $toBase32 = BaseHelper::toBase($num, 32);
+ $toBase62 = BaseHelper::toBase($num, 62);
+
+ $fromBase32 = BaseHelper::toBase10($toBase32, 32);
+ $fromBase62 = BaseHelper::toBase10($toBase62, 62);
+
+ if ($fromBase62 == $num && $fromBase32 == $num) {
+ return true;
+ }
+ return false;
+ }
+ public function testLogin() {
+ $nums = [
+ 523002,
+ 1204,
+ 23,
+ 0,
+ 1,
+ 45
+ ];
+
+ foreach ($nums as $n) {
+ $this->assertEquals(true, self::checkBaseGen($n));
+ }
+
+ }
+}