]> git.andy128k.dev Git - missing-tools.git/commitdiff
introduce namespace PFF. version 0.2
authorAndrey Kutejko <andy128k@gmail.com>
Tue, 17 Dec 2013 19:24:11 +0000 (21:24 +0200)
committerAndrey Kutejko <andy128k@gmail.com>
Tue, 17 Dec 2013 19:24:11 +0000 (21:24 +0200)
19 files changed:
composer.json
src/array.php [new file with mode: 0644]
src/arraytools.php [deleted file]
src/collection.php [new file with mode: 0644]
src/collectiontools.php [deleted file]
src/dateformat.php
src/htmlbuilder.php
src/mixins.php
src/regexp.php
src/str.php [new file with mode: 0644]
src/stringtools.php [deleted file]
t/ArrTest.php [new file with mode: 0644]
t/ArrayTest.php [deleted file]
t/CollectionTest.php
t/FormatTest.php
t/HtmlBuilderTest.php
t/MixinsTest.php
t/StrTest.php [new file with mode: 0644]
t/StringTest.php [deleted file]

index 73108ec2d3d22f3a043b566781cc327736cb2e9d..b921b8312566d73345a5fc6f7727db38c2506678 100644 (file)
@@ -26,7 +26,7 @@
   ],
   "extra": {
     "branch-alias": {
-      "dev-master": "0.1-dev"
+      "dev-master": "0.2-dev"
     }
   }
 }
diff --git a/src/array.php b/src/array.php
new file mode 100644 (file)
index 0000000..e11671c
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+
+namespace PFF;
+
+final class Arr
+{
+    public static function get($array, $key, $default=null)
+    {
+        if (array_key_exists($key, $array))
+            return $array[$key];
+        else
+            return $default;
+    }
+
+    public static function ensureKeyExists(&$array, $key, $default=null)
+    {
+        if (!array_key_exists($key, $array))
+            return $array[$key] = $default;
+    }
+
+    public static function pushToKey(&$array, $key, $value)
+    {
+        if (array_key_exists($key, $array))
+            return $array[$key][] = $value;
+        else
+            return $array[$key] = array($value);
+    }
+
+    public static function pop(&$array, $key, $default=null)
+    {
+        if (array_key_exists($key, $array)) {
+            $value = $array[$key];
+            unset($array[$key]);
+            return $value;
+        } else {
+            return $default;
+        }
+    }
+
+    public static function flatten($array)
+    {
+        $result = array();
+        array_walk_recursive($array, function ($value) use (&$result) {
+            $result[] = $value;
+        });
+        return $result;
+    }
+}
+
diff --git a/src/arraytools.php b/src/arraytools.php
deleted file mode 100644 (file)
index 3550f3c..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-final class ArrayTools
-{
-    public static function get($array, $key, $default=null)
-    {
-        if (array_key_exists($key, $array))
-            return $array[$key];
-        else
-            return $default;
-    }
-
-    public static function ensureKeyExists(&$array, $key, $default=null)
-    {
-        if (!array_key_exists($key, $array))
-            return $array[$key] = $default;
-    }
-
-    public static function pushToKey(&$array, $key, $value)
-    {
-        if (array_key_exists($key, $array))
-            return $array[$key][] = $value;
-        else
-            return $array[$key] = array($value);
-    }
-
-    public static function pop(&$array, $key, $default=null)
-    {
-        if (array_key_exists($key, $array)) {
-            $value = $array[$key];
-            unset($array[$key]);
-            return $value;
-        } else {
-            return $default;
-        }
-    }
-}
-
diff --git a/src/collection.php b/src/collection.php
new file mode 100644 (file)
index 0000000..9c51f9b
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+
+namespace PFF;
+
+final class Collection
+{
+    /*
+     * Example output:
+     *    1   4   7   9
+     *    2   5   8  10
+     *    3   6
+     */
+    public static function columns($collection, $columnsCount)
+    {
+        $count = count($collection);
+        $r = $count % $columnsCount;
+        $length = ($count - $r) / $columnsCount;
+
+        $columnLengths = array();
+        for ($i = 0; $i < $columnsCount; ++$i) {
+            $columnLengths[] = $length + ($i < $r ? 1 : 0);
+        }
+
+        $column = array();
+        $columnIndex = 0;
+        foreach ($collection as $item) {
+            if (count($column) >= $columnLengths[$columnIndex]) {
+                $columns[] = $column;
+                $column = array();
+                $columnIndex++;
+            }
+            $column[] = $item;
+        }
+        $columns[] = $column;
+        return $columns;
+    }
+
+    public static function chunks($collection, $size, $pad=false)
+    {
+        $result = array();
+        $chunk = array();
+        foreach ($collection as $item) {
+            $chunk[] = $item;
+            if (count($chunk) === $size) {
+                $result[] = $chunk;
+                $chunk = array();
+            }
+        }
+        $c = count($chunk);
+        if ($c != 0) {
+            if ($pad) {
+                while ($c < $size) {
+                    $chunk[] = null;
+                    ++$c;
+                }
+            }
+            $result[] = $chunk;
+        }
+        return $result;
+    }
+}
+
diff --git a/src/collectiontools.php b/src/collectiontools.php
deleted file mode 100644 (file)
index fd62b2a..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-
-final class Collections
-{
-    /*
-     * Example output:
-     *    1   4   7   9
-     *    2   5   8  10
-     *    3   6
-     */
-    public static function columns($collection, $columnsCount)
-    {
-        $count = count($collection);
-        $r = $count % $columnsCount;
-        $length = ($count - $r) / $columnsCount;
-
-        $columnLengths = array();
-        for ($i = 0; $i < $columnsCount; ++$i) {
-            $columnLengths[] = $length + ($i < $r ? 1 : 0);
-        }
-
-        $column = array();
-        $columnIndex = 0;
-        foreach ($collection as $item) {
-            if (count($column) >= $columnLengths[$columnIndex]) {
-                $columns[] = $column;
-                $column = array();
-                $columnIndex++;
-            }
-            $column[] = $item;
-        }
-        $columns[] = $column;
-        return $columns;
-    }
-
-    public static function chunks($collection, $size, $pad=false)
-    {
-        $result = array();
-        $chunk = array();
-        foreach ($collection as $item) {
-            $chunk[] = $item;
-            if (count($chunk) === $size) {
-                $result[] = $chunk;
-                $chunk = array();
-            }
-        }
-        $c = count($chunk);
-        if ($c != 0) {
-            if ($pad) {
-                while ($c < $size) {
-                    $chunk[] = null;
-                    ++$c;
-                }
-            }
-            $result[] = $chunk;
-        }
-        return $result;
-    }
-}
-
index 3032fbfee547098bb6eeba2d8d72229be7fc496f..8bb76a2dd86d3e8f6ac7d7234c00334e73d3aeac 100644 (file)
@@ -1,5 +1,9 @@
 <?php
 
