Browse Source

add object to text insert test case

Jorge González 9 years ago
parent
commit
a5185ca528
1 changed files with 9 additions and 0 deletions
  1. 9 0
      tests/TestCase/Utility/TextTest.php

+ 9 - 0
tests/TestCase/Utility/TextTest.php

@@ -13,6 +13,7 @@
  */
 namespace Cake\Test\TestCase\Utility;
 
+use Cake\I18n\Time;
 use Cake\TestSuite\TestCase;
 use Cake\Utility\Text;
 
@@ -229,6 +230,14 @@ class TextTest extends TestCase
         $expected = 'switching 10 by 5';
         $result = Text::insert($string, ['timeout_count' => 10, 'timeout' => 5]);
         $this->assertEquals($expected, $result);
+        $string = 'inserting a :user.email';
+        $expected = 'inserting a security@example.com';
+        $result = Text::insert($string, [
+            'user.email' => 'security@example.com',
+            'user.id' => 2,
+            'user.created' => Time::parse('2016-01-01')
+        ]);
+        $this->assertEquals($expected, $result);
     }
 
     /**