applying patch based on StyleCI ruleset

pull/132/head
El RIDO 8 years ago
parent c8b1296929
commit 1f46823942
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92

@ -9,10 +9,8 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin; namespace PrivateBin;
use PrivateBin\I18n;
use Exception; use Exception;
use PDO; use PDO;

@ -9,7 +9,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin\Data; namespace PrivateBin\Data;
use stdClass; use stdClass;

@ -9,13 +9,12 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin\Data; namespace PrivateBin\Data;
use PrivateBin\PrivateBin;
use Exception; use Exception;
use PDO; use PDO;
use PDOException; use PDOException;
use PrivateBin\PrivateBin;
use stdClass; use stdClass;
/** /**

@ -9,11 +9,10 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin\Data; namespace PrivateBin\Data;
use PrivateBin\Model\Paste;
use PrivateBin\Json; use PrivateBin\Json;
use PrivateBin\Model\Paste;
/** /**
* Filesystem * Filesystem

@ -9,10 +9,8 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin; namespace PrivateBin;
use PrivateBin\I18n;
use Exception; use Exception;
/** /**

@ -9,7 +9,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin; namespace PrivateBin;
/** /**
@ -296,12 +295,12 @@ class I18n
switch (self::$_language) { switch (self::$_language) {
case 'fr': case 'fr':
case 'zh': case 'zh':
return ($n > 1 ? 1 : 0); return $n > 1 ? 1 : 0;
case 'pl': case 'pl':
return ($n == 1 ? 0 : $n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2); return $n == 1 ? 0 : $n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2;
// en, de // en, de
default: default:
return ($n != 1 ? 1 : 0); return $n != 1 ? 1 : 0;
} }
} }

@ -9,7 +9,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin; namespace PrivateBin;
use Exception; use Exception;

@ -9,10 +9,8 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin; namespace PrivateBin;
use PrivateBin\Data;
use PrivateBin\Model\Paste; use PrivateBin\Model\Paste;
use PrivateBin\Persistence\PurgeLimiter; use PrivateBin\Persistence\PurgeLimiter;

@ -9,13 +9,12 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin\Model; namespace PrivateBin\Model;
use Exception;
use PrivateBin\Configuration; use PrivateBin\Configuration;
use PrivateBin\Data\AbstractData; use PrivateBin\Data\AbstractData;
use PrivateBin\Sjcl; use PrivateBin\Sjcl;
use Exception;
use stdClass; use stdClass;
/** /**

@ -9,14 +9,13 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin\Model; namespace PrivateBin\Model;
use PrivateBin\Sjcl; use Exception;
use Identicon\Identicon;
use PrivateBin\Persistence\TrafficLimiter; use PrivateBin\Persistence\TrafficLimiter;
use PrivateBin\Sjcl;
use PrivateBin\Vizhash16x16; use PrivateBin\Vizhash16x16;
use Identicon\Identicon;
use Exception;
/** /**
* Comment * Comment

@ -9,13 +9,12 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin\Model; namespace PrivateBin\Model;
use PrivateBin\PrivateBin; use Exception;
use PrivateBin\Persistence\ServerSalt; use PrivateBin\Persistence\ServerSalt;
use PrivateBin\PrivateBin;
use PrivateBin\Sjcl; use PrivateBin\Sjcl;
use Exception;
/** /**
* Paste * Paste
@ -307,7 +306,6 @@ class Paste extends AbstractModel
$this->_data->meta->burnafterreading === true; $this->_data->meta->burnafterreading === true;
} }
/** /**
* Check if paste has discussions enabled. * Check if paste has discussions enabled.
* *

@ -9,7 +9,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin\Persistence; namespace PrivateBin\Persistence;
use Exception; use Exception;

@ -9,7 +9,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin\Persistence; namespace PrivateBin\Persistence;
use PrivateBin\Configuration; use PrivateBin\Configuration;

@ -9,7 +9,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin\Persistence; namespace PrivateBin\Persistence;
use Exception; use Exception;

@ -9,7 +9,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin\Persistence; namespace PrivateBin\Persistence;
use PrivateBin\Configuration; use PrivateBin\Configuration;

@ -9,12 +9,11 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin; namespace PrivateBin;
use PrivateBin\Persistence\TrafficLimiter;
use PrivateBin\Persistence\ServerSalt;
use Exception; use Exception;
use PrivateBin\Persistence\ServerSalt;
use PrivateBin\Persistence\TrafficLimiter;
/** /**
* PrivateBin * PrivateBin

@ -9,7 +9,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin; namespace PrivateBin;
/** /**

@ -9,7 +9,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin; namespace PrivateBin;
/** /**

@ -9,7 +9,6 @@
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0 * @version 1.0
*/ */
namespace PrivateBin; namespace PrivateBin;
use Exception; use Exception;

