From 31f4c32fb0c7f288d83d1e2f1842b01ab1eb78d1 Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Thu, 2 Oct 2014 21:34:09 -0400 Subject: [PATCH] Reworked test to check for PHP version `password_hash` is PHP 5.5. Instead of adding the sanity check in the code, I've opted to put it in the test to ditch the overhead of having to make that check for every request. --- src/Resource.php | 2 +- tests/ResourceTest.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Resource.php b/src/Resource.php index 78a49cf..0539031 100644 --- a/src/Resource.php +++ b/src/Resource.php @@ -177,7 +177,7 @@ class Resource extends Object if ($function == 'password_hash') { - $global[$variable] = \password_hash($value, PASSWORD_DEFAULT); + $global[$variable] = password_hash($value, PASSWORD_DEFAULT); } else { diff --git a/tests/ResourceTest.php b/tests/ResourceTest.php index 78cbfed..42e156e 100644 --- a/tests/ResourceTest.php +++ b/tests/ResourceTest.php @@ -144,10 +144,19 @@ namespace 'regex' => 'abc', ]; + if (version_compare(PHP_VERSION, '5.5.0', '<')) + { + unset($_GET['bar']); + } + new Pickles\Router(); $this->assertEquals('bar', $_GET['foo']); - $this->assertFalse('unencrypted' == $_GET['bar']); + + if (version_compare(PHP_VERSION, '5.5.0', '<')) + { + $this->assertFalse('unencrypted' == $_GET['bar']); + } } public function testHTTPS()