From 6cf599781a0e2f3c83262c6939ac2a8c41a67987 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 27 May 2018 14:10:54 +0200 Subject: [PATCH] corrected test case of expired paste to use the API --- tst/PrivateBinTest.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tst/PrivateBinTest.php b/tst/PrivateBinTest.php index c10f13ae..3caf0866 100644 --- a/tst/PrivateBinTest.php +++ b/tst/PrivateBinTest.php @@ -716,15 +716,14 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase $expiredPaste = Helper::getPaste(array('expire_date' => 1344803344)); $this->_model->create(Helper::getPasteId(), $expiredPaste); $_SERVER['QUERY_STRING'] = Helper::getPasteId(); + $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; ob_start(); new PrivateBin; $content = ob_get_contents(); ob_end_clean(); - $this->assertRegExp( - '#]*id="errormessage"[^>]*>.*Paste does not exist, has expired or has been deleted\.#s', - $content, - 'outputs error correctly' - ); + $response = json_decode($content, true); + $this->assertEquals(1, $response['status'], 'outputs error status'); + $this->assertEquals('Paste does not exist, has expired or has been deleted.', $response['message'], 'outputs error message'); } /**