From 30e6f1ca2f4278f542cde625f8152c7be3551ed4 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Wed, 24 Jun 2015 11:47:36 +0200 Subject: [PATCH] Fixes unit tests: checking datastore filesize instead of hash. date() makes the hash validation worthless because it changes at every generation. --- tests/LinkDBTest.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/LinkDBTest.php b/tests/LinkDBTest.php index f67d4d9..3b68dd2 100644 --- a/tests/LinkDBTest.php +++ b/tests/LinkDBTest.php @@ -18,7 +18,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase { // datastore to test write operations protected static $testDatastore = 'tests/datastore.php'; - protected static $dummyDatastoreSHA1 = 'e3edea8ea7bb50be4bcb404df53fbb4546a7156e'; + protected static $dummyDatastoreFilesize = 759; protected static $refDB = null; protected static $publicLinkDB = null; protected static $privateLinkDB = null; @@ -116,8 +116,8 @@ class LinkDBTest extends PHPUnit_Framework_TestCase // ensure the correct data has been written $this->assertEquals( - self::$dummyDatastoreSHA1, - sha1_file(self::$testDatastore) + self::$dummyDatastoreFilesize, + filesize(self::$testDatastore) ); } @@ -128,8 +128,8 @@ class LinkDBTest extends PHPUnit_Framework_TestCase { $linkDB = new LinkDB(false, false); $this->assertEquals( - self::$dummyDatastoreSHA1, - sha1_file(self::$testDatastore) + self::$dummyDatastoreFilesize, + filesize(self::$testDatastore) ); $checkDB = self::getMethod('checkDB'); @@ -137,8 +137,8 @@ class LinkDBTest extends PHPUnit_Framework_TestCase // ensure the datastore is left unmodified $this->assertEquals( - self::$dummyDatastoreSHA1, - sha1_file(self::$testDatastore) + self::$dummyDatastoreFilesize, + filesize(self::$testDatastore) ); }