|
@@ -14,6 +14,7 @@
|
|
|
*/
|
|
*/
|
|
|
namespace Cake\Test\TestCase\Core;
|
|
namespace Cake\Test\TestCase\Core;
|
|
|
|
|
|
|
|
|
|
+use Cake\Http\Response;
|
|
|
use Cake\TestSuite\TestCase;
|
|
use Cake\TestSuite\TestCase;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -44,6 +45,32 @@ class FunctionsTest extends TestCase
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Test cases for h()
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @dataProvider hInputProvider
|
|
|
|
|
+ */
|
|
|
|
|
+ public function testH($value, $expected)
|
|
|
|
|
+ {
|
|
|
|
|
+ $result = h($value);
|
|
|
|
|
+ $this->assertSame($expected, $result);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function hInputProvider()
|
|
|
|
|
+ {
|
|
|
|
|
+ return [
|
|
|
|
|
+ ['i am clean', 'i am clean'],
|
|
|
|
|
+ ['i "need" escaping', 'i "need" escaping'],
|
|
|
|
|
+ [null, null],
|
|
|
|
|
+ [1, 1],
|
|
|
|
|
+ [1.1, 1.1],
|
|
|
|
|
+ [new \stdClass, '(object)stdClass'],
|
|
|
|
|
+ [new Response(), ''],
|
|
|
|
|
+ [['clean', '"clean-me'], ['clean', '"clean-me']],
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* Test error messages coming out when deprecated level is on, manually setting the stack frame
|
|
* Test error messages coming out when deprecated level is on, manually setting the stack frame
|
|
|
*
|
|
*
|
|
|
* @expectedException PHPUnit\Framework\Error\Deprecated
|
|
* @expectedException PHPUnit\Framework\Error\Deprecated
|