81 Commits
master ... php8

Author SHA1 Message Date
github-actions[bot]
ba5c859d85 Merge remote-tracking branch 'origin/master' into php8 2022-11-03 18:55:30 +00:00
El RIDO
a731a1143c update jdenticon 2022-10-31 20:36:39 +01:00
github-actions[bot]
46013df620 Merge remote-tracking branch 'origin/master' into php8 2022-10-31 16:19:19 +00:00
github-actions[bot]
f0bbf99306 Merge remote-tracking branch 'origin/master' into php8 2022-10-31 16:07:38 +00:00
El RIDO
c44b252aa8 Merge branch 'master' into php8 2022-10-29 19:38:01 +02:00
El RIDO
34264cb7f5 Merge branch 'master' into php8 2022-10-26 08:24:41 +02:00
El RIDO
7b98d7381f allow tests to be manually triggered 2022-10-26 05:30:37 +02:00
github-actions[bot]
fa61e4507c Merge remote-tracking branch 'origin/master' into php8 2022-10-26 02:39:53 +00:00
github-actions[bot]
f79c8c63e5 Merge remote-tracking branch 'origin/master' into php8 2022-10-25 19:12:00 +00:00
El RIDO
5b3d61cedc revert, this one actually was correct 2022-10-25 06:58:42 +02:00
El RIDO
510103fd9f make tests compatible with newer phpunit 2022-10-25 06:55:24 +02:00
El RIDO
b890d768d1 enable use of PHP 8.2 2022-10-25 06:53:26 +02:00
El RIDO
27965d0287 make tests compatible with newer phpunit 2022-10-25 06:53:07 +02:00
El RIDO
8ed9fccf25 make YourlsProxyTest compatible with newer phpunit 2022-10-25 06:43:17 +02:00
El RIDO
522c2721a2 make YourlsProxyTest compatible with newer phpunit 2022-10-25 06:41:42 +02:00
El RIDO
17d7a6967e make YourlsProxyTest compatible with newer phpunit 2022-10-25 06:39:50 +02:00
El RIDO
f6edcc1acd Merge branch 'master' into php8 2022-10-25 06:37:15 +02:00
github-actions[bot]
5b2ec7f7c2 Merge remote-tracking branch 'origin/master' into php8 2022-10-23 03:14:46 +00:00
github-actions[bot]
5768b1e4bd Merge remote-tracking branch 'origin/master' into php8 2022-10-22 16:35:34 +00:00
github-actions[bot]
23928d26f0 Merge remote-tracking branch 'origin/master' into php8 2022-10-07 05:54:07 +00:00
github-actions[bot]
cbeb30adf1 Merge remote-tracking branch 'origin/master' into php8 2022-10-07 03:59:28 +00:00
github-actions[bot]
b488359e35 Merge remote-tracking branch 'origin/master' into php8 2022-09-30 03:25:00 +00:00
github-actions[bot]
9f541e6276 Merge remote-tracking branch 'origin/master' into php8 2022-09-29 19:06:55 +00:00
github-actions[bot]
4aa95107d3 Merge remote-tracking branch 'origin/master' into php8 2022-09-26 10:16:10 +00:00
github-actions[bot]
4f7b3d2ac3 Merge remote-tracking branch 'origin/master' into php8 2022-09-24 08:06:29 +00:00
github-actions[bot]
5165845b54 Merge remote-tracking branch 'origin/master' into php8 2022-09-18 12:45:32 +00:00
github-actions[bot]
05e236ed6c Merge remote-tracking branch 'origin/master' into php8 2022-08-24 04:28:45 +00:00
El RIDO
8c2cc18b66 Merge branch 'master' into php8 2022-07-31 08:53:52 +02:00
github-actions[bot]
d7e88b236e Merge remote-tracking branch 'origin/master' into php8 2022-06-10 02:59:39 +00:00
github-actions[bot]
b48430cd4d Merge remote-tracking branch 'origin/master' into php8 2022-06-08 18:29:26 +00:00
github-actions[bot]
b5d9850bee Merge remote-tracking branch 'origin/master' into php8 2022-06-06 05:36:56 +00:00
github-actions[bot]
8b534ace28 Merge remote-tracking branch 'origin/master' into php8 2022-06-02 17:22:48 +00:00
El RIDO
2ad79ebf71 add php 8.1 unit tests 2022-06-01 20:50:38 +02:00
El RIDO
a376f894a9 Merge branch 'php8' of github.com:PrivateBin/PrivateBin into php8 2022-06-01 20:48:33 +02:00
github-actions[bot]
43cd87c417 Merge remote-tracking branch 'origin/master' into php8 2022-05-02 17:22:36 +00:00
github-actions[bot]
b8be814015 Merge remote-tracking branch 'origin/master' into php8 2022-04-30 07:45:50 +00:00
github-actions[bot]
b73f4be25e Merge remote-tracking branch 'origin/master' into php8 2022-04-30 07:23:22 +00:00
github-actions[bot]
f18770eaa6 Merge remote-tracking branch 'origin/master' into php8 2022-04-28 17:44:58 +00:00
github-actions[bot]
878374979b Merge remote-tracking branch 'origin/master' into php8 2022-04-20 17:56:55 +00:00
github-actions[bot]
abd722d0e4 Merge remote-tracking branch 'origin/master' into php8 2022-04-14 04:20:29 +00:00
github-actions[bot]
16d6cfb1ac Merge remote-tracking branch 'origin/master' into php8 2022-04-11 17:09:34 +00:00
github-actions[bot]
60bb381796 Merge remote-tracking branch 'origin/master' into php8 2022-04-10 09:16:48 +00:00
github-actions[bot]
f2397ac532 Merge remote-tracking branch 'origin/master' into php8 2022-04-09 17:56:36 +00:00
github-actions[bot]
ebf6a92c8f Merge remote-tracking branch 'origin/master' into php8 2022-04-09 12:39:05 +00:00
github-actions[bot]
634b3a6605 Merge remote-tracking branch 'origin/master' into php8 2022-04-04 17:13:18 +00:00
github-actions[bot]
e770065edf Merge remote-tracking branch 'origin/master' into php8 2022-03-30 18:49:51 +00:00
github-actions[bot]
5f53150390 Merge remote-tracking branch 'origin/master' into php8 2022-03-28 17:06:05 +00:00
github-actions[bot]
184b8b567d Merge remote-tracking branch 'origin/master' into php8 2022-03-28 17:03:38 +00:00
github-actions[bot]
de6db843ba Merge remote-tracking branch 'origin/master' into php8 2022-03-23 19:45:37 +00:00
github-actions[bot]
6caf1a5f06 Merge remote-tracking branch 'origin/master' into php8 2022-03-01 05:45:16 +00:00
github-actions[bot]
bda1ab23b8 Merge remote-tracking branch 'origin/master' into php8 2022-02-28 18:22:17 +00:00
github-actions[bot]
50fb12e3b3 Merge remote-tracking branch 'origin/master' into php8 2022-02-27 18:33:35 +00:00
github-actions[bot]
955334ff91 Merge remote-tracking branch 'origin/master' into php8 2022-02-26 10:53:14 +00:00
El RIDO
fa7aa3e88c fix composer lock 2022-02-26 07:22:32 +01:00
El RIDO
38c13398fc Merge branch 'master' into php8 2022-02-26 06:51:32 +01:00
github-actions[bot]
14de09789e Merge remote-tracking branch 'origin/master' into php8 2022-02-18 05:51:15 +00:00
github-actions[bot]
595f9cf42e Merge remote-tracking branch 'origin/master' into php8 2022-02-18 05:18:21 +00:00
github-actions[bot]
fb0d13937b Merge remote-tracking branch 'origin/master' into php8 2022-02-17 19:38:19 +00:00
github-actions[bot]
26ae7db0eb Merge remote-tracking branch 'origin/master' into php8 2022-02-13 08:04:35 +00:00
github-actions[bot]
0212429c4a Merge remote-tracking branch 'origin/master' into php8 2022-02-13 07:59:02 +00:00
github-actions[bot]
484ab3cd84 Merge remote-tracking branch 'origin/master' into php8 2022-02-12 16:29:53 +00:00
github-actions[bot]
7694c1460b Merge remote-tracking branch 'origin/master' into php8 2022-02-12 16:18:17 +00:00
github-actions[bot]
8812b09f5f Merge remote-tracking branch 'origin/master' into php8 2022-01-31 05:41:10 +00:00
github-actions[bot]
f5d8d7735f Merge remote-tracking branch 'origin/master' into php8 2022-01-10 20:29:09 +00:00
github-actions[bot]
3a801bc238 Merge remote-tracking branch 'origin/master' into php8 2021-10-30 15:26:05 +00:00
El RIDO
91462da29d update composer 2021-10-07 22:39:57 +02:00
El RIDO
5c61a442a0 phpunit compatibility 2021-10-07 22:36:11 +02:00
El RIDO
9c81d85bb7 phpunit compatibility 2021-10-07 22:34:15 +02:00
El RIDO
168ce1d85c phpunit compatibility 2021-10-07 22:25:51 +02:00
El RIDO
1f6b962468 phpunit compatibility 2021-10-07 22:24:30 +02:00
El RIDO
1f95f57be9 phpunit compatibility 2021-10-07 22:22:32 +02:00
El RIDO
a2e479192f phpunit compatibility 2021-10-07 22:20:25 +02:00
El RIDO
3f469f715f Merge branch 'master' into php8 2021-10-07 22:17:11 +02:00
El RIDO
09133f4f10 kudos StyleCI for spotting the unneccessary namespace 2020-10-11 11:39:36 +02:00
El RIDO
ec190fdcf6 phpunit 9 requires php >= 7.3 2020-10-11 10:34:03 +02:00
El RIDO
17c3cb35c0 change tests for phpunit 9 support, breaking support with phpunit 5.6 2020-10-11 10:31:24 +02:00
El RIDO
37a620df95 return type void is required as of PHPunit 7, breaking test compatibility with PHP < 7.1 2020-10-10 12:22:20 +02:00
El RIDO
6f90df9545 updating tests by dropping PHPunit 4.6 support 2020-10-10 12:08:58 +02:00
El RIDO
99f50f6de3 update composer dependencies - test phpunit 9 2020-10-10 11:50:48 +02:00
El RIDO
50f81e1d2e unlock PHP 8 for composer 2020-10-10 11:24:36 +02:00
El RIDO
4312f77385 experimentally enable PHP 8 beta unit testing 2020-10-10 11:21:53 +02:00
26 changed files with 1101 additions and 928 deletions

