renaming the fork to PrivateBin
This commit is contained in:
@@ -12,5 +12,5 @@ Example for Debian and Ubuntu:
|
||||
$ sudo aptitude install phpunit php5-gd php5-sqlite php5-xdebug
|
||||
|
||||
To run the tests, just change into this directory and run phpunit:
|
||||
$ cd ZeroBin/tst
|
||||
$ cd PrivateBin/tst
|
||||
$ phpunit
|
||||
|
||||
@@ -91,7 +91,7 @@ class RainTPLTest extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
// testing version number in JS address, since other instances may not be present in different templates
|
||||
$this->assertRegExp(
|
||||
'#<script[^>]+src="js/zerobin.js\\?' . rawurlencode(self::$version) . '"[^>]*>#',
|
||||
'#<script[^>]+src="js/privatebin.js\\?' . rawurlencode(self::$version) . '"[^>]*>#',
|
||||
$this->_content,
|
||||
'outputs version correctly'
|
||||
);
|
||||
|
||||
@@ -193,7 +193,7 @@ new configurationTestGenerator(array(
|
||||
'attributes' => array(
|
||||
'type' => 'text/css',
|
||||
'rel' => 'stylesheet',
|
||||
'href' => 'regexp:#css/zerobin\.css#',
|
||||
'href' => 'regexp:#css/privatebin\.css#',
|
||||
),
|
||||
),
|
||||
'$content',
|
||||
@@ -227,7 +227,7 @@ new configurationTestGenerator(array(
|
||||
'attributes' => array(
|
||||
'type' => 'text/css',
|
||||
'rel' => 'stylesheet',
|
||||
'href' => 'regexp:#css/zerobin.css#',
|
||||
'href' => 'regexp:#css/privatebin.css#',
|
||||
),
|
||||
),
|
||||
'$content',
|
||||
@@ -474,7 +474,7 @@ class configurationCombinationsTest extends PHPUnit_Framework_TestCase
|
||||
/* Setup Routine */
|
||||
helper::confBackup();
|
||||
|
||||
$this->_model = zerobin_data::getInstance(array('dir' => PATH . 'data'));
|
||||
$this->_model = privatebin_data::getInstance(array('dir' => PATH . 'data'));
|
||||
serversalt::setPath(PATH . 'data');
|
||||
$this->reset();
|
||||
}
|
||||
@@ -564,7 +564,7 @@ EOT;
|
||||
$code .= PHP_EOL . $preString;
|
||||
$code .= <<<'EOT'
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
EOT;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class configurationTest extends PHPUnit_Framework_TestCase
|
||||
'dir' => '../data',
|
||||
),
|
||||
'model' => array(
|
||||
'class' => 'zerobin_data',
|
||||
'class' => 'privatebin_data',
|
||||
),
|
||||
'model_options' => array(
|
||||
'dir' => '../data',
|
||||
|
||||
@@ -6,7 +6,7 @@ class jsonApiTest extends PHPUnit_Framework_TestCase
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
$this->_model = zerobin_data::getInstance(array('dir' => PATH . 'data'));
|
||||
$this->_model = privatebin_data::getInstance(array('dir' => PATH . 'data'));
|
||||
serversalt::setPath(PATH . 'data');
|
||||
$this->reset();
|
||||
}
|
||||
@@ -42,7 +42,7 @@ class jsonApiTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(0, $response['status'], 'outputs status');
|
||||
@@ -76,7 +76,7 @@ class jsonApiTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REQUEST_METHOD'] = 'PUT';
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(0, $response['status'], 'outputs status');
|
||||
@@ -109,7 +109,7 @@ class jsonApiTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||
$_SERVER['REQUEST_METHOD'] = 'DELETE';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(0, $response['status'], 'outputs status');
|
||||
@@ -133,7 +133,7 @@ class jsonApiTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(0, $response['status'], 'outputs status');
|
||||
@@ -151,7 +151,7 @@ class jsonApiTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['QUERY_STRING'] = helper::getPasteId();
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(0, $response['status'], 'outputs success status');
|
||||
@@ -177,7 +177,7 @@ class jsonApiTest extends PHPUnit_Framework_TestCase
|
||||
$this->_model->create(helper::getPasteId(), $paste);
|
||||
$_GET['jsonld'] = 'paste';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertEquals(str_replace(
|
||||
'?jsonld=',
|
||||
@@ -196,7 +196,7 @@ class jsonApiTest extends PHPUnit_Framework_TestCase
|
||||
$this->_model->create(helper::getPasteId(), $paste);
|
||||
$_GET['jsonld'] = 'comment';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertEquals(str_replace(
|
||||
'?jsonld=',
|
||||
@@ -215,7 +215,7 @@ class jsonApiTest extends PHPUnit_Framework_TestCase
|
||||
$this->_model->create(helper::getPasteId(), $paste);
|
||||
$_GET['jsonld'] = 'pastemeta';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertEquals(str_replace(
|
||||
'?jsonld=',
|
||||
@@ -234,7 +234,7 @@ class jsonApiTest extends PHPUnit_Framework_TestCase
|
||||
$this->_model->create(helper::getPasteId(), $paste);
|
||||
$_GET['jsonld'] = 'commentmeta';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertEquals(str_replace(
|
||||
'?jsonld=',
|
||||
@@ -253,7 +253,7 @@ class jsonApiTest extends PHPUnit_Framework_TestCase
|
||||
$this->_model->create(helper::getPasteId(), $paste);
|
||||
$_GET['jsonld'] = '../cfg/conf.ini';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertEquals('{}', $content, 'does not output nasty data');
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class modelTest extends PHPUnit_Framework_TestCase
|
||||
/* Setup Routine */
|
||||
$options = parse_ini_file(CONF, true);
|
||||
$options['model'] = array(
|
||||
'class' => 'zerobin_db',
|
||||
'class' => 'privatebin_db',
|
||||
);
|
||||
$options['model_options'] = array(
|
||||
'dsn' => 'sqlite::memory:',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<phpunit bootstrap="bootstrap.php" colors="true">
|
||||
<testsuite name="ZeroBin Test Suite">
|
||||
<testsuite name="PrivateBin Test Suite">
|
||||
<directory suffix=".php">./</directory>
|
||||
<exclude>configGenerator.php</exclude>
|
||||
</testsuite>
|
||||
@@ -7,7 +7,7 @@
|
||||
<whitelist>
|
||||
<directory suffix=".php">../lib</directory>
|
||||
<exclude>
|
||||
<file>../lib/zerobin/abstract.php</file>
|
||||
<file>../lib/privatebin/abstract.php</file>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</filter>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
class privatebinTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $_model;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
$this->_model = zerobin_data::getInstance(array('dir' => PATH . 'data'));
|
||||
$this->_model = privatebin_data::getInstance(array('dir' => PATH . 'data'));
|
||||
serversalt::setPath(PATH . 'data');
|
||||
$this->reset();
|
||||
}
|
||||
@@ -34,10 +34,10 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
$this->reset();
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertContains(
|
||||
'<title>ZeroBin</title>',
|
||||
'<title>PrivateBin</title>',
|
||||
$content,
|
||||
'outputs title correctly'
|
||||
);
|
||||
@@ -60,10 +60,10 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
helper::createIniFile(CONF, $options);
|
||||
$_COOKIE['lang'] = 'de';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertContains(
|
||||
'<title>ZeroBin</title>',
|
||||
'<title>PrivateBin</title>',
|
||||
$content,
|
||||
'outputs title correctly'
|
||||
);
|
||||
@@ -82,10 +82,10 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
helper::createIniFile(CONF, $options);
|
||||
$_COOKIE['lang'] = 'de';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertContains(
|
||||
'<title>ZeroBin</title>',
|
||||
'<title>PrivateBin</title>',
|
||||
$content,
|
||||
'outputs title correctly'
|
||||
);
|
||||
@@ -104,7 +104,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
helper::createIniFile(CONF, $options);
|
||||
$_COOKIE['lang'] = 'de';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertRegExp(
|
||||
'#id="shortenbutton"[^>]*data-shortener="' . preg_quote($shortener) . '"#',
|
||||
@@ -125,7 +125,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
@unlink($file);
|
||||
}
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
ob_end_clean();
|
||||
foreach ($dirs as $dir) {
|
||||
$file = PATH . $dir . DIRECTORY_SEPARATOR . '.htaccess';
|
||||
@@ -146,7 +146,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
helper::confBackup();
|
||||
file_put_contents(CONF, '');
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(0, $response['status'], 'outputs status');
|
||||
@@ -190,7 +190,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
trafficlimiter::canPass();
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(1, $response['status'], 'outputs error status');
|
||||
@@ -213,7 +213,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(1, $response['status'], 'outputs error status');
|
||||
@@ -237,7 +237,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(1, $response['status'], 'outputs error status');
|
||||
@@ -260,7 +260,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(1, $response['status'], 'outputs error status');
|
||||
@@ -285,7 +285,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
$time = time();
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(0, $response['status'], 'outputs status');
|
||||
@@ -317,7 +317,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
$time = time();
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(0, $response['status'], 'outputs status');
|
||||
@@ -348,7 +348,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(0, $response['status'], 'outputs status');
|
||||
@@ -377,7 +377,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(1, $response['status'], 'outputs error status');
|
||||
@@ -400,7 +400,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(1, $response['status'], 'outputs error status');
|
||||
@@ -424,7 +424,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
$this->assertFalse($this->_model->exists(helper::getPasteId()), 'paste does not exists before posting data');
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(0, $response['status'], 'outputs status');
|
||||
@@ -457,7 +457,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(0, $response['status'], 'outputs status');
|
||||
@@ -489,7 +489,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
$this->_model->create(helper::getPasteId(), helper::getPaste());
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(1, $response['status'], 'outputs error status');
|
||||
@@ -514,7 +514,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
$this->_model->create(helper::getPasteId(), helper::getPaste());
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(0, $response['status'], 'outputs status');
|
||||
@@ -539,7 +539,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
$this->_model->create(helper::getPasteId(), helper::getPaste());
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(1, $response['status'], 'outputs error status');
|
||||
@@ -565,7 +565,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$paste = helper::getPaste(array('opendiscussion' => false));
|
||||
$this->_model->create(helper::getPasteId(), $paste);
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(1, $response['status'], 'outputs error status');
|
||||
@@ -589,7 +589,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(1, $response['status'], 'outputs error status');
|
||||
@@ -616,7 +616,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(1, $response['status'], 'outputs error status');
|
||||
@@ -632,7 +632,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$this->_model->create(helper::getPasteId(), helper::getPaste());
|
||||
$_SERVER['QUERY_STRING'] = helper::getPasteId();
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertContains(
|
||||
'<div id="cipherdata" class="hidden">' .
|
||||
@@ -651,7 +651,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$this->reset();
|
||||
$_SERVER['QUERY_STRING'] = 'foo';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertRegExp(
|
||||
'#<div[^>]*id="errormessage"[^>]*>.*Invalid paste ID\.</div>#',
|
||||
@@ -668,7 +668,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$this->reset();
|
||||
$_SERVER['QUERY_STRING'] = helper::getPasteId();
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertRegExp(
|
||||
'#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist[^<]*</div>#',
|
||||
@@ -687,7 +687,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$this->_model->create(helper::getPasteId(), $expiredPaste);
|
||||
$_SERVER['QUERY_STRING'] = helper::getPasteId();
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertRegExp(
|
||||
'#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist[^<]*</div>#',
|
||||
@@ -706,7 +706,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$this->_model->create(helper::getPasteId(), $burnPaste);
|
||||
$_SERVER['QUERY_STRING'] = helper::getPasteId();
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
unset($burnPaste['meta']['salt']);
|
||||
$this->assertContains(
|
||||
@@ -729,7 +729,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['QUERY_STRING'] = helper::getPasteId();
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(0, $response['status'], 'outputs success status');
|
||||
@@ -752,7 +752,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['QUERY_STRING'] = helper::getPasteId();
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(1, $response['status'], 'outputs error status');
|
||||
@@ -774,7 +774,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$this->_model->create(helper::getPasteId(), $oldPaste);
|
||||
$_SERVER['QUERY_STRING'] = helper::getPasteId();
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$meta['formatter'] = 'syntaxhighlighting';
|
||||
$this->assertContains(
|
||||
@@ -797,7 +797,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$this->_model->create(helper::getPasteId(), $oldPaste);
|
||||
$_SERVER['QUERY_STRING'] = helper::getPasteId();
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$oldPaste['meta']['formatter'] = 'plaintext';
|
||||
unset($oldPaste['meta']['salt']);
|
||||
@@ -822,7 +822,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_GET['pasteid'] = helper::getPasteId();
|
||||
$_GET['deletetoken'] = hash_hmac('sha256', helper::getPasteId(), $paste->meta->salt);
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertRegExp(
|
||||
'#<div[^>]*id="status"[^>]*>.*Paste was properly deleted[^<]*</div>#s',
|
||||
@@ -842,7 +842,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_GET['pasteid'] = 'foo';
|
||||
$_GET['deletetoken'] = 'bar';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertRegExp(
|
||||
'#<div[^>]*id="errormessage"[^>]*>.*Invalid paste ID\.</div>#',
|
||||
@@ -861,7 +861,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_GET['pasteid'] = helper::getPasteId();
|
||||
$_GET['deletetoken'] = 'bar';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertRegExp(
|
||||
'#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist[^<]*</div>#',
|
||||
@@ -880,7 +880,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_GET['pasteid'] = helper::getPasteId();
|
||||
$_GET['deletetoken'] = 'bar';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertRegExp(
|
||||
'#<div[^>]*id="errormessage"[^>]*>.*Wrong deletion token[^<]*</div>#',
|
||||
@@ -904,7 +904,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(0, $response['status'], 'outputs status');
|
||||
@@ -924,7 +924,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$response = json_decode($content, true);
|
||||
$this->assertEquals(1, $response['status'], 'outputs status');
|
||||
@@ -944,7 +944,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_GET['pasteid'] = helper::getPasteId();
|
||||
$_GET['deletetoken'] = 'does not matter in this context, but has to be set';
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertRegExp(
|
||||
'#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist[^<]*</div>#',
|
||||
@@ -967,7 +967,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase
|
||||
$_GET['pasteid'] = helper::getPasteId();
|
||||
$_GET['deletetoken'] = hash_hmac('sha256', helper::getPasteId(), serversalt::get());
|
||||
ob_start();
|
||||
new zerobin;
|
||||
new privatebin;
|
||||
$content = ob_get_contents();
|
||||
$this->assertRegExp(
|
||||
'#<div[^>]*id="status"[^>]*>.*Paste was properly deleted[^<]*</div>#s',
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class zerobin_dataTest extends PHPUnit_Framework_TestCase
|
||||
class privatebin_dataTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $_model;
|
||||
|
||||
@@ -8,8 +8,8 @@ class zerobin_dataTest extends PHPUnit_Framework_TestCase
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'zerobin_data';
|
||||
$this->_model = zerobin_data::getInstance(array('dir' => $this->_path));
|
||||
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
|
||||
$this->_model = privatebin_data::getInstance(array('dir' => $this->_path));
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class zerobin_dbTest extends PHPUnit_Framework_TestCase
|
||||
class privatebin_dbTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $_model;
|
||||
|
||||
@@ -13,7 +13,7 @@ class zerobin_dbTest extends PHPUnit_Framework_TestCase
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
$this->_model = zerobin_db::getInstance($this->_options);
|
||||
$this->_model = privatebin_db::getInstance($this->_options);
|
||||
}
|
||||
|
||||
public function testDatabaseBasedDataStoreWorks()
|
||||
@@ -67,7 +67,7 @@ class zerobin_dbTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetIbmInstance()
|
||||
{
|
||||
zerobin_db::getInstance(array(
|
||||
privatebin_db::getInstance(array(
|
||||
'dsn' => 'ibm:', 'usr' => null, 'pwd' => null,
|
||||
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
|
||||
));
|
||||
@@ -78,7 +78,7 @@ class zerobin_dbTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetInformixInstance()
|
||||
{
|
||||
zerobin_db::getInstance(array(
|
||||
privatebin_db::getInstance(array(
|
||||
'dsn' => 'informix:', 'usr' => null, 'pwd' => null,
|
||||
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
|
||||
));
|
||||
@@ -89,7 +89,7 @@ class zerobin_dbTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetMssqlInstance()
|
||||
{
|
||||
zerobin_db::getInstance(array(
|
||||
privatebin_db::getInstance(array(
|
||||
'dsn' => 'mssql:', 'usr' => null, 'pwd' => null,
|
||||
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
|
||||
));
|
||||
@@ -100,7 +100,7 @@ class zerobin_dbTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetMysqlInstance()
|
||||
{
|
||||
zerobin_db::getInstance(array(
|
||||
privatebin_db::getInstance(array(
|
||||
'dsn' => 'mysql:', 'usr' => null, 'pwd' => null,
|
||||
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
|
||||
));
|
||||
@@ -111,7 +111,7 @@ class zerobin_dbTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetOciInstance()
|
||||
{
|
||||
zerobin_db::getInstance(array(
|
||||
privatebin_db::getInstance(array(
|
||||
'dsn' => 'oci:', 'usr' => null, 'pwd' => null,
|
||||
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
|
||||
));
|
||||
@@ -122,7 +122,7 @@ class zerobin_dbTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetPgsqlInstance()
|
||||
{
|
||||
zerobin_db::getInstance(array(
|
||||
privatebin_db::getInstance(array(
|
||||
'dsn' => 'pgsql:', 'usr' => null, 'pwd' => null,
|
||||
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
|
||||
));
|
||||
@@ -134,7 +134,7 @@ class zerobin_dbTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetFooInstance()
|
||||
{
|
||||
zerobin_db::getInstance(array(
|
||||
privatebin_db::getInstance(array(
|
||||
'dsn' => 'foo:', 'usr' => null, 'pwd' => null, 'opt' => null
|
||||
));
|
||||
}
|
||||
@@ -160,7 +160,7 @@ class zerobin_dbTest extends PHPUnit_Framework_TestCase
|
||||
'opendiscussion INT, ' .
|
||||
'burnafterreading INT );'
|
||||
);
|
||||
zerobin_db::getInstance($this->_options);
|
||||
privatebin_db::getInstance($this->_options);
|
||||
@unlink($path);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
require_once 'zerobin.php';
|
||||
require_once 'privatebin.php';
|
||||
|
||||
class zerobinWithDbTest extends zerobinTest
|
||||
class privatebinWithDbTest extends privatebinTest
|
||||
{
|
||||
private $_options = array(
|
||||
'dsn' => 'sqlite:../data/tst.sq3',
|
||||
@@ -16,7 +16,7 @@ class zerobinWithDbTest extends zerobinTest
|
||||
public function setUp()
|
||||
{
|
||||
/* Setup Routine */
|
||||
$this->_model = zerobin_db::getInstance($this->_options);
|
||||
$this->_model = privatebin_db::getInstance($this->_options);
|
||||
serversalt::setPath(PATH . 'data');
|
||||
$this->reset();
|
||||
}
|
||||
@@ -34,7 +34,7 @@ class zerobinWithDbTest extends zerobinTest
|
||||
// but then inject a db config
|
||||
$options = parse_ini_file(CONF, true);
|
||||
$options['model'] = array(
|
||||
'class' => 'zerobin_db',
|
||||
'class' => 'privatebin_db',
|
||||
);
|
||||
$options['model_options'] = $this->_options;
|
||||
helper::confBackup();
|
||||
@@ -37,7 +37,7 @@ limit = 0
|
||||
dir = "../data"
|
||||
|
||||
[model]
|
||||
class = "zerobin_db"
|
||||
class = "privatebin_db"
|
||||
|
||||
[model_options]
|
||||
dsn = "sqlite:../data/db.sq3"
|
||||
|
||||
Reference in New Issue
Block a user