]*id="opendisc"[^>]*>#',
'$content',
- 'outputs disabled discussion correctly'
+ 'outputs disabled discussion correctly',
),
),
),
- 'affects' => $vrd
+ 'affects' => $vrd,
),
),
'main/opendiscussion' => array(
array(
'setting' => true,
- 'tests' => array(
+ 'tests' => array(
array(
'conditions' => array('main/discussion' => true),
- 'type' => 'RegExp',
- 'args' => array(
+ 'type' => 'RegExp',
+ 'args' => array(
'#
]+id="opendiscussion"[^>]*checked="checked"[^>]*>#',
'$content',
- 'outputs checked discussion correctly'
+ 'outputs checked discussion correctly',
),
),
),
- 'affects' => $vrd
+ 'affects' => $vrd,
), array(
'setting' => false,
- 'tests' => array(
+ 'tests' => array(
array(
'conditions' => array('main/discussion' => true),
- 'type' => 'NotRegExp',
- 'args' => array(
+ 'type' => 'NotRegExp',
+ 'args' => array(
'#
]+id="opendiscussion"[^>]*checked="checked"[^>]*>#',
'$content',
- 'outputs unchecked discussion correctly'
+ 'outputs unchecked discussion correctly',
),
),
),
- 'affects' => $vrd
+ 'affects' => $vrd,
),
),
'main/burnafterreadingselected' => array(
array(
'setting' => true,
- 'tests' => array(
+ 'tests' => array(
array(
'type' => 'RegExp',
'args' => array(
@@ -110,7 +109,7 @@ new ConfigurationTestGenerator(array(
'affects' => array('view'),
), array(
'setting' => false,
- 'tests' => array(
+ 'tests' => array(
array(
'type' => 'NotRegExp',
'args' => array(
@@ -126,37 +125,37 @@ new ConfigurationTestGenerator(array(
'main/password' => array(
array(
'setting' => true,
- 'tests' => array(
+ 'tests' => array(
array(
'type' => 'RegExp',
'args' => array(
'#
]*id="password"[^>]*>#',
'$content',
- 'outputs password input correctly'
+ 'outputs password input correctly',
),
),
),
- 'affects' => $vrd
+ 'affects' => $vrd,
), array(
'setting' => false,
- 'tests' => array(
+ 'tests' => array(
array(
'conditions' => array('main/discussion' => true),
- 'type' => 'NotRegExp',
- 'args' => array(
+ 'type' => 'NotRegExp',
+ 'args' => array(
'#
]*id="password"[^>]*>#',
'$content',
- 'removes password input correctly'
+ 'removes password input correctly',
),
),
),
- 'affects' => $vrd
+ 'affects' => $vrd,
),
),
'main/template' => array(
array(
'setting' => 'page',
- 'tests' => array(
+ 'tests' => array(
array(
'type' => 'RegExp',
'args' => array(
@@ -176,7 +175,7 @@ new ConfigurationTestGenerator(array(
'affects' => $vrd,
), array(
'setting' => 'bootstrap',
- 'tests' => array(
+ 'tests' => array(
array(
'type' => 'NotRegExp',
'args' => array(
@@ -199,102 +198,102 @@ new ConfigurationTestGenerator(array(
'main/sizelimit' => array(
array(
'setting' => 10,
- 'tests' => array(
+ 'tests' => array(
array(
'conditions' => array('steps' => array('create'), 'traffic/limit' => 10),
- 'type' => 'Equals',
- 'args' => array(
+ 'type' => 'Equals',
+ 'args' => array(
1,
'$response["status"]',
- 'when sizelimit limit exceeded, fail to create paste'
+ 'when sizelimit limit exceeded, fail to create paste',
),
),
),
- 'affects' => array('create')
+ 'affects' => array('create'),
), array(
'setting' => 2097152,
- 'tests' => array(
+ 'tests' => array(
array(
'conditions' => array('steps' => array('create'), 'traffic/limit' => 0, 'main/burnafterreadingselected' => true),
- 'settings' => array('sleep(3)'),
- 'type' => 'Equals',
- 'args' => array(
+ 'settings' => array('sleep(3)'),
+ 'type' => 'Equals',
+ 'args' => array(
0,
'$response["status"]',
- 'when sizelimit limit is not reached, successfully create paste'
+ 'when sizelimit limit is not reached, successfully create paste',
),
), array(
'conditions' => array('steps' => array('create'), 'traffic/limit' => 0, 'main/burnafterreadingselected' => true),
- 'settings' => array('sleep(3)'),
- 'type' => 'True',
- 'args' => array(
+ 'settings' => array('sleep(3)'),
+ 'type' => 'True',
+ 'args' => array(
'$this->_model->exists($response["id"])',
- 'when sizelimit limit is not reached, paste exists after posting data'
+ 'when sizelimit limit is not reached, paste exists after posting data',
),
),
),
- 'affects' => array('create')
+ 'affects' => array('create'),
),
),
'traffic/limit' => array(
array(
'setting' => 0,
- 'tests' => array(
+ 'tests' => array(
array(
'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152),
- 'type' => 'Equals',
- 'args' => array(
+ 'type' => 'Equals',
+ 'args' => array(
0,
'$response["status"]',
- 'when traffic limit is disabled, successfully create paste'
+ 'when traffic limit is disabled, successfully create paste',
),
), array(
'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152),
- 'type' => 'True',
- 'args' => array(
+ 'type' => 'True',
+ 'args' => array(
'$this->_model->exists($response["id"])',
- 'when traffic limit is disabled, paste exists after posting data'
+ 'when traffic limit is disabled, paste exists after posting data',
),
),
),
- 'affects' => array('create')
+ 'affects' => array('create'),
), array(
'setting' => 10,
- 'tests' => array(
+ 'tests' => array(
array(
'conditions' => array('steps' => array('create')),
- 'type' => 'Equals',
- 'args' => array(
+ 'type' => 'Equals',
+ 'args' => array(
1,
'$response["status"]',
- 'when traffic limit is on and we do not wait, fail to create paste'
+ 'when traffic limit is on and we do not wait, fail to create paste',
),
),
),
- 'affects' => array('create')
+ 'affects' => array('create'),
), array(
'setting' => 2,
- 'tests' => array(
+ 'tests' => array(
array(
'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152),
- 'settings' => array('sleep(3)'),
- 'type' => 'Equals',
- 'args' => array(
+ 'settings' => array('sleep(3)'),
+ 'type' => 'Equals',
+ 'args' => array(
0,
'$response["status"]',
- 'when traffic limit is on and we wait, successfully create paste'
+ 'when traffic limit is on and we wait, successfully create paste',
),
), array(
'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152),
- 'settings' => array('sleep(3)'),
- 'type' => 'True',
- 'args' => array(
+ 'settings' => array('sleep(3)'),
+ 'type' => 'True',
+ 'args' => array(
'$this->_model->exists($response["id"])',
- 'when traffic limit is on and we wait, paste exists after posting data'
+ 'when traffic limit is on and we wait, paste exists after posting data',
),
),
),
- 'affects' => array('create')
+ 'affects' => array('create'),
),
),
));
@@ -325,7 +324,7 @@ class ConfigurationTestGenerator
* @var array
*/
private $_configurations = array(
- array('options' => array(), 'tests' => array(), 'affects' => array())
+ array('options' => array(), 'tests' => array(), 'affects' => array()),
);
/**
@@ -346,10 +345,10 @@ class ConfigurationTestGenerator
private function _writeConfigurationTest()
{
$defaultOptions = parse_ini_file(CONF, true);
- $code = $this->_getHeader();
+ $code = $this->_getHeader();
foreach ($this->_configurations as $key => $conf) {
$fullOptions = array_replace_recursive($defaultOptions, $conf['options']);
- $options = Helper::varExportMin($fullOptions, true);
+ $options = Helper::varExportMin($fullOptions, true);
foreach ($conf['affects'] as $step) {
$testCode = $preCode = array();
foreach ($conf['tests'] as $tests) {
@@ -470,7 +469,7 @@ EOT;
private function _getFunction($step, $key, &$options, $preCode, $testCode)
{
if (count($testCode) == 0) {
- echo "skipping creation of test$step$key, no valid tests found for configuration: $options". PHP_EOL;
+ echo "skipping creation of test$step$key, no valid tests found for configuration: $options" . PHP_EOL;
return '';
}
@@ -593,7 +592,7 @@ EOT;
// create clones for each of the other settings
while ($setting = next($settings)) {
- $clone = $this->_configurations[$c];
+ $clone = $this->_configurations[$c];
$this->_configurations[] = $this->_addSetting($clone, $setting, $section, $option);
}
reset($settings);
@@ -626,7 +625,7 @@ EOT;
throw new Exception("Endless loop or error in options detected: option '$option' already exists with setting '$val' in one of the configurations!");
}
$configuration['options'][$section][$option] = $setting['setting'];
- $configuration['tests'][$option] = array($setting['tests'], $setting['affects']);
+ $configuration['tests'][$option] = array($setting['tests'], $setting['affects']);
foreach ($setting['affects'] as $affects) {
if (!in_array($affects, $configuration['affects'])) {
$configuration['affects'][] = $affects;
diff --git a/tst/Data/DatabaseTest.php b/tst/Data/DatabaseTest.php
index 37865e5d..01955694 100644
--- a/tst/Data/DatabaseTest.php
+++ b/tst/Data/DatabaseTest.php
@@ -19,7 +19,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
public function setUp()
{
/* Setup Routine */
- $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
+ $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
$this->_model = Database::getInstance($this->_options);
}
@@ -47,8 +47,8 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
$this->assertFalse($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment does not yet exist');
$this->assertTrue($this->_model->createComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId(), Helper::getComment()) !== false, 'store comment');
$this->assertTrue($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment exists after storing it');
- $comment = json_decode(json_encode(Helper::getComment()));
- $comment->id = Helper::getCommentId();
+ $comment = json_decode(json_encode(Helper::getComment()));
+ $comment->id = Helper::getCommentId();
$comment->parentid = Helper::getPasteId();
$this->assertEquals(
array($comment->meta->postdate => $comment),
@@ -65,10 +65,10 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
public function testDatabaseBasedAttachmentStoreWorks()
{
$this->_model->delete(Helper::getPasteId());
- $original = $paste = Helper::getPasteWithAttachment(array('expire_date' => 1344803344));
+ $original = $paste = Helper::getPasteWithAttachment(array('expire_date' => 1344803344));
$paste['meta']['burnafterreading'] = $original['meta']['burnafterreading'] = true;
- $paste['meta']['attachment'] = $paste['attachment'];
- $paste['meta']['attachmentname'] = $paste['attachmentname'];
+ $paste['meta']['attachment'] = $paste['attachment'];
+ $paste['meta']['attachmentname'] = $paste['attachmentname'];
unset($paste['attachment'], $paste['attachmentname']);
$this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not yet exist');
$this->assertTrue($this->_model->create(Helper::getPasteId(), $paste), 'store new paste');
@@ -81,9 +81,9 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{
$this->_model->delete(Helper::getPasteId());
$expired = Helper::getPaste(array('expire_date' => 1344803344));
- $paste = Helper::getPaste(array('expire_date' => time() + 3600));
- $keys = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'x', 'y', 'z');
- $ids = array();
+ $paste = Helper::getPaste(array('expire_date' => time() + 3600));
+ $keys = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'x', 'y', 'z');
+ $ids = array();
foreach ($keys as $key) {
$ids[$key] = substr(md5($key), 0, 16);
$this->_model->delete($ids[$key]);
@@ -113,7 +113,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{
Database::getInstance(array(
'dsn' => 'ibm:', 'usr' => null, 'pwd' => null,
- 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
+ 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
));
}
@@ -124,7 +124,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{
Database::getInstance(array(
'dsn' => 'informix:', 'usr' => null, 'pwd' => null,
- 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
+ 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
));
}
@@ -135,7 +135,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{
Database::getInstance(array(
'dsn' => 'mssql:', 'usr' => null, 'pwd' => null,
- 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
+ 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
));
}
@@ -146,7 +146,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{
Database::getInstance(array(
'dsn' => 'mysql:', 'usr' => null, 'pwd' => null,
- 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
+ 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
));
}
@@ -157,7 +157,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{
Database::getInstance(array(
'dsn' => 'oci:', 'usr' => null, 'pwd' => null,
- 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
+ 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
));
}
@@ -168,7 +168,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{
Database::getInstance(array(
'dsn' => 'pgsql:', 'usr' => null, 'pwd' => null,
- 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
+ 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
));
}
@@ -179,7 +179,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
public function testGetFooInstance()
{
Database::getInstance(array(
- 'dsn' => 'foo:', 'usr' => null, 'pwd' => null, 'opt' => null
+ 'dsn' => 'foo:', 'usr' => null, 'pwd' => null, 'opt' => null,
));
}
@@ -231,13 +231,15 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{
mkdir($this->_path);
$path = $this->_path . DIRECTORY_SEPARATOR . 'attachement-test.sq3';
- if (is_file($path)) unlink($path);
+ if (is_file($path)) {
+ unlink($path);
+ }
$this->_options['dsn'] = 'sqlite:' . $path;
$this->_options['tbl'] = 'bar_';
- $model = Database::getInstance($this->_options);
+ $model = Database::getInstance($this->_options);
- $original = $paste = Helper::getPasteWithAttachment(array('expire_date' => 1344803344));
- $paste['meta']['attachment'] = $paste['attachment'];
+ $original = $paste = Helper::getPasteWithAttachment(array('expire_date' => 1344803344));
+ $paste['meta']['attachment'] = $paste['attachment'];
$paste['meta']['attachmentname'] = $paste['attachmentname'];
unset($paste['attachment'], $paste['attachmentname']);
$meta = $paste['meta'];
@@ -274,10 +276,12 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{
mkdir($this->_path);
$path = $this->_path . DIRECTORY_SEPARATOR . 'db-test.sq3';
- if (is_file($path)) unlink($path);
+ if (is_file($path)) {
+ unlink($path);
+ }
$this->_options['dsn'] = 'sqlite:' . $path;
$this->_options['tbl'] = 'foo_';
- $db = new PDO(
+ $db = new PDO(
$this->_options['dsn'],
$this->_options['usr'],
$this->_options['pwd'],
@@ -294,13 +298,13 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
);
$db->exec(
'CREATE TABLE foo_comment ( ' .
- "dataid CHAR(16) NOT NULL, " .
+ 'dataid CHAR(16) NOT NULL, ' .
'pasteid CHAR(16), ' .
'parentid CHAR(16), ' .
'data BLOB, ' .
'nickname BLOB, ' .
'vizhash BLOB, ' .
- "postdate INT );"
+ 'postdate INT );'
);
$this->assertInstanceOf(Database::class, Database::getInstance($this->_options));
diff --git a/tst/Data/FilesystemTest.php b/tst/Data/FilesystemTest.php
index d76bab1e..33e37c84 100644
--- a/tst/Data/FilesystemTest.php
+++ b/tst/Data/FilesystemTest.php
@@ -11,7 +11,7 @@ class FilesystemTest extends PHPUnit_Framework_TestCase
public function setUp()
{
/* Setup Routine */
- $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
+ $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
$this->_model = Filesystem::getInstance(array('dir' => $this->_path));
}
@@ -37,8 +37,8 @@ class FilesystemTest extends PHPUnit_Framework_TestCase
$this->assertFalse($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment does not yet exist');
$this->assertTrue($this->_model->createComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId(), Helper::getComment()), 'store comment');
$this->assertTrue($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment exists after storing it');
- $comment = json_decode(json_encode(Helper::getComment()));
- $comment->id = Helper::getCommentId();
+ $comment = json_decode(json_encode(Helper::getComment()));
+ $comment->id = Helper::getCommentId();
$comment->parentid = Helper::getPasteId();
$this->assertEquals(
array($comment->meta->postdate => $comment),
@@ -55,8 +55,8 @@ class FilesystemTest extends PHPUnit_Framework_TestCase
public function testFileBasedAttachmentStoreWorks()
{
$this->_model->delete(Helper::getPasteId());
- $original = $paste = Helper::getPasteWithAttachment(array('expire_date' => 1344803344));
- $paste['meta']['attachment'] = $paste['attachment'];
+ $original = $paste = Helper::getPasteWithAttachment(array('expire_date' => 1344803344));
+ $paste['meta']['attachment'] = $paste['attachment'];
$paste['meta']['attachmentname'] = $paste['attachmentname'];
unset($paste['attachment'], $paste['attachmentname']);
$this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not yet exist');
@@ -70,9 +70,9 @@ class FilesystemTest extends PHPUnit_Framework_TestCase
{
mkdir($this->_path . DIRECTORY_SEPARATOR . '00', 0777, true);
$expired = Helper::getPaste(array('expire_date' => 1344803344));
- $paste = Helper::getPaste(array('expire_date' => time() + 3600));
- $keys = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'x', 'y', 'z');
- $ids = array();
+ $paste = Helper::getPaste(array('expire_date' => time() + 3600));
+ $keys = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'x', 'y', 'z');
+ $ids = array();
foreach ($keys as $key) {
$ids[$key] = substr(md5($key), 0, 16);
$this->assertFalse($this->_model->exists($ids[$key]), "paste $key does not yet exist");
diff --git a/tst/I18nTest.php b/tst/I18nTest.php
index 8026c158..f2f4eadc 100644
--- a/tst/I18nTest.php
+++ b/tst/I18nTest.php
@@ -23,7 +23,7 @@ class I18nTest extends PHPUnit_Framework_TestCase
public function testTranslationFallback()
{
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'foobar';
- $messageId = 'It does not matter if the message ID exists';
+ $messageId = 'It does not matter if the message ID exists';
I18n::loadTranslations();
$this->assertEquals($messageId, I18n::_($messageId), 'fallback to en');
}
diff --git a/tst/JsonApiTest.php b/tst/JsonApiTest.php
index 2cedde17..8579f013 100644
--- a/tst/JsonApiTest.php
+++ b/tst/JsonApiTest.php
@@ -1,9 +1,9 @@
_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
+ $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
$this->_model = Filesystem::getInstance(array('dir' => $this->_path));
ServerSalt::setPath($this->_path);
$this->reset();
@@ -30,16 +30,16 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
public function reset()
{
- $_POST = array();
- $_GET = array();
+ $_POST = array();
+ $_GET = array();
$_SERVER = array();
if ($this->_model->exists(Helper::getPasteId())) {
$this->_model->delete(Helper::getPasteId());
}
Helper::confRestore();
- $options = parse_ini_file(CONF, true);
- $options['purge']['dir'] = $this->_path;
- $options['traffic']['dir'] = $this->_path;
+ $options = parse_ini_file(CONF, true);
+ $options['purge']['dir'] = $this->_path;
+ $options['traffic']['dir'] = $this->_path;
$options['model_options']['dir'] = $this->_path;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
@@ -51,14 +51,14 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
public function testCreate()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
- $_POST = Helper::getPaste();
+ $_POST = Helper::getPaste();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
ob_start();
new PrivateBin;
$content = ob_get_contents();
@@ -81,7 +81,7 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
public function testPut()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
@@ -90,10 +90,10 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
$file = tempnam(sys_get_temp_dir(), 'FOO');
file_put_contents($file, http_build_query($paste));
Request::setInputStream($file);
- $_SERVER['QUERY_STRING'] = Helper::getPasteId();
+ $_SERVER['QUERY_STRING'] = Helper::getPasteId();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'PUT';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'PUT';
+ $_SERVER['REMOTE_ADDR'] = '::1';
ob_start();
new PrivateBin;
$content = ob_get_contents();
@@ -120,14 +120,14 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
$this->_model->create(Helper::getPasteId(), Helper::getPaste());
$this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data');
$paste = $this->_model->read(Helper::getPasteId());
- $file = tempnam(sys_get_temp_dir(), 'FOO');
+ $file = tempnam(sys_get_temp_dir(), 'FOO');
file_put_contents($file, http_build_query(array(
'deletetoken' => hash_hmac('sha256', Helper::getPasteId(), $paste->meta->salt),
)));
Request::setInputStream($file);
- $_SERVER['QUERY_STRING'] = Helper::getPasteId();
+ $_SERVER['QUERY_STRING'] = Helper::getPasteId();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'DELETE';
+ $_SERVER['REQUEST_METHOD'] = 'DELETE';
ob_start();
new PrivateBin;
$content = ob_get_contents();
@@ -147,12 +147,12 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
$this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data');
$paste = $this->_model->read(Helper::getPasteId());
$_POST = array(
- 'action' => 'delete',
+ 'action' => 'delete',
'deletetoken' => hash_hmac('sha256', Helper::getPasteId(), $paste->meta->salt),
);
- $_SERVER['QUERY_STRING'] = Helper::getPasteId();
+ $_SERVER['QUERY_STRING'] = Helper::getPasteId();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
ob_start();
new PrivateBin;
$content = ob_get_contents();
@@ -168,13 +168,13 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
public function testRead()
{
$this->reset();
- $paste = Helper::getPasteWithAttachment();
- $paste['meta']['attachment'] = $paste['attachment'];
+ $paste = Helper::getPasteWithAttachment();
+ $paste['meta']['attachment'] = $paste['attachment'];
$paste['meta']['attachmentname'] = $paste['attachmentname'];
unset($paste['attachment']);
unset($paste['attachmentname']);
$this->_model->create(Helper::getPasteId(), $paste);
- $_SERVER['QUERY_STRING'] = Helper::getPasteId();
+ $_SERVER['QUERY_STRING'] = Helper::getPasteId();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
ob_start();
new PrivateBin;
diff --git a/tst/ModelTest.php b/tst/ModelTest.php
index 9ddfd172..8f7a40b0 100644
--- a/tst/ModelTest.php
+++ b/tst/ModelTest.php
@@ -1,5 +1,6 @@
_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
- if (!is_dir($this->_path)) mkdir($this->_path);
+ if (!is_dir($this->_path)) {
+ mkdir($this->_path);
+ }
ServerSalt::setPath($this->_path);
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['purge']['limit'] = 0;
- $options['model'] = array(
+ $options['model'] = array(
'class' => 'Database',
);
$options['model_options'] = array(
@@ -37,8 +39,8 @@ class ModelTest extends PHPUnit_Framework_TestCase
);
Helper::confBackup();
Helper::createIniFile(CONF, $options);
- $this->_conf = new Configuration;
- $this->_model = new Model($this->_conf);
+ $this->_conf = new Configuration;
+ $this->_model = new Model($this->_conf);
$_SERVER['REMOTE_ADDR'] = '::1';
}
@@ -73,8 +75,8 @@ class ModelTest extends PHPUnit_Framework_TestCase
// storing comments
$commentData = Helper::getComment();
- $paste = $this->_model->getPaste(Helper::getPasteId());
- $comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId());
+ $paste = $this->_model->getPaste(Helper::getPasteId());
+ $comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId());
$this->assertFalse($comment->exists(), 'comment does not yet exist');
$comment = $paste->getComment(Helper::getPasteId());
@@ -123,7 +125,7 @@ class ModelTest extends PHPUnit_Framework_TestCase
*/
public function testCommentDuplicate()
{
- $pasteData = Helper::getPaste();
+ $pasteData = Helper::getPaste();
$commentData = Helper::getComment();
$this->_model->getPaste(Helper::getPasteId())->delete();
@@ -146,7 +148,7 @@ class ModelTest extends PHPUnit_Framework_TestCase
public function testImplicitDefaults()
{
- $pasteData = Helper::getPaste();
+ $pasteData = Helper::getPaste();
$commentData = Helper::getComment();
$this->_model->getPaste(Helper::getPasteId())->delete();
@@ -175,8 +177,8 @@ class ModelTest extends PHPUnit_Framework_TestCase
$comment->store();
$identicon = new Identicon();
- $pngdata = $identicon->getImageDataUri(TrafficLimiter::getHash(), 16);
- $comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId())->get();
+ $pngdata = $identicon->getImageDataUri(TrafficLimiter::getHash(), 16);
+ $comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId())->get();
$this->assertEquals($pngdata, $comment->meta->vizhash, 'nickname triggers vizhash to be set');
}
@@ -230,13 +232,13 @@ class ModelTest extends PHPUnit_Framework_TestCase
public function testPurge()
{
- $conf = new Configuration;
+ $conf = new Configuration;
$store = Database::getInstance($conf->getSection('model_options'));
$store->delete(Helper::getPasteId());
$expired = Helper::getPaste(array('expire_date' => 1344803344));
- $paste = Helper::getPaste(array('expire_date' => time() + 3600));
- $keys = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'x', 'y', 'z');
- $ids = array();
+ $paste = Helper::getPaste(array('expire_date' => time() + 3600));
+ $keys = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'x', 'y', 'z');
+ $ids = array();
foreach ($keys as $key) {
$ids[$key] = substr(md5($key), 0, 16);
$store->delete($ids[$key]);
@@ -261,9 +263,9 @@ class ModelTest extends PHPUnit_Framework_TestCase
public function testCommentWithDisabledVizhash()
{
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['main']['icon'] = 'none';
- $options['model'] = array(
+ $options['model'] = array(
'class' => 'Database',
);
$options['model_options'] = array(
@@ -297,8 +299,8 @@ class ModelTest extends PHPUnit_Framework_TestCase
// storing comments
$commentData = Helper::getComment();
- $paste = $model->getPaste(Helper::getPasteId());
- $comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId());
+ $paste = $model->getPaste(Helper::getPasteId());
+ $comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId());
$this->assertFalse($comment->exists(), 'comment does not yet exist');
$comment = $paste->getComment(Helper::getPasteId());
@@ -316,9 +318,9 @@ class ModelTest extends PHPUnit_Framework_TestCase
public function testCommentIdenticon()
{
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['main']['icon'] = 'identicon';
- $options['model'] = array(
+ $options['model'] = array(
'class' => 'Database',
);
$options['model_options'] = array(
@@ -331,7 +333,7 @@ class ModelTest extends PHPUnit_Framework_TestCase
Helper::createIniFile(CONF, $options);
$model = new Model(new Configuration);
- $pasteData = Helper::getPaste();
+ $pasteData = Helper::getPaste();
$commentData = Helper::getComment();
$model->getPaste(Helper::getPasteId())->delete();
@@ -347,16 +349,16 @@ class ModelTest extends PHPUnit_Framework_TestCase
$comment->store();
$identicon = new Identicon();
- $pngdata = $identicon->getImageDataUri(TrafficLimiter::getHash(), 16);
- $comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId())->get();
+ $pngdata = $identicon->getImageDataUri(TrafficLimiter::getHash(), 16);
+ $comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId())->get();
$this->assertEquals($pngdata, $comment->meta->vizhash, 'nickname triggers vizhash to be set');
}
public function testCommentVizhash()
{
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['main']['icon'] = 'vizhash';
- $options['model'] = array(
+ $options['model'] = array(
'class' => 'Database',
);
$options['model_options'] = array(
@@ -369,7 +371,7 @@ class ModelTest extends PHPUnit_Framework_TestCase
Helper::createIniFile(CONF, $options);
$model = new Model(new Configuration);
- $pasteData = Helper::getPaste();
+ $pasteData = Helper::getPaste();
$commentData = Helper::getComment();
$model->getPaste(Helper::getPasteId())->delete();
@@ -384,7 +386,7 @@ class ModelTest extends PHPUnit_Framework_TestCase
$comment->setNickname($commentData['meta']['nickname']);
$comment->store();
- $vz = new Vizhash16x16();
+ $vz = new Vizhash16x16();
$pngdata = 'data:image/png;base64,' . base64_encode($vz->generate(TrafficLimiter::getHash()));
$comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId())->get();
$this->assertEquals($pngdata, $comment->meta->vizhash, 'nickname triggers vizhash to be set');
diff --git a/tst/PrivateBinTest.php b/tst/PrivateBinTest.php
index 4546de26..355b3f9d 100644
--- a/tst/PrivateBinTest.php
+++ b/tst/PrivateBinTest.php
@@ -1,9 +1,9 @@
_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
+ $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
$this->_model = Filesystem::getInstance(array('dir' => $this->_path));
ServerSalt::setPath($this->_path);
$this->reset();
@@ -29,16 +29,16 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function reset()
{
- $_POST = array();
- $_GET = array();
+ $_POST = array();
+ $_GET = array();
$_SERVER = array();
if ($this->_model->exists(Helper::getPasteId())) {
$this->_model->delete(Helper::getPasteId());
}
Helper::confRestore();
- $options = parse_ini_file(CONF, true);
- $options['purge']['dir'] = $this->_path;
- $options['traffic']['dir'] = $this->_path;
+ $options = parse_ini_file(CONF, true);
+ $options['purge']['dir'] = $this->_path;
+ $options['traffic']['dir'] = $this->_path;
$options['model_options']['dir'] = $this->_path;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
@@ -72,7 +72,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testViewLanguageSelection()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['main']['languageselection'] = true;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
@@ -94,9 +94,9 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testViewForceLanguageDefault()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['main']['languageselection'] = false;
- $options['main']['languagedefault'] = 'fr';
+ $options['main']['languagedefault'] = 'fr';
Helper::confBackup();
Helper::createIniFile(CONF, $options);
$_COOKIE['lang'] = 'de';
@@ -118,7 +118,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
{
$shortener = 'https://shortener.example.com/api?link=';
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['main']['urlshortener'] = $shortener;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
@@ -175,14 +175,14 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreate()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
- $_POST = Helper::getPaste();
+ $_POST = Helper::getPaste();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
ob_start();
new PrivateBin;
$content = ob_get_contents();
@@ -204,14 +204,14 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateInvalidTimelimit()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
- $_POST = Helper::getPaste(array('expire' => 25));
+ $_POST = Helper::getPaste(array('expire' => 25));
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
TrafficLimiter::canPass();
ob_start();
new PrivateBin;
@@ -234,15 +234,15 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateInvalidSize()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['main']['sizelimit'] = 10;
- $options['traffic']['limit'] = 0;
+ $options['traffic']['limit'] = 0;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
- $_POST = Helper::getPaste();
+ $_POST = Helper::getPaste();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
ob_start();
new PrivateBin;
$content = ob_get_contents();
@@ -258,15 +258,15 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateProxyHeader()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['traffic']['header'] = 'X_FORWARDED_FOR';
Helper::confBackup();
Helper::createIniFile(CONF, $options);
- $_POST = Helper::getPaste();
- $_SERVER['HTTP_X_FORWARDED_FOR'] = '::2';
+ $_POST = Helper::getPaste();
+ $_SERVER['HTTP_X_FORWARDED_FOR'] = '::2';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
ob_start();
new PrivateBin;
$content = ob_get_contents();
@@ -288,15 +288,15 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateDuplicateId()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
$this->_model->create(Helper::getPasteId(), Helper::getPaste());
- $_POST = Helper::getPaste();
+ $_POST = Helper::getPaste();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
ob_start();
new PrivateBin;
$content = ob_get_contents();
@@ -312,17 +312,17 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateValidExpire()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
- $_POST = Helper::getPaste();
- $_POST['expire'] = '5min';
- $_POST['formatter'] = 'foo';
+ $_POST = Helper::getPaste();
+ $_POST['expire'] = '5min';
+ $_POST['formatter'] = 'foo';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
- $time = time();
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $time = time();
ob_start();
new PrivateBin;
$content = ob_get_contents();
@@ -345,17 +345,17 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateValidExpireWithDiscussion()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
- $_POST = Helper::getPaste();
- $_POST['expire'] = '5min';
- $_POST['opendiscussion'] = '1';
+ $_POST = Helper::getPaste();
+ $_POST['expire'] = '5min';
+ $_POST['opendiscussion'] = '1';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
- $time = time();
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $time = time();
ob_start();
new PrivateBin;
$content = ob_get_contents();
@@ -379,15 +379,15 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateInvalidExpire()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
- $_POST = Helper::getPaste();
- $_POST['expire'] = 'foo';
+ $_POST = Helper::getPaste();
+ $_POST['expire'] = 'foo';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
ob_start();
new PrivateBin;
$content = ob_get_contents();
@@ -409,15 +409,15 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateInvalidBurn()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
- $_POST = Helper::getPaste();
- $_POST['burnafterreading'] = 'neither 1 nor 0';
+ $_POST = Helper::getPaste();
+ $_POST['burnafterreading'] = 'neither 1 nor 0';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
ob_start();
new PrivateBin;
$content = ob_get_contents();
@@ -433,15 +433,15 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateInvalidOpenDiscussion()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
- $_POST = Helper::getPaste();
- $_POST['opendiscussion'] = 'neither 1 nor 0';
+ $_POST = Helper::getPaste();
+ $_POST['opendiscussion'] = 'neither 1 nor 0';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
ob_start();
new PrivateBin;
$content = ob_get_contents();
@@ -457,15 +457,15 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateAttachment()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
- $options['traffic']['limit'] = 0;
+ $options = parse_ini_file(CONF, true);
+ $options['traffic']['limit'] = 0;
$options['main']['fileupload'] = true;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
- $_POST = Helper::getPasteWithAttachment();
+ $_POST = Helper::getPasteWithAttachment();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
$this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not exists before posting data');
ob_start();
new PrivateBin;
@@ -475,7 +475,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
$this->assertEquals(0, $response['status'], 'outputs status');
$this->assertTrue($this->_model->exists($response['id']), 'paste exists after posting data');
$original = json_decode(json_encode($_POST));
- $stored = $this->_model->read($response['id']);
+ $stored = $this->_model->read($response['id']);
foreach (array('data', 'attachment', 'attachmentname') as $key) {
$this->assertEquals($original->$key, $stored->$key);
}
@@ -495,16 +495,16 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateBrokenAttachmentUpload()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
- $options['traffic']['limit'] = 0;
+ $options = parse_ini_file(CONF, true);
+ $options['traffic']['limit'] = 0;
$options['main']['fileupload'] = true;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
$_POST = Helper::getPasteWithAttachment();
unset($_POST['attachment']);
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
$this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not exists before posting data');
ob_start();
new PrivateBin;
@@ -521,10 +521,10 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateTooSoon()
{
$this->reset();
- $_POST = Helper::getPaste();
+ $_POST = Helper::getPaste();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
ob_start();
new PrivateBin;
ob_end_clean();
@@ -544,15 +544,15 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateValidNick()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
- $_POST = Helper::getPaste();
- $_POST['nickname'] = Helper::getComment()['meta']['nickname'];
+ $_POST = Helper::getPaste();
+ $_POST['nickname'] = Helper::getComment()['meta']['nickname'];
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
ob_start();
new PrivateBin;
$content = ob_get_contents();
@@ -574,17 +574,17 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateInvalidNick()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
- $_POST = Helper::getCommentPost();
- $_POST['pasteid'] = Helper::getPasteId();
- $_POST['parentid'] = Helper::getPasteId();
- $_POST['nickname'] = 'foo';
+ $_POST = Helper::getCommentPost();
+ $_POST['pasteid'] = Helper::getPasteId();
+ $_POST['parentid'] = Helper::getPasteId();
+ $_POST['nickname'] = 'foo';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
$this->_model->create(Helper::getPasteId(), Helper::getPaste());
ob_start();
new PrivateBin;
@@ -601,16 +601,16 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateComment()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
- $_POST = Helper::getCommentPost();
- $_POST['pasteid'] = Helper::getPasteId();
- $_POST['parentid'] = Helper::getPasteId();
+ $_POST = Helper::getCommentPost();
+ $_POST['pasteid'] = Helper::getPasteId();
+ $_POST['parentid'] = Helper::getPasteId();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
$this->_model->create(Helper::getPasteId(), Helper::getPaste());
ob_start();
new PrivateBin;
@@ -627,16 +627,16 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateInvalidComment()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
- $_POST = Helper::getCommentPost();
- $_POST['pasteid'] = Helper::getPasteId();
- $_POST['parentid'] = 'foo';
+ $_POST = Helper::getCommentPost();
+ $_POST['pasteid'] = Helper::getPasteId();
+ $_POST['parentid'] = 'foo';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
$this->_model->create(Helper::getPasteId(), Helper::getPaste());
ob_start();
new PrivateBin;
@@ -653,17 +653,17 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateCommentDiscussionDisabled()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
- $_POST = Helper::getCommentPost();
- $_POST['pasteid'] = Helper::getPasteId();
- $_POST['parentid'] = Helper::getPasteId();
+ $_POST = Helper::getCommentPost();
+ $_POST['pasteid'] = Helper::getPasteId();
+ $_POST['parentid'] = Helper::getPasteId();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
- $paste = Helper::getPaste(array('opendiscussion' => false));
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
+ $paste = Helper::getPaste(array('opendiscussion' => false));
$this->_model->create(Helper::getPasteId(), $paste);
ob_start();
new PrivateBin;
@@ -680,16 +680,16 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateCommentInvalidPaste()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
- $_POST = Helper::getCommentPost();
- $_POST['pasteid'] = Helper::getPasteId();
- $_POST['parentid'] = Helper::getPasteId();
+ $_POST = Helper::getCommentPost();
+ $_POST['pasteid'] = Helper::getPasteId();
+ $_POST['parentid'] = Helper::getPasteId();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
ob_start();
new PrivateBin;
$content = ob_get_contents();
@@ -705,19 +705,19 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateDuplicateComment()
{
$this->reset();
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
$this->_model->create(Helper::getPasteId(), Helper::getPaste());
$this->_model->createComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId(), Helper::getComment());
$this->assertTrue($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment exists before posting data');
- $_POST = Helper::getCommentPost();
- $_POST['pasteid'] = Helper::getPasteId();
- $_POST['parentid'] = Helper::getPasteId();
+ $_POST = Helper::getCommentPost();
+ $_POST['pasteid'] = Helper::getPasteId();
+ $_POST['parentid'] = Helper::getPasteId();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['REMOTE_ADDR'] = '::1';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REMOTE_ADDR'] = '::1';
ob_start();
new PrivateBin;
$content = ob_get_contents();
@@ -835,7 +835,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
$this->reset();
$paste = Helper::getPaste();
$this->_model->create(Helper::getPasteId(), $paste);
- $_SERVER['QUERY_STRING'] = Helper::getPasteId();
+ $_SERVER['QUERY_STRING'] = Helper::getPasteId();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
ob_start();
new PrivateBin;
@@ -859,7 +859,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testReadInvalidJson()
{
$this->reset();
- $_SERVER['QUERY_STRING'] = Helper::getPasteId();
+ $_SERVER['QUERY_STRING'] = Helper::getPasteId();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
ob_start();
new PrivateBin;
@@ -876,9 +876,9 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
{
$this->reset();
$oldPaste = Helper::getPaste();
- $meta = array(
+ $meta = array(
'syntaxcoloring' => true,
- 'postdate' => $oldPaste['meta']['postdate'],
+ 'postdate' => $oldPaste['meta']['postdate'],
'opendiscussion' => $oldPaste['meta']['opendiscussion'],
);
$oldPaste['meta'] = $meta;
@@ -931,8 +931,8 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
$this->reset();
$this->_model->create(Helper::getPasteId(), Helper::getPaste());
$this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data');
- $paste = $this->_model->read(Helper::getPasteId());
- $_GET['pasteid'] = Helper::getPasteId();
+ $paste = $this->_model->read(Helper::getPasteId());
+ $_GET['pasteid'] = Helper::getPasteId();
$_GET['deletetoken'] = hash_hmac('sha256', Helper::getPasteId(), $paste->meta->salt);
ob_start();
new PrivateBin;
@@ -953,7 +953,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
{
$this->reset();
$this->_model->create(Helper::getPasteId(), Helper::getPaste());
- $_GET['pasteid'] = 'foo';
+ $_GET['pasteid'] = 'foo';
$_GET['deletetoken'] = 'bar';
ob_start();
new PrivateBin;
@@ -973,7 +973,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testDeleteInexistantId()
{
$this->reset();
- $_GET['pasteid'] = Helper::getPasteId();
+ $_GET['pasteid'] = Helper::getPasteId();
$_GET['deletetoken'] = 'bar';
ob_start();
new PrivateBin;
@@ -993,7 +993,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
{
$this->reset();
$this->_model->create(Helper::getPasteId(), Helper::getPaste());
- $_GET['pasteid'] = Helper::getPasteId();
+ $_GET['pasteid'] = Helper::getPasteId();
$_GET['deletetoken'] = 'bar';
ob_start();
new PrivateBin;
@@ -1016,10 +1016,10 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
$burnPaste = Helper::getPaste(array('burnafterreading' => true));
$this->_model->create(Helper::getPasteId(), $burnPaste);
$this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data');
- $_POST['deletetoken'] = 'burnafterreading';
- $_SERVER['QUERY_STRING'] = Helper::getPasteId();
+ $_POST['deletetoken'] = 'burnafterreading';
+ $_SERVER['QUERY_STRING'] = Helper::getPasteId();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
ob_start();
new PrivateBin;
$content = ob_get_contents();
@@ -1037,10 +1037,10 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
$this->reset();
$this->_model->create(Helper::getPasteId(), Helper::getPaste());
$this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data');
- $_POST['deletetoken'] = 'burnafterreading';
- $_SERVER['QUERY_STRING'] = Helper::getPasteId();
+ $_POST['deletetoken'] = 'burnafterreading';
+ $_SERVER['QUERY_STRING'] = Helper::getPasteId();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
ob_start();
new PrivateBin;
$content = ob_get_contents();
@@ -1060,7 +1060,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
$this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not exist before being created');
$this->_model->create(Helper::getPasteId(), $expiredPaste);
$this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data');
- $_GET['pasteid'] = Helper::getPasteId();
+ $_GET['pasteid'] = Helper::getPasteId();
$_GET['deletetoken'] = 'does not matter in this context, but has to be set';
ob_start();
new PrivateBin;
@@ -1084,7 +1084,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
unset($paste['meta']['salt']);
$this->_model->create(Helper::getPasteId(), $paste);
$this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data');
- $_GET['pasteid'] = Helper::getPasteId();
+ $_GET['pasteid'] = Helper::getPasteId();
$_GET['deletetoken'] = hash_hmac('sha256', Helper::getPasteId(), ServerSalt::get());
ob_start();
new PrivateBin;
diff --git a/tst/PrivateBinWithDbTest.php b/tst/PrivateBinWithDbTest.php
index 73c257ba..2ed38461 100644
--- a/tst/PrivateBinWithDbTest.php
+++ b/tst/PrivateBinWithDbTest.php
@@ -1,9 +1,7 @@
null,
'pwd' => null,
'opt' => array(
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
- PDO::ATTR_PERSISTENT => true
+ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
+ PDO::ATTR_PERSISTENT => true,
),
);
@@ -27,7 +25,7 @@ class PrivateBinWithDbTest extends PrivateBinTest
}
ServerSalt::setPath($this->_path);
$this->_options['dsn'] = 'sqlite:' . $this->_path . DIRECTORY_SEPARATOR . 'tst.sq3';
- $this->_model = Database::getInstance($this->_options);
+ $this->_model = Database::getInstance($this->_options);
$this->reset();
}
@@ -35,13 +33,13 @@ class PrivateBinWithDbTest extends PrivateBinTest
{
parent::reset();
// but then inject a db config
- $options = parse_ini_file(CONF, true);
+ $options = parse_ini_file(CONF, true);
$options['model'] = array(
'class' => 'Database',
);
- $options['purge']['dir'] = $this->_path;
+ $options['purge']['dir'] = $this->_path;
$options['traffic']['dir'] = $this->_path;
- $options['model_options'] = $this->_options;
+ $options['model_options'] = $this->_options;
Helper::confBackup();
Helper::createIniFile(CONF, $options);
}
diff --git a/tst/RequestTest.php b/tst/RequestTest.php
index a6067056..f20209f5 100644
--- a/tst/RequestTest.php
+++ b/tst/RequestTest.php
@@ -17,15 +17,15 @@ class RequestTest extends PHPUnit_Framework_TestCase
public function reset()
{
$_SERVER = array();
- $_GET = array();
- $_POST = array();
+ $_GET = array();
+ $_POST = array();
}
public function testView()
{
$this->reset();
$_SERVER['REQUEST_METHOD'] = 'GET';
- $request = new Request;
+ $request = new Request;
$this->assertFalse($request->isJsonApiCall(), 'is HTML call');
$this->assertEquals('view', $request->getOperation());
}
@@ -34,8 +34,8 @@ class RequestTest extends PHPUnit_Framework_TestCase
{
$this->reset();
$_SERVER['REQUEST_METHOD'] = 'GET';
- $_SERVER['QUERY_STRING'] = 'foo';
- $request = new Request;
+ $_SERVER['QUERY_STRING'] = 'foo';
+ $request = new Request;
$this->assertFalse($request->isJsonApiCall(), 'is HTML call');
$this->assertEquals('foo', $request->getParam('pasteid'));
$this->assertEquals('read', $request->getOperation());
@@ -45,9 +45,9 @@ class RequestTest extends PHPUnit_Framework_TestCase
{
$this->reset();
$_SERVER['REQUEST_METHOD'] = 'GET';
- $_GET['pasteid'] = 'foo';
- $_GET['deletetoken'] = 'bar';
- $request = new Request;
+ $_GET['pasteid'] = 'foo';
+ $_GET['deletetoken'] = 'bar';
+ $request = new Request;
$this->assertFalse($request->isJsonApiCall(), 'is HTML call');
$this->assertEquals('delete', $request->getOperation());
$this->assertEquals('foo', $request->getParam('pasteid'));
@@ -57,9 +57,9 @@ class RequestTest extends PHPUnit_Framework_TestCase
public function testApiCreate()
{
$this->reset();
- $_SERVER['REQUEST_METHOD'] = 'PUT';
+ $_SERVER['REQUEST_METHOD'] = 'PUT';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $file = tempnam(sys_get_temp_dir(), 'FOO');
+ $file = tempnam(sys_get_temp_dir(), 'FOO');
file_put_contents($file, 'data=foo');
Request::setInputStream($file);
$request = new Request;
@@ -72,9 +72,9 @@ class RequestTest extends PHPUnit_Framework_TestCase
{
$this->reset();
$_SERVER['REQUEST_METHOD'] = 'POST';
- $_SERVER['HTTP_ACCEPT'] = 'application/json, text/javascript, */*; q=0.01';
- $_POST['attachment'] = 'foo';
- $request = new Request;
+ $_SERVER['HTTP_ACCEPT'] = 'application/json, text/javascript, */*; q=0.01';
+ $_POST['attachment'] = 'foo';
+ $request = new Request;
$this->assertTrue($request->isJsonApiCall(), 'is JSON Api call');
$this->assertEquals('create', $request->getOperation());
$this->assertEquals('foo', $request->getParam('attachment'));
@@ -84,9 +84,9 @@ class RequestTest extends PHPUnit_Framework_TestCase
{
$this->reset();
$_SERVER['REQUEST_METHOD'] = 'GET';
- $_SERVER['HTTP_ACCEPT'] = 'application/json, text/javascript, */*; q=0.01';
- $_SERVER['QUERY_STRING'] = 'foo';
- $request = new Request;
+ $_SERVER['HTTP_ACCEPT'] = 'application/json, text/javascript, */*; q=0.01';
+ $_SERVER['QUERY_STRING'] = 'foo';
+ $request = new Request;
$this->assertTrue($request->isJsonApiCall(), 'is JSON Api call');
$this->assertEquals('foo', $request->getParam('pasteid'));
$this->assertEquals('read', $request->getOperation());
@@ -95,11 +95,11 @@ class RequestTest extends PHPUnit_Framework_TestCase
public function testApiDelete()
{
$this->reset();
- $_SERVER['REQUEST_METHOD'] = 'POST';
+ $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
- $_SERVER['QUERY_STRING'] = 'foo';
- $_POST['deletetoken'] = 'bar';
- $request = new Request;
+ $_SERVER['QUERY_STRING'] = 'foo';
+ $_POST['deletetoken'] = 'bar';
+ $request = new Request;
$this->assertTrue($request->isJsonApiCall(), 'is JSON Api call');
$this->assertEquals('delete', $request->getOperation());
$this->assertEquals('foo', $request->getParam('pasteid'));
@@ -110,9 +110,9 @@ class RequestTest extends PHPUnit_Framework_TestCase
{
$this->reset();
$_SERVER['REQUEST_METHOD'] = 'GET';
- $_SERVER['HTTP_ACCEPT'] = 'text/html,text/html; charset=UTF-8,application/xhtml+xml, application/xml;q=0.9,*/*;q=0.8, text/csv,application/json';
- $_SERVER['QUERY_STRING'] = 'foo';
- $request = new Request;
+ $_SERVER['HTTP_ACCEPT'] = 'text/html,text/html; charset=UTF-8,application/xhtml+xml, application/xml;q=0.9,*/*;q=0.8, text/csv,application/json';
+ $_SERVER['QUERY_STRING'] = 'foo';
+ $request = new Request;
$this->assertFalse($request->isJsonApiCall(), 'is HTML call');
$this->assertEquals('foo', $request->getParam('pasteid'));
$this->assertEquals('read', $request->getOperation());
@@ -122,9 +122,9 @@ class RequestTest extends PHPUnit_Framework_TestCase
{
$this->reset();
$_SERVER['REQUEST_METHOD'] = 'GET';
- $_SERVER['HTTP_ACCEPT'] = 'application/xhtml+xml,text/html,text/html; charset=UTF-8, application/xml;q=0.9,*/*;q=0.8, text/csv,application/json';
- $_SERVER['QUERY_STRING'] = 'foo';
- $request = new Request;
+ $_SERVER['HTTP_ACCEPT'] = 'application/xhtml+xml,text/html,text/html; charset=UTF-8, application/xml;q=0.9,*/*;q=0.8, text/csv,application/json';
+ $_SERVER['QUERY_STRING'] = 'foo';
+ $request = new Request;
$this->assertFalse($request->isJsonApiCall(), 'is HTML call');
$this->assertEquals('foo', $request->getParam('pasteid'));
$this->assertEquals('read', $request->getOperation());
@@ -134,9 +134,9 @@ class RequestTest extends PHPUnit_Framework_TestCase
{
$this->reset();
$_SERVER['REQUEST_METHOD'] = 'GET';
- $_SERVER['HTTP_ACCEPT'] = 'text/plain,text/csv, application/xml;q=0.9, application/json, text/html,text/html; charset=UTF-8,application/xhtml+xml, */*;q=0.8';
- $_SERVER['QUERY_STRING'] = 'foo';
- $request = new Request;
+ $_SERVER['HTTP_ACCEPT'] = 'text/plain,text/csv, application/xml;q=0.9, application/json, text/html,text/html; charset=UTF-8,application/xhtml+xml, */*;q=0.8';
+ $_SERVER['QUERY_STRING'] = 'foo';
+ $request = new Request;
$this->assertTrue($request->isJsonApiCall(), 'is JSON Api call');
$this->assertEquals('foo', $request->getParam('pasteid'));
$this->assertEquals('read', $request->getOperation());
@@ -146,9 +146,9 @@ class RequestTest extends PHPUnit_Framework_TestCase
{
$this->reset();
$_SERVER['REQUEST_METHOD'] = 'GET';
- $_SERVER['HTTP_ACCEPT'] = 'text/plain,text/csv, application/xml;q=0.9, */*;q=0.8';
- $_SERVER['QUERY_STRING'] = 'foo';
- $request = new Request;
+ $_SERVER['HTTP_ACCEPT'] = 'text/plain,text/csv, application/xml;q=0.9, */*;q=0.8';
+ $_SERVER['QUERY_STRING'] = 'foo';
+ $request = new Request;
$this->assertFalse($request->isJsonApiCall(), 'is HTML call');
$this->assertEquals('foo', $request->getParam('pasteid'));
$this->assertEquals('read', $request->getOperation());
diff --git a/tst/ViewTest.php b/tst/ViewTest.php
index 4b8f0cb6..965f7814 100644
--- a/tst/ViewTest.php
+++ b/tst/ViewTest.php
@@ -10,15 +10,15 @@ class ViewTest extends PHPUnit_Framework_TestCase
private static $status = '!*#@?$+';
private static $formatters = array(
- 'plaintext' => 'Plain Text',
+ 'plaintext' => 'Plain Text',
'syntaxhighlighting' => 'Source Code',
- 'markdown' => 'Markdown',
+ 'markdown' => 'Markdown',
);
private static $formatter_default = 'plaintext';
private static $expire = array(
- '5min' => '5 minutes',
+ '5min' => '5 minutes',
'1hour' => '1 hour',
'never' => 'Never',
);
diff --git a/tst/Vizhash16x16Test.php b/tst/Vizhash16x16Test.php
index 76d2f95a..afcda562 100644
--- a/tst/Vizhash16x16Test.php
+++ b/tst/Vizhash16x16Test.php
@@ -29,7 +29,7 @@ class Vizhash16x16Test extends PHPUnit_Framework_TestCase
public function testVizhashGeneratesUniquePngsPerIp()
{
- $vz = new Vizhash16x16();
+ $vz = new Vizhash16x16();
$pngdata = $vz->generate(hash('sha512', '127.0.0.1'));
file_put_contents($this->_file, $pngdata);
$finfo = new finfo(FILEINFO_MIME_TYPE);