View File

@@ -1,5 +1,7 @@
name: Tests
on: [push]
on:
push:
workflow_dispatch:
jobs:
@@ -12,23 +14,23 @@ jobs:
run: composer validate
- name: Install dependencies
run: composer install --prefer-dist --no-dev
PHPunit:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
php-versions: ['7.3', '7.4', '8.0', '8.1', '8.2']
name: PHP ${{ matrix.php-versions }} unit tests on ${{ matrix.operating-system }}
env:
extensions: gd, sqlite3
extensions-cache-key-name: phpextensions
steps:
# let's get started!
- name: Checkout
uses: actions/checkout@v3
# cache PHP extensions
- name: Setup cache environment
id: extcache
@@ -44,77 +46,75 @@ jobs:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ runner.os }}-${{ env.extensions-cache-key }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
# Setup GitHub CI PHP problem matchers
# https://github.com/shivammathur/setup-php#problem-matchers
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
# composer cache
- name: Remove composer lock
run: rm composer.lock
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
# http://man7.org/linux/man-pages/man1/date.1.html
# https://github.com/actions/cache#creating-a-cache-key
- name: Get Date
id: get-date
run: echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
shell: bash
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ steps.get-date.outputs.date }}-
# composer installation
- name: Setup PHPunit
run: composer install -n
- name: Install Google Cloud Storage
run: composer require google/cloud-storage
# testing
- name: Run unit tests
run: ../vendor/bin/phpunit --no-coverage
working-directory: tst
Mocha:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: 'js/package-lock.json'
- name: Setup Mocha
run: npm install -g mocha
- name: Setup Node modules
run: npm ci
working-directory: js
- name: Run unit tests
run: npm test
working-directory: js