+namespace PFF;
+
+use \Pegp as Pegp;
+
 final class DateFormat
 {
     const DATE_BIG_ENDIAN     =  0;
index 6b4aa4f14fc65dc36cf16a1fa370a34a4081d0f2..d0dee2405f32d8aad568b149857e98db6cd8b152 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace HtmlBuilder;
+namespace PFF\HtmlBuilder;
 
 class Tag
 {
index 78897b8f33a6776c5a8758a915d6f3c16a39bb6c..b0b8f03bd3a3d603baf6a906a53b995e376bcde2 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+namespace PFF;
+
 class Mixins
 {
     private $methods = array();
index 7ccb64a7d5aeb29a8ae2b886b3156eb78cd9dc4e..57411a38cba1cade19f0983ae4590e0ee68b913e 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+namespace PFF;
+
 class Regexp
 {
     public static function email()
diff --git a/src/str.php b/src/str.php
new file mode 100644 (file)
index 0000000..3178584
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+namespace PFF;
+
+final class Str
+{
+    public static function startsWith($haystack, $needle)
+    {
+        return !strncmp($haystack, $needle, strlen($needle));
+    }
+
+    public static function endsWith($haystack, $needle)
+    {
+        $length = strlen($needle);
+        return !$length || substr($haystack, -$length) === $needle;
+    }
+}
+
diff --git a/src/stringtools.php b/src/stringtools.php
deleted file mode 100644 (file)
index 871afee..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-final class StringTools
-{
-    public static function startsWith($haystack, $needle)
-    {
-        return !strncmp($haystack, $needle, strlen($needle));
-    }
-
-    public static function endsWith($haystack, $needle)
-    {
-        $length = strlen($needle);
-        return !$length || substr($haystack, -$length) === $needle;
-    }
-}
-
diff --git a/t/ArrTest.php b/t/ArrTest.php
new file mode 100644 (file)
index 0000000..e0def0c
--- /dev/null
@@ -0,0 +1,69 @@
+<?php
+
+class ArrTest extends PHPUnit_Framework_TestCase
+{
+    public function testGet()
+    {
+        $arr = array(
+            'apple' => 100,
+            'grapefruit' => 400,
+            'carrot' => 50,
+        );
+
+        $this->assertEquals(400, \PFF\Arr::get($arr, 'grapefruit'));
+        $this->assertEquals(null, \PFF\Arr::get($arr, 'orange'));
+        $this->assertEquals('no-oranges', \PFF\Arr::get($arr, 'orange', 'no-oranges'));
+    }
+
+    public function testEnsureKeyExists()
+    {
+        $arr = array(
+            'apple' => 100,
+            'grapefruit' => 400,
+            'carrot' => 50,
+        );
+
+        $this->assertEquals(false, array_key_exists('orange', $arr));
+        \PFF\Arr::ensureKeyExists($arr, 'orange');
+        $this->assertEquals(true, array_key_exists('orange', $arr));
+    }
+
+    public function testPushToKey()
+    {
+        $arr = array('carrot' => array('orange'));
+
+        \PFF\Arr::pushToKey($arr, 'apple', 'green');
+        \PFF\Arr::pushToKey($arr, 'carrot', 'long');
+        \PFF\Arr::pushToKey($arr, 'apple', 'sweet');
+
+        $this->assertEquals(array('green', 'sweet'), $arr['apple']);
+        $this->assertEquals(array('orange', 'long'), $arr['carrot']);
+    }
+
+    public function testPop()
+    {
+        $arr = array(
+            'apple' => 100,
+            'grapefruit' => 400,
+            'carrot' => 50,
+        );
+
+        $apple = \PFF\Arr::pop($arr, 'apple');
+        $this->assertEquals(false, array_key_exists('apple', $arr));
+        $this->assertEquals(100, $apple);
+
+        $apple = \PFF\Arr::pop($arr, 'apple');
+        $this->assertEquals(null, $apple);
+
+        $apple = \PFF\Arr::pop($arr, 'apple', 'what?');
+        $this->assertEquals('what?', $apple);
+    }
+
+    public function testFlatten()
+    {
+        $arr = array('a', 'b', array(array(array('x'), 'y', 'z')), array(array('p')));
+        $flat = \PFF\Arr::flatten($arr);
+        $this->assertEquals(array('a', 'b', 'x', 'y', 'z', 'p'), $flat);
+    }
+}
+
diff --git a/t/ArrayTest.php b/t/ArrayTest.php
deleted file mode 100644 (file)
index de15380..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-class ArrayToolsTest extends PHPUnit_Framework_TestCase
-{
-    public function testGet()
-    {
-        $arr = array(
-            'apple' => 100,
-            'grapefruit' => 400,
-            'carrot' => 50,
-        );
-
-        $this->assertEquals(400, ArrayTools::get($arr, 'grapefruit'));
-        $this->assertEquals(null, ArrayTools::get($arr, 'orange'));
-        $this->assertEquals('no-oranges', ArrayTools::get($arr, 'orange', 'no-oranges'));
-    }
-
-    public function testEnsureKeyExists()
-    {
-        $arr = array(
-            'apple' => 100,
-            'grapefruit' => 400,
-            'carrot' => 50,
-        );
-
-        $this->assertEquals(false, array_key_exists('orange', $arr));
-        ArrayTools::ensureKeyExists($arr, 'orange');
-        $this->assertEquals(true, array_key_exists('orange', $arr));
-    }
-
-    public function testPushToKey()
-    {
-        $arr = array('carrot' => array('orange'));
-
-        ArrayTools::pushToKey($arr, 'apple', 'green');
-        ArrayTools::pushToKey($arr, 'carrot', 'long');
-        ArrayTools::pushToKey($arr, 'apple', 'sweet');
-
-        $this->assertEquals(array('green', 'sweet'), $arr['apple']);
-        $this->assertEquals(array('orange', 'long'), $arr['carrot']);
-    }
-
-    public function testPop()
-    {
-        $arr = array(
-            'apple' => 100,
-            'grapefruit' => 400,
-            'carrot' => 50,
-        );
-
-        $apple = ArrayTools::pop($arr, 'apple');
-        $this->assertEquals(false, array_key_exists('apple', $arr));
-        $this->assertEquals(100, $apple);
-
-        $apple = ArrayTools::pop($arr, 'apple');
-        $this->assertEquals(null, $apple);
-
-        $apple = ArrayTools::pop($arr, 'apple', 'what?');
-        $this->assertEquals('what?', $apple);
-    }
-}
-
index dcf952f3e9abc2a60a2f4646b6fbac368057a23e..4005b03a91d9c343f2f0663af0de4fcb6937fd2f 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-class CollectionsTest extends PHPUnit_Framework_TestCase
+class CollectionTest extends PHPUnit_Framework_TestCase
 {
     public function testColumns()
     {
@@ -10,7 +10,7 @@ class CollectionsTest extends PHPUnit_Framework_TestCase
             'carrot',
             'tomato',
         );
-        $columns = Collections::columns($arr, 3);
+        $columns = \PFF\Collection::columns($arr, 3);
         $this->assertEquals(3, count($columns));
         $this->assertEquals(2, count($columns[0]));
         $this->assertEquals(1, count($columns[1]));
@@ -25,7 +25,7 @@ class CollectionsTest extends PHPUnit_Framework_TestCase
             'carrot',
             'tomato',
         );
-        $chunks = Collections::chunks($arr, 3);
+        $chunks = \PFF\Collection::chunks($arr, 3);
         $this->assertEquals(2, count($chunks));
         $this->assertEquals(3, count($chunks[0]));
         $this->assertEquals(1, count($chunks[1]));
@@ -39,7 +39,7 @@ class CollectionsTest extends PHPUnit_Framework_TestCase
             'carrot',
             'tomato',
         );
-        $chunks = Collections::chunks($arr, 3, true);
+        $chunks = \PFF\Collection::chunks($arr, 3, true);
         $this->assertEquals(2, count($chunks));
         $this->assertEquals(3, count($chunks[0]));
         $this->assertEquals(3, count($chunks[1]));
index 2f6245f812021d77f5b69f43597584473a97ec1a..a600516fad0f96cd8d6f07f3ec67b20c4ded216d 100644 (file)
@@ -1,36 +1,36 @@
 <?php
 
-class Format_Test extends PHPUnit_Framework_TestCase
+class FormatTest extends PHPUnit_Framework_TestCase
 {
     public function testFlags()
     {
-        $this->assertEquals(DateFormat::DATE_DEFAULT,  DateFormat::DATE_BIG_ENDIAN    | DateFormat::DATE_HYPHENS);
-        $this->assertEquals(DateFormat::DATE_US,       DateFormat::DATE_MIDDLE_ENDIAN | DateFormat::DATE_SLASHES);
-        $this->assertEquals(DateFormat::DATE_EUROPEAN, DateFormat::DATE_LITTLE_ENDIAN | DateFormat::DATE_DOTS);
+        $this->assertEquals(\PFF\DateFormat::DATE_DEFAULT,  \PFF\DateFormat::DATE_BIG_ENDIAN    | \PFF\DateFormat::DATE_HYPHENS);
+        $this->assertEquals(\PFF\DateFormat::DATE_US,       \PFF\DateFormat::DATE_MIDDLE_ENDIAN | \PFF\DateFormat::DATE_SLASHES);
+        $this->assertEquals(\PFF\DateFormat::DATE_EUROPEAN, \PFF\DateFormat::DATE_LITTLE_ENDIAN | \PFF\DateFormat::DATE_DOTS);
     }
 
     public function testDateFlagsFromString()
     {
-        $this->assertEquals(DateFormat::DATE_DEFAULT,  DateFormat::dateFlagsFromString('Default'));
-        $this->assertEquals(DateFormat::DATE_DEFAULT,  DateFormat::dateFlagsFromString('Big-endian hyphEns'));
-        $this->assertEquals(DateFormat::DATE_EUROPEAN, DateFormat::dateFlagsFromString('European'));
-        $this->assertEquals(DateFormat::DATE_EUROPEAN, DateFormat::dateFlagsFromString('little-endian dots'));
-        $this->assertEquals(DateFormat::DATE_US,       DateFormat::dateFlagsFromString('US'));
-        $this->assertEquals(DateFormat::DATE_US,       DateFormat::dateFlagsFromString('Middle-Endian Slashes'));
-        $this->assertEquals(DateFormat::DATE_BIG_ENDIAN | DateFormat::DATE_SPACES,
-                                                       DateFormat::dateFlagsFromString('big-endian spaces'));
+        $this->assertEquals(\PFF\DateFormat::DATE_DEFAULT,  \PFF\DateFormat::dateFlagsFromString('Default'));
+        $this->assertEquals(\PFF\DateFormat::DATE_DEFAULT,  \PFF\DateFormat::dateFlagsFromString('Big-endian hyphEns'));
+        $this->assertEquals(\PFF\DateFormat::DATE_EUROPEAN, \PFF\DateFormat::dateFlagsFromString('European'));
+        $this->assertEquals(\PFF\DateFormat::DATE_EUROPEAN, \PFF\DateFormat::dateFlagsFromString('little-endian dots'));
+        $this->assertEquals(\PFF\DateFormat::DATE_US,       \PFF\DateFormat::dateFlagsFromString('US'));
+        $this->assertEquals(\PFF\DateFormat::DATE_US,       \PFF\DateFormat::dateFlagsFromString('Middle-Endian Slashes'));
+        $this->assertEquals(\PFF\DateFormat::DATE_BIG_ENDIAN | \PFF\DateFormat::DATE_SPACES,
+                                                               \PFF\DateFormat::dateFlagsFromString('big-endian spaces'));
     }
 
     public function testDatetimeFlagsFromString()
     {
-        $this->assertEquals(DateFormat::DATETIME_DEFAULT,  DateFormat::datetimeFlagsFromString('Default'));
-        $this->assertEquals(DateFormat::DATETIME_DEFAULT,  DateFormat::datetimeFlagsFromString('Big-endian hyphEns 24'));
-        $this->assertEquals(DateFormat::DATETIME_EUROPEAN, DateFormat::datetimeFlagsFromString('European'));
-        $this->assertEquals(DateFormat::DATETIME_EUROPEAN, DateFormat::datetimeFlagsFromString('little-endian dots 24'));
-        $this->assertEquals(DateFormat::DATETIME_US,       DateFormat::datetimeFlagsFromString('US'));
-        $this->assertEquals(DateFormat::DATETIME_US,       DateFormat::datetimeFlagsFromString('Middle-Endian Slashes 12-upper'));
-        $this->assertEquals(DateFormat::DATE_BIG_ENDIAN | DateFormat::DATE_SPACES | DateFormat::TIME_12HOURS_LOWER | DateFormat::TIME_SECONDS,
-                                                           DateFormat::datetimeFlagsFromString("big-endian spaces \n 12-lower Seconds"));
+        $this->assertEquals(\PFF\DateFormat::DATETIME_DEFAULT,  \PFF\DateFormat::datetimeFlagsFromString('Default'));
+        $this->assertEquals(\PFF\DateFormat::DATETIME_DEFAULT,  \PFF\DateFormat::datetimeFlagsFromString('Big-endian hyphEns 24'));
+        $this->assertEquals(\PFF\DateFormat::DATETIME_EUROPEAN, \PFF\DateFormat::datetimeFlagsFromString('European'));
+        $this->assertEquals(\PFF\DateFormat::DATETIME_EUROPEAN, \PFF\DateFormat::datetimeFlagsFromString('little-endian dots 24'));
+        $this->assertEquals(\PFF\DateFormat::DATETIME_US,       \PFF\DateFormat::datetimeFlagsFromString('US'));
+        $this->assertEquals(\PFF\DateFormat::DATETIME_US,       \PFF\DateFormat::datetimeFlagsFromString('Middle-Endian Slashes 12-upper'));
+        $this->assertEquals(\PFF\DateFormat::DATE_BIG_ENDIAN | \PFF\DateFormat::DATE_SPACES | \PFF\DateFormat::TIME_12HOURS_LOWER | \PFF\DateFormat::TIME_SECONDS,
+                                                               \PFF\DateFormat::datetimeFlagsFromString("big-endian spaces \n 12-lower Seconds"));
     }
 }
 
index 3892193ac8e658ffc6280f23fb7c469c23b18038..bdef45dc4677dc21493eb1bc3f1a10c49106ec75 100644 (file)
@@ -4,9 +4,9 @@ class HtmlBuilderTest extends PHPUnit_Framework_TestCase
 {
     public function testTag()
     {
-        $tag = HtmlBuilder\Tag::div(array('class' => 'container'))
+        $tag = \PFF\HtmlBuilder\Tag::div(array('class' => 'container'))
             ->append('Hello, "World"')
-            ->append(HtmlBuilder\Tag::a()->append('click ')->raw('<b>me</b>'));
+            ->append(\PFF\HtmlBuilder\Tag::a()->append('click ')->raw('<b>me</b>'));
 
         $this->assertEquals('<div class="container">Hello, &quot;World&quot;<a>click <b>me</b></a></div>', (string)$tag);
     }
index d634305549fb4768c196b43b544b60db9ec8e519..fb0970c43ec7b161aa377e99b23a4b7173647223 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-class SomeMixin extends Mixin
+class SomeMixin extends \PFF\Mixin
 {
     public function getSmthUseful()
     {
@@ -13,7 +13,7 @@ class SomeMixin extends Mixin
     }
 }
 
-class WrapMixin extends Mixin
+class WrapMixin extends \PFF\Mixin
 {
     public function getSmthUseful()
     {
@@ -26,7 +26,7 @@ class WrapMixin extends Mixin
     }
 }
 
-class Mixture extends Mixable
+class Mixture extends \PFF\Mixable
 {
     protected function __mixins() { return array('SomeMixin', 'WrapMixin'); }
 
diff --git a/t/StrTest.php b/t/StrTest.php
new file mode 100644 (file)
index 0000000..adf76f2
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+class StrTest extends PHPUnit_Framework_TestCase
+{
+    public function testStartsWith()
+    {
+        $this->assertTrue(\PFF\Str::startsWith('abcdef', 'abc'));
+        $this->assertFalse(\PFF\Str::startsWith(' abcdef', 'abc'));
+        $this->assertFalse(\PFF\Str::startsWith('abc', 'abcdef'));
+        $this->assertTrue(\PFF\Str::startsWith('abc', 'abc'));
+        $this->assertTrue(\PFF\Str::startsWith('abc', ''));
+        $this->assertFalse(\PFF\Str::startsWith('abc', ' '));
+    }
+
+    public function testEndsWith()
+    {
+        $this->assertTrue(\PFF\Str::endsWith('abcdef', 'def'));
+        $this->assertFalse(\PFF\Str::endsWith('abcdef ', 'def'));
+        $this->assertFalse(\PFF\Str::endsWith('abc', 'abcdef'));
+        $this->assertTrue(\PFF\Str::endsWith('abc', 'abc'));
+        $this->assertTrue(\PFF\Str::endsWith('abc', ''));
+        $this->assertFalse(\PFF\Str::endsWith('abc', ' '));
+    }
+}
+
diff --git a/t/StringTest.php b/t/StringTest.php
deleted file mode 100644 (file)
index e2c5eaf..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-class StringToolsTest extends PHPUnit_Framework_TestCase
-{
-    public function testStartsWith()
-    {
-        $this->assertTrue(StringTools::startsWith('abcdef', 'abc'));
-        $this->assertFalse(StringTools::startsWith(' abcdef', 'abc'));
-        $this->assertFalse(StringTools::startsWith('abc', 'abcdef'));
-        $this->assertTrue(StringTools::startsWith('abc', 'abc'));
-        $this->assertTrue(StringTools::startsWith('abc', ''));
-        $this->assertFalse(StringTools::startsWith('abc', ' '));
-    }
-
-    public function testEndsWith()
-    {
-        $this->assertTrue(StringTools::endsWith('abcdef', 'def'));
-        $this->assertFalse(StringTools::endsWith('abcdef ', 'def'));
-        $this->assertFalse(StringTools::endsWith('abc', 'abcdef'));
-        $this->assertTrue(StringTools::endsWith('abc', 'abc'));
-        $this->assertTrue(StringTools::endsWith('abc', ''));
-        $this->assertFalse(StringTools::endsWith('abc', ' '));
-    }
-}
-