@ -10,7 +10,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.0.5 beta PrivateBin 1.0 * @version 0.0.5 beta PrivateBin 1.0
*/ */
namespace PrivateBin; namespace PrivateBin;
/** /**
@ -23,7 +22,6 @@ namespace PrivateBin;
* echo $data; * echo $data;
* exit; * exit;
*/ */
class Vizhash16x16 class Vizhash16x16
{ {
/** /**
@ -105,7 +103,7 @@ class Vizhash16x16
$op = 'v'; $op = 'v';
if (($this->getInt() % 2) == 0) { if (($this->getInt() % 2) == 0) {
$op = 'h'; $op = 'h';
}; }
$image = $this->degrade($image, $op, array($r0, $g0, $b0), array(0, 0, 0)); $image = $this->degrade($image, $op, array($r0, $g0, $b0), array(0, 0, 0));
for ($i = 0; $i < 7; ++$i) { for ($i = 0; $i < 7; ++$i) {
@ -189,7 +187,7 @@ class Vizhash16x16
$diffs = array( $diffs = array(
(($color2[0] - $color1[0]) / $size), (($color2[0] - $color1[0]) / $size),
(($color2[1] - $color1[1]) / $size), (($color2[1] - $color1[1]) / $size),
(($color2[2] - $color1[2]) / $size) (($color2[2] - $color1[2]) / $size),
); );
for ($i = 0; $i < $size; ++$i) { for ($i = 0; $i < $size; ++$i) {
$r = $color1[0] + ($diffs[0] * $i); $r = $color1[0] + ($diffs[0] * $i);
@ -217,20 +215,20 @@ class Vizhash16x16
{ {
switch ($action % 7) { switch ($action % 7) {
case 0: case 0:
ImageFilledRectangle($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $color); imagefilledrectangle($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $color);
break; break;
case 1: case 1:
case 2: case 2:
ImageFilledEllipse($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $color); imagefilledellipse($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $color);
break; break;
case 3: case 3:
$points = array($this->getX(), $this->getY(), $this->getX(), $this->getY(), $this->getX(), $this->getY(), $this->getX(), $this->getY()); $points = array($this->getX(), $this->getY(), $this->getX(), $this->getY(), $this->getX(), $this->getY(), $this->getX(), $this->getY());
ImageFilledPolygon($image, $points, 4, $color); imagefilledpolygon($image, $points, 4, $color);
break; break;
default: default:
$start = $this->getInt() * 360 / 256; $start = $this->getInt() * 360 / 256;
$end = $start + $this->getInt() * 180 / 256; $end = $start + $this->getInt() * 180 / 256;
ImageFilledArc($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $start, $end, $color, IMG_ARC_PIE); imagefilledarc($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $start, $end, $color, IMG_ARC_PIE);
} }
} }
} }

@ -9,7 +9,6 @@
* DANGER: Too many options/settings and too high max iteration setting may trigger * DANGER: Too many options/settings and too high max iteration setting may trigger
* a fork bomb. Please save your work before executing this script. * a fork bomb. Please save your work before executing this script.
*/ */
include 'Bootstrap.php'; include 'Bootstrap.php';
$vrd = array('view', 'read', 'delete'); $vrd = array('view', 'read', 'delete');
@ -26,7 +25,7 @@ new ConfigurationTestGenerator(array(
'args' => array( 'args' => array(
'#<div[^>]*id="opendisc"[^>]*>#', '#<div[^>]*id="opendisc"[^>]*>#',
'$content', '$content',
'outputs enabled discussion correctly' 'outputs enabled discussion correctly',
), ),
), array( ), array(
'conditions' => array('steps' => array('create'), 'traffic/limit' => 10), 'conditions' => array('steps' => array('create'), 'traffic/limit' => 10),
@ -35,7 +34,7 @@ new ConfigurationTestGenerator(array(
'args' => array( 'args' => array(
1, 1,
'$response["status"]', '$response["status"]',
'when discussions are enabled, but invalid flag posted, fail to create paste' 'when discussions are enabled, but invalid flag posted, fail to create paste',
), ),
), array( ), array(
'conditions' => array('steps' => array('create'), 'traffic/limit' => 10), 'conditions' => array('steps' => array('create'), 'traffic/limit' => 10),
@ -43,11 +42,11 @@ new ConfigurationTestGenerator(array(
'type' => 'False', 'type' => 'False',
'args' => array( 'args' => array(
'$this->_model->exists(Helper::getPasteId())', '$this->_model->exists(Helper::getPasteId())',
'when discussions are enabled, but invalid flag posted, paste is not created' 'when discussions are enabled, but invalid flag posted, paste is not created',
), ),
), ),
), ),
'affects' => $vcud 'affects' => $vcud,
), array( ), array(
'setting' => false, 'setting' => false,
'tests' => array( 'tests' => array(
@ -56,11 +55,11 @@ new ConfigurationTestGenerator(array(
'args' => array( 'args' => array(
'#<div[^>]*id="opendisc"[^>]*>#', '#<div[^>]*id="opendisc"[^>]*>#',
'$content', '$content',
'outputs disabled discussion correctly' 'outputs disabled discussion correctly',
), ),
), ),
), ),
'affects' => $vrd 'affects' => $vrd,
), ),
), ),
'main/opendiscussion' => array( 'main/opendiscussion' => array(
@ -73,11 +72,11 @@ new ConfigurationTestGenerator(array(
'args' => array( 'args' => array(
'#<input[^>]+id="opendiscussion"[^>]*checked="checked"[^>]*>#', '#<input[^>]+id="opendiscussion"[^>]*checked="checked"[^>]*>#',
'$content', '$content',
'outputs checked discussion correctly' 'outputs checked discussion correctly',
), ),
), ),
), ),
'affects' => $vrd 'affects' => $vrd,
), array( ), array(
'setting' => false, 'setting' => false,
'tests' => array( 'tests' => array(
@ -87,11 +86,11 @@ new ConfigurationTestGenerator(array(
'args' => array( 'args' => array(
'#<input[^>]+id="opendiscussion"[^>]*checked="checked"[^>]*>#', '#<input[^>]+id="opendiscussion"[^>]*checked="checked"[^>]*>#',
'$content', '$content',
'outputs unchecked discussion correctly' 'outputs unchecked discussion correctly',
), ),
), ),
), ),
'affects' => $vrd 'affects' => $vrd,
), ),
), ),
'main/burnafterreadingselected' => array( 'main/burnafterreadingselected' => array(
@ -132,11 +131,11 @@ new ConfigurationTestGenerator(array(
'args' => array( 'args' => array(
'#<div[^>]*id="password"[^>]*>#', '#<div[^>]*id="password"[^>]*>#',
'$content', '$content',
'outputs password input correctly' 'outputs password input correctly',
), ),
), ),
), ),
'affects' => $vrd 'affects' => $vrd,
), array( ), array(
'setting' => false, 'setting' => false,
'tests' => array( 'tests' => array(
@ -146,11 +145,11 @@ new ConfigurationTestGenerator(array(
'args' => array( 'args' => array(
'#<div[^>]*id="password"[^>]*>#', '#<div[^>]*id="password"[^>]*>#',
'$content', '$content',
'removes password input correctly' 'removes password input correctly',
), ),
), ),
), ),
'affects' => $vrd 'affects' => $vrd,
), ),
), ),
'main/template' => array( 'main/template' => array(
@ -206,11 +205,11 @@ new ConfigurationTestGenerator(array(
'args' => array( 'args' => array(
1, 1,
'$response["status"]', '$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( ), array(
'setting' => 2097152, 'setting' => 2097152,
'tests' => array( 'tests' => array(
@ -221,7 +220,7 @@ new ConfigurationTestGenerator(array(
'args' => array( 'args' => array(
0, 0,
'$response["status"]', '$response["status"]',
'when sizelimit limit is not reached, successfully create paste' 'when sizelimit limit is not reached, successfully create paste',
), ),
), array( ), array(
'conditions' => array('steps' => array('create'), 'traffic/limit' => 0, 'main/burnafterreadingselected' => true), 'conditions' => array('steps' => array('create'), 'traffic/limit' => 0, 'main/burnafterreadingselected' => true),
@ -229,11 +228,11 @@ new ConfigurationTestGenerator(array(
'type' => 'True', 'type' => 'True',
'args' => array( 'args' => array(
'$this->_model->exists($response["id"])', '$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( 'traffic/limit' => array(
@ -246,18 +245,18 @@ new ConfigurationTestGenerator(array(
'args' => array( 'args' => array(
0, 0,
'$response["status"]', '$response["status"]',
'when traffic limit is disabled, successfully create paste' 'when traffic limit is disabled, successfully create paste',
), ),
), array( ), array(
'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152), 'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152),
'type' => 'True', 'type' => 'True',
'args' => array( 'args' => array(
'$this->_model->exists($response["id"])', '$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( ), array(
'setting' => 10, 'setting' => 10,
'tests' => array( 'tests' => array(
@ -267,11 +266,11 @@ new ConfigurationTestGenerator(array(
'args' => array( 'args' => array(
1, 1,
'$response["status"]', '$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( ), array(
'setting' => 2, 'setting' => 2,
'tests' => array( 'tests' => array(
@ -282,7 +281,7 @@ new ConfigurationTestGenerator(array(
'args' => array( 'args' => array(
0, 0,
'$response["status"]', '$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( ), array(
'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152), 'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152),
@ -290,11 +289,11 @@ new ConfigurationTestGenerator(array(
'type' => 'True', 'type' => 'True',
'args' => array( 'args' => array(
'$this->_model->exists($response["id"])', '$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 * @var array
*/ */
private $_configurations = array( private $_configurations = array(
array('options' => array(), 'tests' => array(), 'affects' => array()) array('options' => array(), 'tests' => array(), 'affects' => array()),
); );
/** /**

@ -113,7 +113,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{ {
Database::getInstance(array( Database::getInstance(array(
'dsn' => 'ibm:', 'usr' => null, 'pwd' => null, '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( Database::getInstance(array(
'dsn' => 'informix:', 'usr' => null, 'pwd' => null, '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( Database::getInstance(array(
'dsn' => 'mssql:', 'usr' => null, 'pwd' => null, '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( Database::getInstance(array(
'dsn' => 'mysql:', 'usr' => null, 'pwd' => null, '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( Database::getInstance(array(
'dsn' => 'oci:', 'usr' => null, 'pwd' => null, '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( Database::getInstance(array(
'dsn' => 'pgsql:', 'usr' => null, 'pwd' => null, '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() public function testGetFooInstance()
{ {
Database::getInstance(array( Database::getInstance(array(
'dsn' => 'foo:', 'usr' => null, 'pwd' => null, 'opt' => null 'dsn' => 'foo:', 'usr' => null, 'pwd' => null, 'opt' => null,
)); ));
} }
@ -231,7 +231,9 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{ {
mkdir($this->_path); mkdir($this->_path);
$path = $this->_path . DIRECTORY_SEPARATOR . 'attachement-test.sq3'; $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['dsn'] = 'sqlite:' . $path;
$this->_options['tbl'] = 'bar_'; $this->_options['tbl'] = 'bar_';
$model = Database::getInstance($this->_options); $model = Database::getInstance($this->_options);
@ -274,7 +276,9 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{ {
mkdir($this->_path); mkdir($this->_path);
$path = $this->_path . DIRECTORY_SEPARATOR . 'db-test.sq3'; $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['dsn'] = 'sqlite:' . $path;
$this->_options['tbl'] = 'foo_'; $this->_options['tbl'] = 'foo_';
$db = new PDO( $db = new PDO(
@ -294,13 +298,13 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
); );
$db->exec( $db->exec(
'CREATE TABLE foo_comment ( ' . 'CREATE TABLE foo_comment ( ' .
"dataid CHAR(16) NOT NULL, " . 'dataid CHAR(16) NOT NULL, ' .
'pasteid CHAR(16), ' . 'pasteid CHAR(16), ' .
'parentid CHAR(16), ' . 'parentid CHAR(16), ' .
'data BLOB, ' . 'data BLOB, ' .
'nickname BLOB, ' . 'nickname BLOB, ' .
'vizhash BLOB, ' . 'vizhash BLOB, ' .
"postdate INT );" 'postdate INT );'
); );
$this->assertInstanceOf(Database::class, Database::getInstance($this->_options)); $this->assertInstanceOf(Database::class, Database::getInstance($this->_options));

@ -1,9 +1,9 @@
<?php <?php
use PrivateBin\Data\Filesystem; use PrivateBin\Data\Filesystem;
use PrivateBin\Persistence\ServerSalt;
use PrivateBin\PrivateBin; use PrivateBin\PrivateBin;
use PrivateBin\Request; use PrivateBin\Request;
use PrivateBin\Persistence\ServerSalt;
class JsonApiTest extends PHPUnit_Framework_TestCase class JsonApiTest extends PHPUnit_Framework_TestCase
{ {

@ -1,5 +1,6 @@
<?php <?php
use Identicon\Identicon;
use PrivateBin\Configuration; use PrivateBin\Configuration;
use PrivateBin\Data\Database; use PrivateBin\Data\Database;
use PrivateBin\Model; use PrivateBin\Model;
@ -7,7 +8,6 @@ use PrivateBin\Model\Paste;
use PrivateBin\Persistence\ServerSalt; use PrivateBin\Persistence\ServerSalt;
use PrivateBin\Persistence\TrafficLimiter; use PrivateBin\Persistence\TrafficLimiter;
use PrivateBin\Vizhash16x16; use PrivateBin\Vizhash16x16;
use Identicon\Identicon;
class ModelTest extends PHPUnit_Framework_TestCase class ModelTest extends PHPUnit_Framework_TestCase
{ {
@ -22,7 +22,9 @@ class ModelTest extends PHPUnit_Framework_TestCase
/* Setup Routine */ /* Setup Routine */
Helper::confRestore(); Helper::confRestore();
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; $this->_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); ServerSalt::setPath($this->_path);
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['purge']['limit'] = 0; $options['purge']['limit'] = 0;

@ -1,9 +1,9 @@
<?php <?php
use PrivateBin\Data\Filesystem; use PrivateBin\Data\Filesystem;
use PrivateBin\PrivateBin;
use PrivateBin\Persistence\ServerSalt; use PrivateBin\Persistence\ServerSalt;
use PrivateBin\Persistence\TrafficLimiter; use PrivateBin\Persistence\TrafficLimiter;
use PrivateBin\PrivateBin;
class PrivateBinTest extends PHPUnit_Framework_TestCase class PrivateBinTest extends PHPUnit_Framework_TestCase
{ {

@ -1,9 +1,7 @@
<?php <?php
use PrivateBin\Data\Database; use PrivateBin\Data\Database;
use PrivateBin\PrivateBin;
use PrivateBin\Persistence\ServerSalt; use PrivateBin\Persistence\ServerSalt;
use PrivateBin\Persistence\TrafficLimiter;
require_once 'PrivateBinTest.php'; require_once 'PrivateBinTest.php';
@ -14,7 +12,7 @@ class PrivateBinWithDbTest extends PrivateBinTest
'pwd' => null, 'pwd' => null,
'opt' => array( 'opt' => array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_PERSISTENT => true PDO::ATTR_PERSISTENT => true,
), ),
); );

Loading…
Cancel
Save