View File

@@ -35,7 +35,7 @@
"aws/aws-sdk-php" : "3.239.0"
},
"require-dev" : {
"phpunit/phpunit" : "^4.6 || ^5.0"
"phpunit/phpunit" : "^9"
},
"autoload" : {
"psr-4" : {

1573
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,9 @@
<?php
use PHPUnit\Framework\TestCase;
use PrivateBin\Configuration;
class ConfigurationTest extends PHPUnit_Framework_TestCase
class ConfigurationTest extends TestCase
{
private $_minimalConfig;
@@ -10,7 +11,7 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
private $_path;
public function setUp()
public function setUp(): void
{
/* Setup Routine */
Helper::confBackup();
@@ -23,7 +24,7 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
}
}
public function tearDown()
public function tearDown(): void
{
/* Tear Down Routine */
Helper::rmDir($this->_path);
@@ -55,13 +56,11 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
$this->assertEquals($this->_options, $conf->get(), 'returns correct defaults on missing file');
}
/**
* @expectedException Exception
* @expectedExceptionCode 2
*/
public function testHandleBlankConfigFile()
{
file_put_contents(CONF, '');
$this->expectException(Exception::class);
$this->expectExceptionCode(2);
new Configuration;
}
@@ -72,25 +71,21 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
$this->assertEquals($this->_options, $conf->get(), 'returns correct defaults on empty file');
}
/**
* @expectedException Exception
* @expectedExceptionCode 3
*/
public function testHandleInvalidSection()
{
file_put_contents(CONF, $this->_minimalConfig);
$conf = new Configuration;
$this->expectException(Exception::class);
$this->expectExceptionCode(3);
$conf->getKey('foo', 'bar');
}
/**
* @expectedException Exception
* @expectedExceptionCode 4
*/
public function testHandleInvalidKey()
{
file_put_contents(CONF, $this->_minimalConfig);
$conf = new Configuration;
$this->expectException(Exception::class);
$this->expectExceptionCode(4);
$conf->getKey('foo');
}

View File

@@ -408,13 +408,14 @@ class ConfigurationTestGenerator
* DO NOT EDIT: This file is generated automatically using configGenerator.php
*/
use PHPUnit\Framework\TestCase;
use PrivateBin\Controller;
use PrivateBin\Data\Filesystem;
use PrivateBin\Persistence\ServerSalt;
use PrivateBin\Persistence\TrafficLimiter;
use PrivateBin\Request;
class ConfigurationCombinationsTest extends PHPUnit_Framework_TestCase
class ConfigurationCombinationsTest extends TestCase
{
private $_conf;
@@ -422,7 +423,7 @@ class ConfigurationCombinationsTest extends PHPUnit_Framework_TestCase
private $_path;
public function setUp()
public function setUp(): void
{
/* Setup Routine */
Helper::confBackup();
@@ -431,7 +432,7 @@ class ConfigurationCombinationsTest extends PHPUnit_Framework_TestCase
$this->reset();
}
public function tearDown()
public function tearDown(): void
{
/* Tear Down Routine */
unlink(CONF);
@@ -560,7 +561,7 @@ EOT;
case 'Delete':
$code .= <<<'EOT'
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'#<div[^>]*id="status"[^>]*>.*Paste was properly deleted[^<]*</div>#s',
$content,
'outputs deleted status correctly'

View File

@@ -1,18 +1,19 @@
<?php
use PHPUnit\Framework\TestCase;
use PrivateBin\Controller;
use PrivateBin\Data\Filesystem;
use PrivateBin\Persistence\ServerSalt;
use PrivateBin\Persistence\TrafficLimiter;
use PrivateBin\Request;
class ControllerTest extends PHPUnit_Framework_TestCase
class ControllerTest extends TestCase
{
protected $_data;
protected $_path;
public function setUp()
public function setUp(): void
{
/* Setup Routine */
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
@@ -22,7 +23,7 @@ class ControllerTest extends PHPUnit_Framework_TestCase
$this->reset();
}
public function tearDown()
public function tearDown(): void
{
/* Tear Down Routine */
unlink(CONF);
@@ -55,17 +56,17 @@ class ControllerTest extends PHPUnit_Framework_TestCase
new Controller;
$content = ob_get_contents();
ob_end_clean();
$this->assertContains(
$this->assertStringContainsString(
'<title>PrivateBin</title>',
$content,
'outputs title correctly'
);
$this->assertNotContains(
$this->assertStringNotContainsString(
'id="shortenbutton"',
$content,
'doesn\'t output shortener button'
);
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'# href="https://' . preg_quote($_SERVER['HTTP_HOST']) . '/">switching to HTTPS#',
$content,
'outputs configured https URL correctly'
@@ -85,7 +86,7 @@ class ControllerTest extends PHPUnit_Framework_TestCase
new Controller;
$content = ob_get_contents();
ob_end_clean();
$this->assertContains(
$this->assertStringContainsString(
'<title>PrivateBin</title>',
$content,
'outputs title correctly'
@@ -106,7 +107,7 @@ class ControllerTest extends PHPUnit_Framework_TestCase
new Controller;
$content = ob_get_contents();
ob_end_clean();
$this->assertContains(
$this->assertStringContainsString(
'<title>PrivateBin</title>',
$content,
'outputs title correctly'
@@ -127,7 +128,7 @@ class ControllerTest extends PHPUnit_Framework_TestCase
new Controller;
$content = ob_get_contents();
ob_end_clean();
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'#id="shortenbutton"[^>]*data-shortener="' . preg_quote($shortener) . '"#',
$content,
'outputs configured shortener URL correctly'
@@ -141,6 +142,8 @@ class ControllerTest extends PHPUnit_Framework_TestCase
public function testConf()
{
file_put_contents(CONF, '');
$this->expectException(Exception::class);
$this->expectExceptionCode(2);
new Controller;
}
@@ -436,8 +439,6 @@ class ControllerTest extends PHPUnit_Framework_TestCase
* silently removed, check that this case is handled
*
* @runInSeparateProcess
* @expectedException Exception
* @expectedExceptionCode 90
*/
public function testCreateBrokenUpload()
{
@@ -449,6 +450,8 @@ class ControllerTest extends PHPUnit_Framework_TestCase
$_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1';
$this->assertFalse($this->_data->exists(Helper::getPasteId()), 'paste does not exists before posting data');
$this->expectException(Exception::class);
$this->expectExceptionCode(90);
new Controller;
$this->assertFalse($this->_data->exists(Helper::getPasteId()), 'paste exists after posting data');
}
@@ -806,7 +809,7 @@ class ControllerTest extends PHPUnit_Framework_TestCase
new Controller;
$content = ob_get_contents();
ob_end_clean();
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'#<div[^>]*id="status"[^>]*>.*Paste was properly deleted\.#s',
$content,
'outputs deleted status correctly'
@@ -826,7 +829,7 @@ class ControllerTest extends PHPUnit_Framework_TestCase
new Controller;
$content = ob_get_contents();
ob_end_clean();
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'#<div[^>]*id="errormessage"[^>]*>.*Invalid paste ID\.#s',
$content,
'outputs delete error correctly'
@@ -845,7 +848,7 @@ class ControllerTest extends PHPUnit_Framework_TestCase
new Controller;
$content = ob_get_contents();
ob_end_clean();
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist, has expired or has been deleted\.#s',
$content,
'outputs delete error correctly'
@@ -864,7 +867,7 @@ class ControllerTest extends PHPUnit_Framework_TestCase
new Controller;
$content = ob_get_contents();
ob_end_clean();
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'#<div[^>]*id="errormessage"[^>]*>.*Wrong deletion token\. Paste was not deleted\.#s',
$content,
'outputs delete error correctly'
@@ -912,7 +915,7 @@ class ControllerTest extends PHPUnit_Framework_TestCase
new Controller;
$content = ob_get_contents();
ob_end_clean();
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist, has expired or has been deleted\.#s',
$content,
'outputs error correctly'
@@ -935,7 +938,7 @@ class ControllerTest extends PHPUnit_Framework_TestCase
new Controller;
$content = ob_get_contents();
ob_end_clean();
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'#<div[^>]*id="status"[^>]*>.*Paste was properly deleted\.#s',
$content,
'outputs deleted status correctly'

View File

@@ -17,7 +17,7 @@ class ControllerWithDbTest extends ControllerTest
),
);
public function setUp()
public function setUp(): void
{
/* Setup Routine */
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';

View File

@@ -14,7 +14,7 @@ class ControllerWithGcsTest extends ControllerTest
private static $_bucket;
private $_options = array();
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
$httpClient = new Client(array('debug'=>false));
$handler = HttpHandlerFactory::build($httpClient);
@@ -28,7 +28,7 @@ class ControllerWithGcsTest extends ControllerTest
self::$_bucket = self::$_client->createBucket($name);
}
public function setUp()
public function setUp(): void
{
/* Setup Routine */
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';

View File

@@ -1,11 +1,12 @@
<?php
use PHPUnit\Framework\TestCase;
use PrivateBin\Controller;
use PrivateBin\Data\Database;
use PrivateBin\Data\Filesystem;
use PrivateBin\Persistence\ServerSalt;
class DatabaseTest extends PHPUnit_Framework_TestCase
class DatabaseTest extends TestCase
{
private $_model;
@@ -18,14 +19,14 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
);
public function setUp()
public function setUp(): void
{
/* Setup Routine */
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
$this->_model = Database::getInstance($this->_options);
}
public function tearDown()
public function tearDown(): void
{
/* Tear Down Routine */
if (is_dir($this->_path)) {
@@ -42,7 +43,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
$this->assertNotEquals($salt, '');
ServerSalt::setStore($this->_model);
ServerSalt::get();
$this->assertFileNotExists($file, 'legacy ServerSalt got removed');
$this->assertFileDoesNotExist($file, 'legacy ServerSalt got removed');
$this->assertEquals($salt, ServerSalt::get(), 'ServerSalt got preserved & migrated');
}
@@ -136,124 +137,102 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
}
}
/**
* @expectedException PDOException
*/
public function testGetIbmInstance()
{
$this->expectException(PDOException::class);
Database::getInstance(array(
'dsn' => 'ibm:', 'usr' => null, 'pwd' => null,
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
));
}
/**
* @expectedException PDOException
*/
public function testGetInformixInstance()
{
$this->expectException(PDOException::class);
Database::getInstance(array(
'dsn' => 'informix:', 'usr' => null, 'pwd' => null,
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
));
}
/**
* @expectedException PDOException
*/
public function testGetMssqlInstance()
{
$this->expectException(PDOException::class);
Database::getInstance(array(
'dsn' => 'mssql:', 'usr' => null, 'pwd' => null,
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
));
}
/**
* @expectedException PDOException
*/
public function testGetMysqlInstance()
{
$this->expectException(PDOException::class);
Database::getInstance(array(
'dsn' => 'mysql:', 'usr' => null, 'pwd' => null,
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
));
}
/**
* @expectedException PDOException
*/
public function testGetOciInstance()
{
$this->expectException(PDOException::class);
Database::getInstance(array(
'dsn' => 'oci:', 'usr' => null, 'pwd' => null,
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
));
}
/**
* @expectedException PDOException
*/
public function testGetPgsqlInstance()
{
$this->expectException(PDOException::class);
Database::getInstance(array(
'dsn' => 'pgsql:', 'usr' => null, 'pwd' => null,
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
));
}
/**
* @expectedException Exception
* @expectedExceptionCode 5
*/
public function testGetFooInstance()
{
$this->expectException(Exception::class);
$this->expectExceptionCode(5);
Database::getInstance(array(
'dsn' => 'foo:', 'usr' => null, 'pwd' => null, 'opt' => null,
));
}
/**
* @expectedException Exception
* @expectedExceptionCode 6
*/
public function testMissingDsn()
{
$options = $this->_options;
unset($options['dsn']);
$this->expectException(Exception::class);
$this->expectExceptionCode(6);
Database::getInstance($options);
}
/**
* @expectedException Exception
* @expectedExceptionCode 6
*/
public function testMissingUsr()
{
$options = $this->_options;
unset($options['usr']);
$this->expectException(Exception::class);
$this->expectExceptionCode(6);
Database::getInstance($options);
}
/**
* @expectedException Exception
* @expectedExceptionCode 6
*/
public function testMissingPwd()
{
$options = $this->_options;
unset($options['pwd']);
$this->expectException(Exception::class);
$this->expectExceptionCode(6);
Database::getInstance($options);
}
/**
* @expectedException Exception
* @expectedExceptionCode 6
*/
public function testMissingOpt()
{
$options = $this->_options;
unset($options['opt']);
$this->expectException(Exception::class);
$this->expectExceptionCode(6);
Database::getInstance($options);
}

View File

@@ -1,8 +1,9 @@
<?php
use PHPUnit\Framework\TestCase;
use PrivateBin\Data\Filesystem;
class FilesystemTest extends PHPUnit_Framework_TestCase
class FilesystemTest extends TestCase
{
private $_model;
@@ -10,7 +11,7 @@ class FilesystemTest extends PHPUnit_Framework_TestCase
private $_invalidPath;
public function setUp()
public function setUp(): void
{
/* Setup Routine */
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
@@ -24,7 +25,7 @@ class FilesystemTest extends PHPUnit_Framework_TestCase
}
}
public function tearDown()
public function tearDown(): void
{
/* Tear Down Routine */
chmod($this->_invalidPath, 0700);
@@ -162,13 +163,13 @@ class FilesystemTest extends PHPUnit_Framework_TestCase
$this->_model->purge(10);
foreach ($ids as $dataid => $storagedir) {
$this->assertFileExists($storagedir . $dataid . '.php', "paste $dataid exists in new format");
$this->assertFileNotExists($storagedir . $dataid, "old format paste $dataid got removed");
$this->assertFileDoesNotExist($storagedir . $dataid, "old format paste $dataid got removed");
$this->assertTrue($this->_model->exists($dataid), "paste $dataid exists");
$this->assertEquals($this->_model->read($dataid), $paste, "paste $dataid wasn't modified in the conversion");
$storagedir .= $dataid . '.discussion' . DIRECTORY_SEPARATOR;
$this->assertFileExists($storagedir . $dataid . '.' . $commentid . '.' . $dataid . '.php', "comment of $dataid exists in new format");
$this->assertFileNotExists($storagedir . $dataid . '.' . $commentid . '.' . $dataid, "old format comment of $dataid got removed");
$this->assertFileDoesNotExist($storagedir . $dataid . '.' . $commentid . '.' . $dataid, "old format comment of $dataid got removed");
$this->assertTrue($this->_model->existsComment($dataid, $dataid, $commentid), "comment in paste $dataid exists");
$comment = $comment;
$comment['id'] = $commentid;

View File

@@ -2,14 +2,15 @@
use Google\Auth\HttpHandler\HttpHandlerFactory;
use GuzzleHttp\Client;
use PHPUnit\Framework\TestCase;
use PrivateBin\Data\GoogleCloudStorage;
class GoogleCloudStorageTest extends PHPUnit_Framework_TestCase
class GoogleCloudStorageTest extends TestCase
{
private static $_client;
private static $_bucket;
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
$httpClient = new Client(array('debug'=>false));
$handler = HttpHandlerFactory::build($httpClient);
@@ -23,7 +24,7 @@ class GoogleCloudStorageTest extends PHPUnit_Framework_TestCase
self::$_bucket = self::$_client->createBucket($name);
}
public function setUp()
public function setUp(): void
{
ini_set('error_log', stream_get_meta_data(tmpfile())['uri']);
$this->_model = GoogleCloudStorage::getInstance(array(
@@ -32,14 +33,14 @@ class GoogleCloudStorageTest extends PHPUnit_Framework_TestCase
));
}
public function tearDown()
public function tearDown(): void
{
foreach (self::$_bucket->objects() as $object) {
$object->delete();
}
}
public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
self::$_bucket->delete();
}

View File

@@ -1,8 +1,9 @@
<?php
use PHPUnit\Framework\TestCase;
use PrivateBin\Filter;
class FilterTest extends PHPUnit_Framework_TestCase
class FilterTest extends TestCase
{
public function testFilterMakesTimesHumanlyReadable()
{
@@ -12,12 +13,10 @@ class FilterTest extends PHPUnit_Framework_TestCase
$this->assertEquals('6 months', Filter::formatHumanReadableTime('6months'));
}
/**
* @expectedException Exception
* @expectedExceptionCode 30
*/
public function testFilterFailTimesHumanlyReadable()
{
$this->expectException(Exception::class);
$this->expectExceptionCode(30);
Filter::formatHumanReadableTime('five_minutes');
}

View File

@@ -1,8 +1,9 @@
<?php
use PHPUnit\Framework\TestCase;
use PrivateBin\FormatV2;
class FormatV2Test extends PHPUnit_Framework_TestCase
class FormatV2Test extends TestCase
{
public function testFormatV2ValidatorValidatesCorrectly()
{

View File

@@ -1,12 +1,13 @@
<?php
use PHPUnit\Framework\TestCase;
use PrivateBin\I18n;
class I18nTest extends PHPUnit_Framework_TestCase
class I18nTest extends TestCase
{
private $_translations = array();
public function setUp()
public function setUp(): void
{
/* Setup Routine */
$this->_translations = json_decode(
@@ -15,9 +16,9 @@ class I18nTest extends PHPUnit_Framework_TestCase
);
}
public function tearDown()
public function tearDown(): void
{
/* Tear Down Routine */
unset($_COOKIE['lang'], $_SERVER['HTTP_ACCEPT_LANGUAGE']);
}
public function testTranslationFallback()

View File

@@ -1,17 +1,18 @@
<?php
use PHPUnit\Framework\TestCase;
use PrivateBin\Controller;
use PrivateBin\Data\Filesystem;
use PrivateBin\Persistence\ServerSalt;
use PrivateBin\Request;
class JsonApiTest extends PHPUnit_Framework_TestCase
class JsonApiTest extends TestCase
{
protected $_model;
protected $_path;
public function setUp()
public function setUp(): void
{
/* Setup Routine */
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
@@ -33,7 +34,7 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
Helper::createIniFile(CONF, $options);
}
public function tearDown()
public function tearDown(): void
{
/* Tear Down Routine */
unlink(CONF);
@@ -286,7 +287,7 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
new Controller;
$content = ob_get_contents();
ob_end_clean();
$this->assertContains('id="pasteurl" href="https://example.com/1"', $content, 'outputs shortened URL correctly');
$this->assertStringContainsString('id="pasteurl" href="https://example.com/1"', $content, 'outputs shortened URL correctly');
}
/**
@@ -300,6 +301,6 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
new Controller;
$content = ob_get_contents();
ob_end_clean();
$this->assertContains('Error calling YOURLS.', $content, 'outputs error correctly');
$this->assertStringContainsString('Error calling YOURLS.', $content, 'outputs error correctly');
}
}

View File

@@ -1,6 +1,7 @@
<?php
use Jdenticon\Identicon;
use PHPUnit\Framework\TestCase;
use PrivateBin\Configuration;
use PrivateBin\Data\Database;
use PrivateBin\Model;
@@ -10,7 +11,7 @@ use PrivateBin\Persistence\ServerSalt;
use PrivateBin\Persistence\TrafficLimiter;
use PrivateBin\Vizhash16x16;
class ModelTest extends PHPUnit_Framework_TestCase
class ModelTest extends TestCase
{
private $_conf;
@@ -18,7 +19,7 @@ class ModelTest extends PHPUnit_Framework_TestCase
protected $_path;
public function setUp()
public function setUp(): void
{
/* Setup Routine */
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
@@ -44,7 +45,7 @@ class ModelTest extends PHPUnit_Framework_TestCase
$_SERVER['REMOTE_ADDR'] = '::1';
}
public function tearDown()
public function tearDown(): void
{
/* Tear Down Routine */
unlink(CONF);
@@ -167,10 +168,6 @@ class ModelTest extends PHPUnit_Framework_TestCase
$this->assertEquals(Helper::getPasteId(), $comment->getParentId(), 'comment parent ID gets initialized to paste ID');
}
/**
* @expectedException Exception
* @expectedExceptionCode 75
*/
public function testPasteDuplicate()
{
$pasteData = Helper::getPastePost();
@@ -182,13 +179,11 @@ class ModelTest extends PHPUnit_Framework_TestCase
$paste = $this->_model->getPaste();
$paste->setData($pasteData);
$this->expectException(Exception::class);
$this->expectExceptionCode(75);
$paste->store();
}
/**
* @expectedException Exception
* @expectedExceptionCode 76
*/
public function testStoreFail()
{
$path = $this->_path . DIRECTORY_SEPARATOR . 'model-store-test.sq3';
@@ -225,13 +220,11 @@ class ModelTest extends PHPUnit_Framework_TestCase
$paste = $model->getPaste();
$paste->setData($pasteData);
$this->expectException(Exception::class);
$this->expectExceptionCode(76);
$paste->store();
}
/**
* @expectedException Exception
* @expectedExceptionCode 70
*/
public function testCommentStoreFail()
{
$path = $this->_path . DIRECTORY_SEPARATOR . 'model-test.sq3';
@@ -273,13 +266,11 @@ class ModelTest extends PHPUnit_Framework_TestCase
$comment = $paste->getComment(Helper::getPasteId());
$comment->setData($commentData);
$this->expectException(Exception::class);
$this->expectExceptionCode(70);
$comment->store();
}
/**
* @expectedException Exception
* @expectedExceptionCode 69
*/
public function testCommentDuplicate()
{
$pasteData = Helper::getPastePost();
@@ -296,6 +287,8 @@ class ModelTest extends PHPUnit_Framework_TestCase
$comment = $paste->getComment(Helper::getPasteId());
$comment->setData($commentData);
$this->expectException(Exception::class);
$this->expectExceptionCode(69);
$comment->store();
}
@@ -334,52 +327,40 @@ class ModelTest extends PHPUnit_Framework_TestCase
$this->assertFalse(Paste::isValidId('../bar/baz'), 'path attack');
}
/**
* @expectedException Exception
* @expectedExceptionCode 64
*/
public function testInvalidPaste()
{
$this->_model->getPaste(Helper::getPasteId())->delete();
$paste = $this->_model->getPaste(Helper::getPasteId());
$this->expectException(Exception::class);
$this->expectExceptionCode(64);
$paste->get();
}
/**
* @expectedException Exception
* @expectedExceptionCode 75
*/
public function testInvalidPasteFormat()
{
$pasteData = Helper::getPastePost();
$pasteData['adata'][1] = 'format does not exist';
$paste = $this->_model->getPaste();
$this->expectException(Exception::class);
$this->expectExceptionCode(75);
$paste->setData($pasteData);
}
/**
* @expectedException Exception
* @expectedExceptionCode 60
*/
public function testInvalidPasteId()
{
$this->expectException(Exception::class);
$this->expectExceptionCode(60);
$this->_model->getPaste('');
}
/**
* @expectedException Exception
* @expectedExceptionCode 62
*/
public function testInvalidComment()
{
$paste = $this->_model->getPaste();
$this->expectException(Exception::class);
$this->expectExceptionCode(62);
$paste->getComment(Helper::getPasteId());
}
/**
* @expectedException Exception
* @expectedExceptionCode 67
*/
public function testInvalidCommentDeletedPaste()
{
$pasteData = Helper::getPastePost();
@@ -389,13 +370,11 @@ class ModelTest extends PHPUnit_Framework_TestCase
$comment = $paste->getComment(Helper::getPasteId());
$paste->delete();
$this->expectException(Exception::class);
$this->expectExceptionCode(67);
$comment->store();
}
/**
* @expectedException Exception
* @expectedExceptionCode 68
*/
public function testInvalidCommentData()
{
$pasteData = Helper::getPastePost();
@@ -405,18 +384,17 @@ class ModelTest extends PHPUnit_Framework_TestCase
$paste->store();
$comment = $paste->getComment(Helper::getPasteId());
$this->expectException(Exception::class);
$this->expectExceptionCode(68);
$comment->store();
}
/**
* @expectedException Exception
* @expectedExceptionCode 65
*/
public function testInvalidCommentParent()
{
$paste = $this->_model->getPaste(Helper::getPasteId());
$comment = $paste->getComment('');
$comment->store();
$this->expectException(Exception::class);
$this->expectExceptionCode(65);
$paste->getComment('');
}
public function testExpiration()
@@ -434,10 +412,6 @@ class ModelTest extends PHPUnit_Framework_TestCase
$this->assertEquals((float) 300, (float) $paste['meta']['time_to_live'], 'remaining time is set correctly', 1.0);
}
/**
* @expectedException Exception
* @expectedExceptionCode 64
*/
public function testCommentDeletion()
{
$pasteData = Helper::getPastePost();
@@ -446,6 +420,8 @@ class ModelTest extends PHPUnit_Framework_TestCase
$paste = $this->_model->getPaste();
$paste->setData($pasteData);
$paste->store();
$this->expectException(Exception::class);
$this->expectExceptionCode(64);
$paste->getComment(Helper::getPasteId())->delete();
}

View File

@@ -1,13 +1,14 @@
<?php
use PHPUnit\Framework\TestCase;
use PrivateBin\Data\Filesystem;
use PrivateBin\Persistence\PurgeLimiter;
class PurgeLimiterTest extends PHPUnit_Framework_TestCase
class PurgeLimiterTest extends TestCase
{
private $_path;
public function setUp()
public function setUp(): void
{
/* Setup Routine */
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
@@ -19,7 +20,7 @@ class PurgeLimiterTest extends PHPUnit_Framework_TestCase
);
}
public function tearDown()
public function tearDown(): void
{
/* Tear Down Routine */
Helper::rmDir($this->_path);

View File

@@ -1,9 +1,10 @@
<?php
use PHPUnit\Framework\TestCase;
use PrivateBin\Data\Filesystem;
use PrivateBin\Persistence\ServerSalt;
class ServerSaltTest extends PHPUnit_Framework_TestCase
class ServerSaltTest extends TestCase
{
private $_path;
@@ -13,7 +14,7 @@ class ServerSaltTest extends PHPUnit_Framework_TestCase
private $_invalidFile;
public function setUp()
public function setUp(): void
{
/* Setup Routine */
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
@@ -33,7 +34,7 @@ class ServerSaltTest extends PHPUnit_Framework_TestCase
$this->_invalidFile = $this->_invalidPath . DIRECTORY_SEPARATOR . 'salt.php';
}
public function tearDown()
public function tearDown(): void
{
/* Tear Down Routine */
chmod($this->_invalidPath, 0700);

View File

@@ -1,14 +1,15 @@
<?php
use PHPUnit\Framework\TestCase;
use PrivateBin\Data\Filesystem;
use PrivateBin\Persistence\ServerSalt;
use PrivateBin\Persistence\TrafficLimiter;
class TrafficLimiterTest extends PHPUnit_Framework_TestCase
class TrafficLimiterTest extends TestCase
{
private $_path;
public function setUp()
public function setUp(): void
{
/* Setup Routine */
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'trafficlimit';
@@ -17,7 +18,7 @@ class TrafficLimiterTest extends PHPUnit_Framework_TestCase
TrafficLimiter::setStore($store);
}
public function tearDown()
public function tearDown(): void
{
/* Tear Down Routine */
Helper::rmDir($this->_path . DIRECTORY_SEPARATOR);

View File

@@ -1,19 +1,10 @@
<?php
use PHPUnit\Framework\TestCase;
use PrivateBin\Request;
class RequestTest extends PHPUnit_Framework_TestCase
class RequestTest extends TestCase
{
public function setUp()
{
/* Setup Routine */
}
public function tearDown()
{
/* Tear Down Routine */
}
public function reset()
{
$_SERVER = array();

View File

@@ -1,9 +1,10 @@
<?php
use PHPUnit\Framework\TestCase;
use PrivateBin\I18n;
use PrivateBin\View;
class ViewTest extends PHPUnit_Framework_TestCase
class ViewTest extends TestCase
{
private static $error = 'foo bar';
@@ -29,7 +30,7 @@ class ViewTest extends PHPUnit_Framework_TestCase
private $_content = array();
public function setUp()
public function setUp(): void
{
/* Setup Routine */
$page = new View;
@@ -93,15 +94,10 @@ class ViewTest extends PHPUnit_Framework_TestCase
}
}
public function tearDown()
{
/* Tear Down Routine */
}
public function testTemplateRendersCorrectly()
{
foreach ($this->_content as $template => $content) {
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'#<div[^>]+id="errormessage"[^>]*>.*' . self::$error . '#s',
$content,
$template . ': outputs error correctly'
@@ -110,23 +106,23 @@ class ViewTest extends PHPUnit_Framework_TestCase
// yourlsproxy template only displays error message
continue;
}
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'#<[^>]+id="password"[^>]*>#',
$content,
$template . ': password available if configured'
);
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'#<input[^>]+id="opendiscussion"[^>]*checked="checked"[^>]*>#',
$content,
$template . ': checked discussion if configured'
);
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'#<[^>]+id="opendiscussionoption"[^>]*>#',
$content,
$template . ': discussions available if configured'
);
// testing version number in JS address, since other instances may not be present in different templates
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'#<script[^>]+src="js/privatebin.js\\?' . rawurlencode(self::$version) . '"[^>]*>#',
$content,
$template . ': outputs version correctly'
@@ -134,13 +130,11 @@ class ViewTest extends PHPUnit_Framework_TestCase
}
}
/**
* @expectedException Exception
* @expectedExceptionCode 80
*/
public function testMissingTemplate()
{
$test = new View;
$this->expectException(Exception::class);
$this->expectExceptionCode(80);
$test->draw('123456789 does not exist!');
}
}

View File

@@ -1,16 +1,17 @@
<?php
use PHPUnit\Framework\TestCase;
use PrivateBin\Data\Filesystem;
use PrivateBin\Persistence\ServerSalt;
use PrivateBin\Vizhash16x16;
class Vizhash16x16Test extends PHPUnit_Framework_TestCase
class Vizhash16x16Test extends TestCase
{
private $_file;
private $_path;
public function setUp()
public function setUp(): void
{
/* Setup Routine */
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
@@ -21,7 +22,7 @@ class Vizhash16x16Test extends PHPUnit_Framework_TestCase
ServerSalt::setStore(Filesystem::getInstance(array('dir' => $this->_path)));
}
public function tearDown()
public function tearDown(): void
{
/* Tear Down Routine */
chmod($this->_path, 0700);

View File

@@ -1,9 +1,10 @@
<?php
use PHPUnit\Framework\TestCase;
use PrivateBin\Configuration;
use PrivateBin\YourlsProxy;
class YourlsProxyTest extends PHPUnit_Framework_TestCase
class YourlsProxyTest extends TestCase
{
private $_conf;
@@ -11,7 +12,7 @@ class YourlsProxyTest extends PHPUnit_Framework_TestCase
private $_mock_yourls_service;
public function setUp()
public function setUp(): void
{
/* Setup Routine */
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
@@ -28,7 +29,7 @@ class YourlsProxyTest extends PHPUnit_Framework_TestCase
$this->_conf = new Configuration;
}
public function tearDown()
public function tearDown(): void
{
/* Tear Down Routine */
unlink(CONF);

View File

@@ -1,19 +1,22 @@
<phpunit bootstrap="Bootstrap.php" colors="true">
<testsuite name="PrivateBin Test Suite">
<directory suffix=".php">./</directory>
<exclude>ConfigurationTestGenerator.php</exclude>
</testsuite>
<filter>
<whitelist>
<directory suffix=".php">../lib</directory>
<exclude>
<file>../lib/Data/AbstractData.php</file>
</exclude>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="log/coverage-clover.xml" />
<log type="coverage-html" target="log/php-coverage-report" lowUpperBound="50" highLowerBound="80" />
<log type="testdox-html" target="log/testdox.html" />
</logging>
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="Bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">../lib</directory>
</include>
<exclude>
<file>../lib/Data/AbstractData.php</file>
</exclude>
<report>
<clover outputFile="log/coverage-clover.xml"/>
<html outputDirectory="log/php-coverage-report" lowUpperBound="50" highLowerBound="80"/>
</report>
</coverage>
<testsuite name="PrivateBin Test Suite">
<directory suffix=".php">./</directory>
<exclude>ConfigurationTestGenerator.php</exclude>
</testsuite>
<logging>
<testdoxHtml outputFile="log/testdox.html"/>
</logging>
</phpunit>

View File

@@ -5,18 +5,18 @@
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '78aa70e3ab9277172489f9d88f8fd08cc1d03c97',
'reference' => '46013df6201304840c8dab82af63cc9000a6d239',
'name' => 'privatebin/privatebin',
'dev' => false,
),
'versions' => array(
'jdenticon/jdenticon' => array(
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'pretty_version' => '1.0.2',
'version' => '1.0.2.0',
'type' => 'library',
'install_path' => __DIR__ . '/../jdenticon/jdenticon',
'aliases' => array(),
'reference' => '994ee07293fb978f983393ffcb2c0250592a6ac4',
'reference' => 'cabb7a44c413c318392a341c5d3ca30fcdd57a6f',
'dev_requirement' => false,
),
'mlocati/ip-lib' => array(
@@ -43,7 +43,7 @@
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '78aa70e3ab9277172489f9d88f8fd08cc1d03c97',
'reference' => '46013df6201304840c8dab82af63cc9000a6d239',
'dev_requirement' => false,
),
'yzalis/identicon' => array(

View File

@@ -21,6 +21,15 @@ class SuperSampleBuffer
const IDX_G = 3;
const IDX_B = 4;
private $samples;
private $samplesPerPixel;
private $pixelOffset;
private $subPixelOffset;
private $width;
private $used;
/**
* Creates a color buffer keeping an average color out of several
* color samples per pixel.