1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2025-01-03 14:32:40 +00:00

Replace PHPUnit annotations with attributes

This commit is contained in:
J. King 2024-12-27 20:28:38 -05:00
parent ba42b7b0c1
commit ba4d3f497b
77 changed files with 363 additions and 219 deletions

View file

@ -65,6 +65,7 @@ $rules = [
],
'function_declaration' => ['closure_function_spacing' => "none"],
'new_with_braces' => false, // no option to specify absence of braces
'php_unit_attributes' => true,
];
$finder = \PhpCsFixer\Finder::create();

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -26,4 +27,4 @@ if (function_exists("xdebug_set_filter")) {
if (class_exists(\Phake::class)) {
\Phake::setClient(\Phake::CLIENT_PHPUNIT9);
}
}

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -18,8 +19,10 @@ use JKingWeb\Arsse\REST\Fever\User as FeverUser;
use JKingWeb\Arsse\REST\Miniflux\Token as MinifluxToken;
use JKingWeb\Arsse\ImportExport\OPML;
use JKingWeb\Arsse\Service\Daemon;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
/** @covers \JKingWeb\Arsse\CLI */
#[CoversClass(\JKingWeb\Arsse\CLI::class)]
class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
protected $cli;
@ -47,7 +50,8 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
\Phake::verify($this->cli, \Phake::never())->loadConf();
}
/** @dataProvider provideHelpText */
#[DataProvider('provideHelpText')]
public function testPrintHelp(string $cmd, string $name): void {
$this->assertConsole($cmd, 0, str_replace("arsse.php", $name, CLI::USAGE));
\Phake::verify($this->cli, \Phake::never())->loadConf();
@ -66,7 +70,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
public function testStartTheDaemon(): void {
$srv = \Phake::mock(Service::class);
\Phake::when($srv)->watch->thenReturn(new \DateTimeImmutable);
\Phake::when($srv)->watch->thenReturn(new \DateTimeImmutable());
\Phake::when(Arsse::$obj)->get(Service::class)->thenReturn($srv);
$this->assertConsole("arsse.php daemon", 0);
\Phake::verify($this->cli)->loadConf();
@ -77,7 +81,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
$f = tempnam(sys_get_temp_dir(), "arsse");
$srv = \Phake::mock(Service::class);
$daemon = \Phake::mock(Daemon::class);
\Phake::when($srv)->watch->thenReturn(new \DateTimeImmutable);
\Phake::when($srv)->watch->thenReturn(new \DateTimeImmutable());
\Phake::when($daemon)->checkPIDFilePath->thenReturn($f);
\Phake::when($daemon)->fork->thenReturn(null);
\Phake::when(Arsse::$obj)->get(Service::class)->thenReturn($srv);
@ -95,7 +99,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
public function testFailToStartTheForkingDaemon(): void {
$srv = \Phake::mock(Service::class);
$daemon = \Phake::mock(Daemon::class);
\Phake::when($srv)->watch->thenReturn(new \DateTimeImmutable);
\Phake::when($srv)->watch->thenReturn(new \DateTimeImmutable());
\Phake::when($daemon)->checkPIDFilePath->thenThrow(new Service\Exception("pidDuplicate", ['pid' => 2112]));
\Phake::when($daemon)->fork->thenReturn(null);
\Phake::when(Arsse::$obj)->get(Service::class)->thenReturn($srv);
@ -109,14 +113,15 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
public function testRefreshAllFeeds(): void {
$srv = \Phake::mock(Service::class);
\Phake::when($srv)->watch->thenReturn(new \DateTimeImmutable);
\Phake::when($srv)->watch->thenReturn(new \DateTimeImmutable());
\Phake::when(Arsse::$obj)->get(Service::class)->thenReturn($srv);
$this->assertConsole("arsse.php feed refresh-all", 0);
\Phake::verify($this->cli)->loadConf();
\Phake::verify($srv)->watch(false);
}
/** @dataProvider provideFeedUpdates */
#[DataProvider('provideFeedUpdates')]
public function testRefreshAFeed(string $cmd, int $exitStatus, string $output): void {
\Phake::when(Arsse::$db)->feedUpdate(1, true)->thenReturn(true);
\Phake::when(Arsse::$db)->feedUpdate(2, true)->thenThrow(new \JKingWeb\Arsse\Feed\Exception("", ['url' => "http://example.com/"], $this->mockGuzzleException(ClientException::class, "", 404)));
@ -132,7 +137,8 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideDefaultConfigurationSaves */
#[DataProvider('provideDefaultConfigurationSaves')]
public function testSaveTheDefaultConfiguration(string $cmd, int $exitStatus, string $file): void {
$conf = \Phake::mock(Conf::class);
\Phake::when($conf)->exportFile("php://output", true)->thenReturn(true);
@ -153,7 +159,8 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideUserList */
#[DataProvider('provideUserList')]
public function testListUsers(string $cmd, array $list, int $exitStatus, string $output): void {
Arsse::$user = \Phake::mock(User::class);
\Phake::when(Arsse::$user)->list()->thenReturn($list);
@ -171,7 +178,8 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideUserAdditions */
#[DataProvider('provideUserAdditions')]
public function testAddAUser(string $cmd, int $exitStatus, string $output): void {
Arsse::$user = \Phake::mock(User::class);
\Phake::when(Arsse::$user)->add("john.doe@example.com", $this->anything())->thenThrow(new \JKingWeb\Arsse\User\ExceptionConflict("alreadyExists"));
@ -199,7 +207,8 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
\Phake::verify(Arsse::$user)->propertiesSet("jane.doe@example.com", ['admin' => true]);
}
/** @dataProvider provideUserAuthentication */
#[DataProvider('provideUserAuthentication')]
public function testAuthenticateAUser(string $cmd, int $exitStatus, string $output): void {
Arsse::$user = \Phake::mock(User::class);
\Phake::when(Arsse::$user)->auth->thenReturn(false);
@ -214,7 +223,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
}
public static function provideUserAuthentication(): iterable {
$l = new \JKingWeb\Arsse\Lang;
$l = new \JKingWeb\Arsse\Lang();
$success = $l("CLI.Auth.Success");
$failure = $l("CLI.Auth.Failure");
return [
@ -229,7 +238,8 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideUserRemovals */
#[DataProvider('provideUserRemovals')]
public function testRemoveAUser(string $cmd, int $exitStatus, string $output): void {
Arsse::$user = \Phake::mock(User::class);
\Phake::when(Arsse::$user)->remove->thenThrow(new \JKingWeb\Arsse\User\ExceptionConflict("doesNotExist"));
@ -244,7 +254,8 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideUserPasswordChanges */
#[DataProvider('provideUserPasswordChanges')]
public function testChangeAUserPassword(string $cmd, int $exitStatus, string $output): void {
$passwordChange = function($user, $pass = null) {
switch ($user) {
@ -273,7 +284,8 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideUserPasswordClearings */
#[DataProvider('provideUserPasswordClearings')]
public function testClearAUserPassword(string $cmd, int $exitStatus, string $output): void {
$passwordClear = function($user) {
switch ($user) {
@ -300,7 +312,8 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideOpmlExports */
#[DataProvider('provideOpmlExports')]
public function testExportToOpml(string $cmd, int $exitStatus, string $file, string $user, bool $flat): void {
$opml = \Phake::mock(OPML::class);
\Phake::when($opml)->exportFile("php://output", $user, $flat)->thenReturn(true);
@ -341,7 +354,8 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideOpmlImports */
#[DataProvider('provideOpmlImports')]
public function testImportFromOpml(string $cmd, int $exitStatus, string $file, string $user, bool $flat, bool $replace): void {
$opml = \Phake::mock(OPML::class);
\Phake::when($opml)->importFile("php://input", $user, $flat, $replace)->thenReturn(true);
@ -425,7 +439,8 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
\Phake::verify(Arsse::$user)->propertiesGet("john.doe@example.com");
}
/** @dataProvider provideMetadataChanges */
#[DataProvider('provideMetadataChanges')]
public function testSetMetadataOfAUser(string $cmd, string $user, array $in, array $out, int $exp): void {
Arsse::$user = \Phake::mock(User::class);
\Phake::when(Arsse::$user)->propertiesSet->thenReturn($out);

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -9,8 +10,10 @@ namespace JKingWeb\Arsse\TestCase\Conf;
use JKingWeb\Arsse\Conf;
use org\bovigo\vfs\vfsStream;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Depends;
/** @covers \JKingWeb\Arsse\Conf */
#[CoversClass(\JKingWeb\Arsse\Conf::class)]
class TestConf extends \JKingWeb\Arsse\Test\AbstractTest {
public static $vfs;
public static $path;
@ -43,7 +46,8 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertInstanceOf(Conf::class, new Conf);
}
/** @depends testLoadDefaultValues */
#[Depends('testLoadDefaultValues')]
public function testImportFromArray(): void {
$arr = [
'lang' => "xx",
@ -54,7 +58,8 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertEquals("xx", $conf->lang);
}
/** @depends testImportFromArray */
#[Depends('testImportFromArray')]
public function testImportFromFile(): void {
$conf = new Conf;
$conf->importFile(self::$path."confGood");
@ -63,38 +68,44 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertEquals("xx", $conf->lang);
}
/** @depends testImportFromFile */
#[Depends('testImportFromFile')]
public function testImportFromMissingFile(): void {
$this->assertException("fileMissing", "Conf");
$conf = new Conf(self::$path."confMissing");
}
/** @depends testImportFromFile */
#[Depends('testImportFromFile')]
public function testImportFromEmptyFile(): void {
$this->assertException("fileCorrupt", "Conf");
$conf = new Conf(self::$path."confEmpty");
}
/** @depends testImportFromFile */
#[Depends('testImportFromFile')]
public function testImportFromFileWithoutReadPermission(): void {
$this->assertException("fileUnreadable", "Conf");
$conf = new Conf(self::$path."confUnreadable");
}
/** @depends testImportFromFile */
#[Depends('testImportFromFile')]
public function testImportFromFileWhichIsNotAnArray(): void {
$this->assertException("fileCorrupt", "Conf");
$conf = new Conf(self::$path."confNotArray");
}
/** @depends testImportFromFile */
#[Depends('testImportFromFile')]
public function testImportFromFileWhichIsNotPhp(): void {
$this->assertException("fileCorrupt", "Conf");
// this should not print the output of the non-PHP file
$conf = new Conf(self::$path."confNotPHP");
}
/** @depends testImportFromFile */
#[Depends('testImportFromFile')]
public function testImportFromCorruptFile(): void {
$this->assertException("fileCorrupt", "Conf");
$conf = new Conf(self::$path."confCorrupt");
@ -145,8 +156,8 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertArraySubset($exp, $res);
}
/** @depends testExportToArray
* @depends testImportFromFile */
#[Depends('testExportToArray')]
#[Depends('testImportFromFile')]
public function testExportToFile(): void {
$conf = new Conf;
$conf->lang = ["en", "fr"]; // should not be exported: not scalar
@ -167,7 +178,8 @@ class TestConf extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertArraySubset($exp, $arr);
}
/** @depends testExportToFile */
#[Depends('testExportToFile')]
public function testExportToStdout(): void {
$conf = new Conf(self::$path."confGood");
$conf->exportFile(self::$path."confGood");

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -55,7 +56,7 @@ abstract class AbstractTest extends \JKingWeb\Arsse\Test\AbstractTest {
// but other engines should clean up from potentially interrupted prior tests
static::setConf();
try {
static::$drv = new static::$dbDriverClass;
static::$drv = new static::$dbDriverClass();
} catch (\JKingWeb\Arsse\Db\Exception $e) {
static::$failureReason = $e->getMessage();
return;

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -427,7 +428,7 @@ trait SeriesArticle {
unset($this->data, $this->matches, $this->fields, $this->checkTables, $this->user);
}
/**
/**
* @dataProvider provideContextMatches
* @covers \JKingWeb\Arsse\Database::articleList
* @covers \JKingWeb\Arsse\Database::articleQuery

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -9,8 +10,10 @@ namespace JKingWeb\Arsse\TestCase\Database;
use JKingWeb\Arsse\Database;
use JKingWeb\Arsse\Db\Transaction;
use PHPUnit\Framework\Attributes\CoversNothing;
use PHPUnit\Framework\Attributes\DataProvider;
/** @coversNothing */
#[CoversNothing]
class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest {
protected $db = null;
@ -36,9 +39,9 @@ class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest {
}
/**
* @dataProvider provideInClauses
* @covers \JKingWeb\Arsse\Database::generateIn
*/
*/
#[DataProvider('provideInClauses')]
public function testGenerateInClause(string $clause, array $values, array $inV, string $inT): void {
$types = array_fill(0, sizeof($values), $inT);
$exp = [$clause, $types, $values];
@ -73,9 +76,9 @@ class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest {
}
/**
* @dataProvider provideSearchClauses
* @covers \JKingWeb\Arsse\Database::generateSearch
*/
#[DataProvider('provideSearchClauses')]
public function testGenerateSearchClause(string $clause, array $values, array $inV, array $inC, bool $inAny): void {
// this is not an exhaustive test; integration tests already cover the ins and outs of the functionality
$types = array_fill(0, sizeof($values), "str");

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -43,7 +44,7 @@ abstract class BaseDriver extends \JKingWeb\Arsse\Test\AbstractTest {
"INSERT INTO arsse_meta(\"key\",value) values('schema_version','0')",
]);
// construct a fresh driver for each test
$this->drv = new static::$dbDriverClass;
$this->drv = new static::$dbDriverClass();
}
public function tearDown(): void {

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -8,6 +9,7 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db;
use JKingWeb\Arsse\Db\Statement;
use PHPUnit\Framework\Attributes\DataProvider;
abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest {
protected static $interface;
@ -47,7 +49,8 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertInstanceOf(Statement::class, new $this->statementClass(...$this->makeStatement("SELECT ? as value")));
}
/** @dataProvider provideBindings */
#[DataProvider('provideBindings')]
public function testBindATypedValue($value, string $type, string $exp): void {
if ($exp === "null") {
$query = "SELECT (? is null) as pass";
@ -60,7 +63,8 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertTrue((bool) $act);
}
/** @dataProvider provideBinaryBindings */
#[DataProvider('provideBinaryBindings')]
public function testHandleBinaryData($value, string $type, string $exp): void {
if ($exp === "null") {
$query = "SELECT (? is null) as pass";

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -33,7 +34,7 @@ class BaseUpdate extends \JKingWeb\Arsse\Test\AbstractTest {
parent::setUp();
self::setConf();
// construct a fresh driver for each test
$this->drv = new static::$dbDriverClass;
$this->drv = new static::$dbDriverClass();
$schemaId = (get_class($this->drv))::schemaID();
// set up a virtual filesystem for schema files
$this->vfs = vfsStream::setup("schemata", null, [$schemaId => []]);

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -7,11 +8,12 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\MySQL;
/**
* @group slow
* @group coverageOptional
* @coversNothing
*/
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\CoversNothing;
#[Group('slow')]
#[Group('coverageOptional')]
#[CoversNothing]
class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest {
use \JKingWeb\Arsse\Test\DatabaseDrivers\MySQL;

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -7,12 +8,13 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\MySQLPDO;
/**
* @group slow
* @group optional
* @group coverageOptional
* @coversNothing
*/
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\CoversNothing;
#[Group('slow')]
#[Group('optional')]
#[Group('coverageOptional')]
#[CoversNothing]
class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest {
use \JKingWeb\Arsse\Test\DatabaseDrivers\MySQLPDO;

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -7,11 +8,12 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\PostgreSQL;
/**
* @group slow
* @group coverageOptional
* @coversNothing
*/
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\CoversNothing;
#[Group('slow')]
#[Group('coverageOptional')]
#[CoversNothing]
class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest {
use \JKingWeb\Arsse\Test\DatabaseDrivers\PostgreSQL;

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -7,12 +8,13 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\PostgreSQLPDO;
/**
* @group slow
* @group optional
* @group coverageOptional
* @coversNothing
*/
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\CoversNothing;
#[Group('slow')]
#[Group('optional')]
#[Group('coverageOptional')]
#[CoversNothing]
class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest {
use \JKingWeb\Arsse\Test\DatabaseDrivers\PostgreSQLPDO;

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -7,10 +8,11 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\SQLite3;
/**
* @group optional
* @coversNothing
*/
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\CoversNothing;
#[Group('optional')]
#[CoversNothing]
class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest {
use \JKingWeb\Arsse\Test\DatabaseDrivers\SQLite3;

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -7,9 +8,9 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Db\SQLite3PDO;
/**
* @coversNothing
*/
use PHPUnit\Framework\Attributes\CoversNothing;
#[CoversNothing]
class TestDatabase extends \JKingWeb\Arsse\TestCase\Database\AbstractTest {
use \JKingWeb\Arsse\Test\DatabaseDrivers\SQLite3PDO;

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -9,9 +10,9 @@ namespace JKingWeb\Arsse\TestCase\Db;
use JKingWeb\Arsse\Db\Transaction;
use JKingWeb\Arsse\Db\Exception;
use PHPUnit\Framework\Attributes\CoversClass;
/**
* @covers \JKingWeb\Arsse\Db\Transaction */
#[CoversClass(\JKingWeb\Arsse\Db\Transaction::class)]
class TestTransaction extends \JKingWeb\Arsse\Test\AbstractTest {
protected $drv;

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -11,8 +12,10 @@ use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Lang;
use JKingWeb\Arsse\Exception;
use JKingWeb\Arsse\Lang\Exception as LangException;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Depends;
/** @covers \JKingWeb\Arsse\AbstractException */
#[CoversClass(\JKingWeb\Arsse\AbstractException::class)]
class TestException extends \JKingWeb\Arsse\Test\AbstractTest {
public function setUp(): void {
self::clearData(false);
@ -26,41 +29,31 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest {
throw new Exception("unknown");
}
/**
* @depends testBaseClass
*/
#[Depends('testBaseClass')]
public function testBaseClassWithoutMessage(): void {
$this->assertException("unknown");
throw new Exception();
throw new Exception;
}
/**
* @depends testBaseClass
*/
#[Depends('testBaseClass')]
public function testDerivedClass(): void {
$this->assertException("fileMissing", "Lang");
throw new LangException("fileMissing");
}
/**
* @depends testDerivedClass
*/
#[Depends('testDerivedClass')]
public function testDerivedClassWithMessageParameters(): void {
$this->assertException("fileMissing", "Lang");
throw new LangException("fileMissing", "en");
}
/**
* @depends testBaseClass
*/
#[Depends('testBaseClass')]
public function testBaseClassWithUnknownCode(): void {
$this->assertException("uncoded");
throw new Exception("testThisExceptionMessageDoesNotExist");
}
/**
* @depends testBaseClassWithUnknownCode
*/
#[Depends('testBaseClassWithUnknownCode')]
public function testDerivedClassWithMissingMessage(): void {
$this->assertException("uncoded");
throw new LangException("testThisExceptionMessageDoesNotExist");

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -11,13 +12,15 @@ use GuzzleHttp\Exception\BadResponseException;
use GuzzleHttp\Exception\TooManyRedirectsException;
use GuzzleHttp\Exception\TransferException;
use JKingWeb\Arsse\Feed\Exception as FeedException;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PicoFeed\PicoFeedException;
/**
* @covers \JKingWeb\Arsse\Feed\Exception
* @group slow */
#[CoversClass(\JKingWeb\Arsse\Feed\Exception::class)]
#[Group('slow')]
class TestException extends \JKingWeb\Arsse\Test\AbstractTest {
/** @dataProvider provideCurlErrors */
#[DataProvider('provideCurlErrors')]
public function testHandleCurlErrors(int $code, string $message): void {
$e = $this->mockGuzzleException(TransferException::class, "cURL error $code: Some message", 0);
$this->assertException($message, "Feed");
@ -116,7 +119,8 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideHTTPErrors */
#[DataProvider('provideHTTPErrors')]
public function testHandleHttpErrors(int $code, string $message): void {
$e = $this->mockGuzzleException(BadResponseException::class, "Irrelevant message", $code);
$this->assertException($message, "Feed");
@ -143,7 +147,8 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest {
return $out;
}
/** @dataProvider providePicoFeedException */
#[DataProvider('providePicoFeedException')]
public function testHandlePicofeedException(PicoFeedException $e, string $message) {
$this->assertException($message, "Feed");
throw new FeedException("", ['url' => "https://example.com/"], $e);
@ -171,7 +176,7 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest {
}
public function testHandleUnexpectedError() {
$e = new \Exception;
$e = new \Exception();
$this->assertException("internalError", "Feed");
throw new FeedException("", ['url' => "https://example.com/"], $e);
}

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -12,10 +13,12 @@ use JKingWeb\Arsse\Feed;
use JKingWeb\Arsse\Database;
use JKingWeb\Arsse\Misc\Date;
use JKingWeb\Arsse\Test\Result;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
/**
* @covers \JKingWeb\Arsse\Feed
* @group slow */
#[CoversClass(\JKingWeb\Arsse\Feed::class)]
#[Group('slow')]
class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest {
protected static $host = "http://localhost:8000/";
protected $base = "";
@ -224,7 +227,8 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertSame("http://example.com/1", $f->newItems[0]->url);
}
/** @dataProvider provide304ResponseURLs */
#[DataProvider('provide304ResponseURLs')]
public function testHandleCacheHeadersOn304(string $url): void {
// upon 304, the client should re-use the caching header values it supplied to the server
$t = Date::transform("2010-01-01T00:00:00Z", "unix");
@ -284,7 +288,8 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest {
}
}
/** @dataProvider provide304Timestamps */
#[DataProvider('provide304Timestamps')]
public function testComputeNextFetchFrom304(string $t, string $exp): void {
$t = $t ? strtotime($t) : "";
$f = new Feed(null, $this->base."NextFetch/NotModified?t=$t", Date::transform($t, "http"));

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -9,10 +10,11 @@ namespace JKingWeb\Arsse\TestCase\Feed;
use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Feed;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
/**
* @covers \JKingWeb\Arsse\Feed
* @group slow */
#[CoversClass(\JKingWeb\Arsse\Feed::class)]
#[Group('slow')]
class TestFetching extends \JKingWeb\Arsse\Test\AbstractTest {
protected static $host = "http://localhost:8000/";
protected $base = "";

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -10,8 +11,10 @@ namespace JKingWeb\Arsse\TestCase\ImportExport;
use JKingWeb\Arsse\ImportExport\AbstractImportExport;
use JKingWeb\Arsse\ImportExport\Exception;
use org\bovigo\vfs\vfsStream;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
/** @covers \JKingWeb\Arsse\ImportExport\AbstractImportExport */
#[CoversClass(\JKingWeb\Arsse\ImportExport\AbstractImportExport::class)]
class TestFile extends \JKingWeb\Arsse\Test\AbstractTest {
protected $vfs;
protected $path;
@ -45,7 +48,8 @@ class TestFile extends \JKingWeb\Arsse\Test\AbstractTest {
parent::tearDown();
}
/** @dataProvider provideFileExports */
#[DataProvider('provideFileExports')]
public function testExportToAFile(string $file, string $user, bool $flat, $exp): void {
$path = $this->path.$file;
try {
@ -84,7 +88,8 @@ class TestFile extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideFileImports */
#[DataProvider('provideFileImports')]
public function testImportFromAFile(string $file, string $user, bool $flat, bool $replace, $exp): void {
$path = $this->path.$file;
try {

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -11,8 +12,9 @@ use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Db\SQLite3\Driver;
use JKingWeb\Arsse\ImportExport\AbstractImportExport;
use JKingWeb\Arsse\Test\Database;
use PHPUnit\Framework\Attributes\CoversClass;
/** @covers \JKingWeb\Arsse\ImportExport\AbstractImportExport */
#[CoversClass(\JKingWeb\Arsse\ImportExport\AbstractImportExport::class)]
class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest {
protected $drv;
protected $proc;

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -8,8 +9,10 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Lang;
use JKingWeb\Arsse\Lang as TestClass;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Depends;
/** @covers \JKingWeb\Arsse\Lang */
#[CoversClass(\JKingWeb\Arsse\Lang::class)]
class TestBasic extends \JKingWeb\Arsse\Test\AbstractTest {
use \JKingWeb\Arsse\Test\Lang\Setup;
@ -21,9 +24,7 @@ class TestBasic extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertCount(sizeof($this->files), $this->l->list("en"));
}
/**
* @depends testListLanguages
*/
#[Depends('testListLanguages')]
public function testSetLanguage(): void {
$this->assertEquals("en", $this->l->set("en"));
$this->assertEquals("en_ca", $this->l->set("en_ca"));
@ -34,18 +35,14 @@ class TestBasic extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertEquals("", $this->l->set(""));
}
/**
* @depends testSetLanguage
*/
#[Depends('testSetLanguage')]
public function testLoadInternalStrings(): void {
$exp = (new \ReflectionClassConstant(TestClass::class, "REQUIRED"))->getValue();
$this->assertEquals("", $this->l->set("", true));
$this->assertCount(sizeof($exp), $this->l->dump());
}
/**
* @depends testLoadInternalStrings
*/
#[Depends('testLoadInternalStrings')]
public function testLoadDefaultLanguage(): void {
$this->assertEquals(TestClass::DEFAULT, $this->l->set(TestClass::DEFAULT, true));
$str = $this->l->dump();
@ -53,9 +50,7 @@ class TestBasic extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertArrayHasKey('Test.presentText', $str);
}
/**
* @depends testLoadDefaultLanguage
*/
#[Depends('testLoadDefaultLanguage')]
public function testLoadSupplementaryLanguage(): void {
$this->l->set(TestClass::DEFAULT, true);
$this->assertEquals("ja", $this->l->set("ja", true));

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -8,8 +9,10 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Lang;
use JKingWeb\Arsse\Lang as TestClass;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Depends;
/** @covers \JKingWeb\Arsse\Lang */
#[CoversClass(\JKingWeb\Arsse\Lang::class)]
class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest {
use \JKingWeb\Arsse\Test\Lang\Setup;
@ -26,9 +29,7 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertArrayNotHasKey('Test.absentText', $this->l->dump());
}
/**
* @depends testLazyLoad
*/
#[Depends('testLazyLoad')]
public function testGetWantedAndLoadedLocale(): void {
$this->l->set("en", true);
$this->l->set("ja");
@ -44,9 +45,7 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertEquals('und der Stein der Weisen', $str['Test.presentText']);
}
/**
* @depends testLoadCascadeOfFiles
*/
#[Depends('testLoadCascadeOfFiles')]
public function testLoadSubtag(): void {
$this->assertEquals("en_ca", $this->l->set("en_ca", true));
}
@ -56,49 +55,37 @@ class TestComplex extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertEquals('und der Stein der Weisen', $this->l->msg('Test.presentText'));
}
/**
* @depends testFetchAMessage
*/
#[Depends('testFetchAMessage')]
public function testFetchAMessageWithMissingParameters(): void {
$this->l->set("en_ca", true);
$this->assertEquals('{0} and {1}', $this->l->msg('Test.presentText'));
}
/**
* @depends testFetchAMessage
*/
#[Depends('testFetchAMessage')]
public function testFetchAMessageWithSingleNumericParameter(): void {
$this->l->set("en_ca", true);
$this->assertEquals('Default language file "en" missing', $this->l->msg('Exception.JKingWeb/Arsse/Lang/Exception.defaultFileMissing', TestClass::DEFAULT));
}
/**
* @depends testFetchAMessage
*/
#[Depends('testFetchAMessage')]
public function testFetchAMessageWithMultipleNumericParameters(): void {
$this->l->set("en_ca", true);
$this->assertEquals('Happy Rotter and the Philosopher\'s Stone', $this->l->msg('Test.presentText', ['Happy Rotter', 'the Philosopher\'s Stone']));
}
/**
* @depends testFetchAMessage
*/
#[Depends('testFetchAMessage')]
public function testFetchAMessageWithNamedParameters(): void {
$this->assertEquals('Message string "Test.absentText" missing from all loaded language files (en)', $this->l->msg('Exception.JKingWeb/Arsse/Lang/Exception.stringMissing', ['msgID' => 'Test.absentText', 'fileList' => 'en']));
}
/**
* @depends testFetchAMessage
*/
#[Depends('testFetchAMessage')]
public function testReloadDefaultStrings(): void {
$this->l->set("de", true);
$this->l->set("en", true);
$this->assertEquals('and the Philosopher\'s Stone', $this->l->msg('Test.presentText'));
}
/**
* @depends testFetchAMessage
*/
#[Depends('testFetchAMessage')]
public function testReloadGeneralTagAfterSubtag(): void {
$this->l->set("en", true);
$this->l->set("en_us", true);

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -8,8 +9,9 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Lang;
use JKingWeb\Arsse\Lang as TestClass;
use PHPUnit\Framework\Attributes\CoversClass;
/** @covers \JKingWeb\Arsse\Lang */
#[CoversClass(\JKingWeb\Arsse\Lang::class)]
class TestErrors extends \JKingWeb\Arsse\Test\AbstractTest {
use \JKingWeb\Arsse\Test\Lang\Setup;

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -8,8 +9,9 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Misc;
use JKingWeb\Arsse\Misc\Date;
use PHPUnit\Framework\Attributes\CoversClass;
/** @covers \JKingWeb\Arsse\Misc\Date */
#[CoversClass(\JKingWeb\Arsse\Misc\Date::class)]
class TestDate extends \JKingWeb\Arsse\Test\AbstractTest {
public function testNormalizeADate(): void {
$exp = new \DateTimeImmutable("2018-01-01T00:00:00Z");

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -8,8 +9,9 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Misc;
use JKingWeb\Arsse\Factory;
use PHPUnit\Framework\Attributes\CoversClass;
/** @covers \JKingWeb\Arsse\Factory */
#[CoversClass(\JKingWeb\Arsse\Factory::class)]
class TestFactory extends \JKingWeb\Arsse\Test\AbstractTest {
public function testInstantiateAClass(): void {
$f = new Factory;

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -10,11 +11,13 @@ namespace JKingWeb\Arsse\TestCase\Misc;
use JKingWeb\Arsse\Misc\HTTP;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use Psr\Http\Message\ResponseInterface;
/** @covers \JKingWeb\Arsse\Misc\HTTP */
#[CoversClass(\JKingWeb\Arsse\Misc\HTTP::class)]
class TestHTTP extends \JKingWeb\Arsse\Test\AbstractTest {
/** @dataProvider provideMediaTypes */
#[DataProvider('provideMediaTypes')]
public function testMatchMediaType(string $header, array $types, bool $exp): void {
$msg = (new Request("POST", "/"))->withHeader("Content-Type", $header);
$this->assertSame($exp, HTTP::matchType($msg, ...$types));
@ -36,7 +39,8 @@ class TestHTTP extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideTypedMessages */
#[DataProvider('provideTypedMessages')]
public function testCreateResponses(string $type, array $params, ResponseInterface $exp): void {
$act = call_user_func(["JKingWeb\\Arsse\\Misc\\HTTP", $type], ...$params);
$this->assertMessage($exp, $act);

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -9,11 +10,10 @@ namespace JKingWeb\Arsse\TestCase\Misc;
use JKingWeb\Arsse\Misc\Query;
use JKingWeb\Arsse\Misc\QueryFilter;
use PHPUnit\Framework\Attributes\CoversClass;
/**
* @covers \JKingWeb\Arsse\Misc\Query
* @covers \JKingWeb\Arsse\Misc\QueryFilter
*/
#[CoversClass(\JKingWeb\Arsse\Misc\Query::class)]
#[CoversClass(\JKingWeb\Arsse\Misc\QueryFilter::class)]
class TestQuery extends \JKingWeb\Arsse\Test\AbstractTest {
public function testBasicQuery(): void {
$q = new Query("select * from table where a = ?", "int", 3);

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -8,8 +9,10 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Misc;
use JKingWeb\Arsse\Rule\Rule;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
/** @covers \JKingWeb\Arsse\Rule\Rule */
#[CoversClass(\JKingWeb\Arsse\Rule\Rule::class)]
class TestRule extends \JKingWeb\Arsse\Test\AbstractTest {
public function testPrepareAPattern(): void {
$exp = "`\\`..\\`..\\`..\\\\\\`..`u";
@ -28,7 +31,8 @@ class TestRule extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertSame("", Rule::prep(""));
}
/** @dataProvider provideApplications */
#[DataProvider('provideApplications')]
public function testApplyRules(string $keepRule, string $blockRule, string $title, array $categories, $exp): void {
$keepRule = Rule::prep($keepRule);
$blockRule = Rule::prep($blockRule);

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -8,10 +9,12 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\Misc;
use JKingWeb\Arsse\Misc\URL;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
/** @covers \JKingWeb\Arsse\Misc\URL */
#[CoversClass(\JKingWeb\Arsse\Misc\URL::class)]
class TestURL extends \JKingWeb\Arsse\Test\AbstractTest {
/** @dataProvider provideNormalizations */
#[DataProvider('provideNormalizations')]
public function testNormalizeAUrl(string $url, string $exp, ?string $user = null, ?string $pass = null): void {
$this->assertSame($exp, URL::normalize($url, $user, $pass));
}
@ -73,7 +76,8 @@ class TestURL extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideQueries */
#[DataProvider('provideQueries')]
public function testAppendQueryParameters(string $url, string $query, string $exp): void {
$this->assertSame($exp, URL::queryAppend($url, $query));
}
@ -89,7 +93,8 @@ class TestURL extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideAbsolutes */
#[DataProvider('provideAbsolutes')]
public function testDetermineAbsoluteness(bool $exp, string $url): void {
$this->assertSame($exp, URL::absolute($url));
}

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -10,8 +11,9 @@ namespace JKingWeb\Arsse\TestCase\Misc;
use JKingWeb\Arsse\Misc\ValueInfo as I;
use JKingWeb\Arsse\Test\Misc\StrClass;
use JKingWeb\Arsse\Test\Result;
use PHPUnit\Framework\Attributes\DataProvider;
/** @covers \JKingWeb\Arsse\Misc\ValueInfo */
#[CoversClass(\JKingWeb\Arsse\Misc\ValueInfo::class)]
class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
public function testGetIntegerInfo(): void {
$tests = [
@ -70,7 +72,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
[[], 0],
["some string", 0],
[" ", 0],
[new \StdClass, 0],
[new \StdClass(), 0],
[new StrClass(""), I::NULL],
[new StrClass("1"), I::VALID],
[new StrClass("0"), I::VALID | I::ZERO],
@ -145,7 +147,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
[[], 0],
["some string", I::VALID],
[" ", I::VALID | I::WHITE],
[new \StdClass, 0],
[new \StdClass(), 0],
[new StrClass(""), I::VALID | I::EMPTY],
[new StrClass("1"), I::VALID],
[new StrClass("0"), I::VALID],
@ -216,7 +218,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
[[], false, false],
["some string", false, false],
[" ", false, false],
[new \StdClass, false, false],
[new \StdClass(), false, false],
[new StrClass(""), false, true],
[new StrClass("1"), true, true],
[new StrClass("0"), false, true],
@ -288,7 +290,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
[[], null],
["some string", null],
[" ", null],
[new \StdClass, null],
[new \StdClass(), null],
[new StrClass(""), false],
[new StrClass("1"), true],
[new StrClass("0"), false],
@ -306,7 +308,8 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
}
}
/** @dataProvider provideSimpleNormalizationValues */
#[DataProvider('provideSimpleNormalizationValues')]
public function testNormalizeSimpleValues($input, string $typeName, $exp, bool $pass, bool $strict, bool $drop): void {
$assert = function($exp, $act, string $msg) {
if (is_null($exp)) {
@ -365,7 +368,8 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
}
}
/** @dataProvider provideDateNormalizationValues */
#[DataProvider('provideDateNormalizationValues')]
public function testNormalizeDateValues($input, $format, $exp, bool $strict, bool $drop): void {
if ($strict && $drop) {
$modeName = "strict drop";
@ -511,7 +515,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
[[], [null,true], [false,false], [0, false], [0.0, false], ["", false], [[], true], [null, false]],
["some string", [null,true], [true, false], [0, false], [0.0, false], ["some string", true], [["some string"], false], [null, false]],
[" ", [null,true], [true, false], [0, false], [0.0, false], [" ", true], [[" "], false], [null, false]],
[new \StdClass, [null,true], [true, false], [0, false], [0.0, false], ["", false], [[new \StdClass], false], [null, false]],
[new \StdClass(), [null,true], [true, false], [0, false], [0.0, false], ["", false], [[new \StdClass()], false], [null, false]],
[new StrClass(""), [null,true], [false,true], [0, false], [0.0, false], ["", true], [[new StrClass("")], false], [null, false]],
[new StrClass("1"), [null,true], [true, true], [1, true], [1.0, true], ["1", true], [[new StrClass("1")], false], [null, false]],
[new StrClass("0"), [null,true], [false,true], [0, true], [0.0, true], ["0", true], [[new StrClass("0")], false], [null, false]],

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -10,11 +11,13 @@ namespace JKingWeb\Arsse\TestCase\REST\Miniflux;
use JKingWeb\Arsse\Misc\HTTP;
use JKingWeb\Arsse\REST\Miniflux\Status;
use JKingWeb\Arsse\REST\Miniflux\V1;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use Psr\Http\Message\ResponseInterface;
/** @covers \JKingWeb\Arsse\REST\Miniflux\Status */
#[CoversClass(\JKingWeb\Arsse\REST\Miniflux\Status::class)]
class TestStatus extends \JKingWeb\Arsse\Test\AbstractTest {
/** @dataProvider provideRequests */
#[DataProvider('provideRequests')]
public function testAnswerStatusRequests(string $url, string $method, ResponseInterface $exp): void {
$act = (new Status)->dispatch($this->serverRequest($method, $url, ""));
$this->assertMessage($exp, $act);

View file

@ -84,7 +84,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
\Phake::when(Arsse::$user)->propertiesGet->thenReturn(['num' => 42, 'admin' => false, 'root_folder_name' => null, 'tz' => "Asia/Gaza"]);
\Phake::when(Arsse::$user)->begin->thenReturn($this->transaction);
//initialize a handler
$this->h = new V1();
$this->h = new V1;
}
protected static function v($value) {

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -9,9 +10,10 @@ namespace JKingWeb\Arsse\TestCase\REST\NextcloudNews;
use JKingWeb\Arsse\Misc\HTTP;
use JKingWeb\Arsse\REST\NextcloudNews\Versions;
use PHPUnit\Framework\Attributes\CoversClass;
use Psr\Http\Message\ResponseInterface;
/** @covers \JKingWeb\Arsse\REST\NextcloudNews\Versions */
#[CoversClass(\JKingWeb\Arsse\REST\NextcloudNews\Versions::class)]
class TestVersions extends \JKingWeb\Arsse\Test\AbstractTest {
public function setUp(): void {
parent::setUp();

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -19,10 +20,12 @@ use Psr\Http\Message\ResponseInterface;
use GuzzleHttp\Psr7\Response;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\ServerRequest;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
/** @covers \JKingWeb\Arsse\REST */
#[CoversClass(\JKingWeb\Arsse\REST::class)]
class TestREST extends \JKingWeb\Arsse\Test\AbstractTest {
/** @dataProvider provideApiMatchData */
#[DataProvider('provideApiMatchData')]
public function testMatchAUrlToAnApi($apiList, string $input, array $exp): void {
$r = new REST($apiList);
try {
@ -58,9 +61,10 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideAuthenticableRequests */
#[DataProvider('provideAuthenticableRequests')]
public function testAuthenticateRequests(array $serverParams, array $expAttr): void {
$r = new REST();
$r = new REST;
// create a mock user manager
Arsse::$user = \Phake::mock(User::class);
\Phake::when(Arsse::$user)->auth->thenReturn(false);
@ -93,7 +97,7 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest {
public function testSendAuthenticationChallenges(): void {
self::setConf();
$r = new REST();
$r = new REST;
$in = HTTP::respEmpty(401);
$exp = $in->withHeader("WWW-Authenticate", 'Basic realm="OOK", charset="UTF-8"');
$act = $r->challenge($in, "OOK");
@ -103,9 +107,10 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertMessage($exp, $act);
}
/** @dataProvider provideUnnormalizedOrigins */
#[DataProvider('provideUnnormalizedOrigins')]
public function testNormalizeOrigins(string $origin, string $exp, ?array $ports = null): void {
$r = new REST();
$r = new REST;
$act = $r->corsNormalizeOrigin($origin, $ports);
$this->assertSame($exp, $act);
}
@ -146,7 +151,8 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideCorsNegotiations */
#[DataProvider('provideCorsNegotiations')]
public function testNegotiateCors($origin, bool $exp, ?string $allowed = null, ?string $denied = null): void {
self::setConf();
$rMock = \Phake::partialMock(REST::class);
@ -184,9 +190,10 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideCorsHeaders */
#[DataProvider('provideCorsHeaders')]
public function testAddCorsHeaders(string $reqMethod, array $reqHeaders, array $resHeaders, array $expHeaders): void {
$r = new REST();
$r = new REST;
$req = new Request($reqMethod, "php://memory", $reqHeaders);
$res = HTTP::respEmpty(204, $resHeaders);
$exp = HTTP::respEmpty(204, $expHeaders);
@ -248,7 +255,8 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideUnnormalizedResponses */
#[DataProvider('provideUnnormalizedResponses')]
public function testNormalizeHttpResponses(ResponseInterface $res, ResponseInterface $exp, ?RequestInterface $req = null): void {
$rMock = \Phake::partialMock(REST::class);
\Phake::when($rMock)->corsNegotiate->thenReturn(true);
@ -284,7 +292,8 @@ class TestREST extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideMockRequests */
#[DataProvider('provideMockRequests')]
public function testDispatchRequests(ServerRequest $req, string $method, bool $called, string $class = "", string $target = ""): void {
$rMock = \Phake::partialMock(REST::class);
\Phake::when($rMock)->normalizeResponse->thenReturnCallback(function($res) {

View file

@ -147,7 +147,7 @@ LONG_STRING;
'expires' => "2112-12-21 21:12:00",
'user' => self::$userId,
]);
$this->h = new API();
$this->h = new API;
}
protected function req($data, string $method = "POST", string $target = "", ?string $strData = null, ?string $user = null): ResponseInterface {

View file

@ -26,7 +26,7 @@ class TestIcon extends \JKingWeb\Arsse\Test\AbstractTest {
Arsse::$user = \Phake::mock(User::class);
// create a mock database interface
Arsse::$db = \Phake::mock(Database::class);
$this->h = new Icon();
$this->h = new Icon;
}
protected function req(string $target, string $method = "GET", ?string $user = null): ResponseInterface {

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -9,8 +10,10 @@ namespace JKingWeb\Arsse\TestCase\REST\TinyTinyRSS;
use JKingWeb\Arsse\Context\Context;
use JKingWeb\Arsse\REST\TinyTinyRSS\Search;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
/** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Search */
#[CoversClass(\JKingWeb\Arsse\REST\TinyTinyRSS\Search::class)]
class TestSearch extends \JKingWeb\Arsse\Test\AbstractTest {
public static function provideSearchStrings(): iterable {
return [
@ -118,7 +121,8 @@ class TestSearch extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider provideSearchStrings */
#[DataProvider('provideSearchStrings')]
public function testApplySearchToContext(string $search, $exp): void {
$act = Search::parse($search, "UTC");
$this->assertEquals($exp, $act);

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -10,8 +11,11 @@ namespace JKingWeb\Arsse\TestCase\Service;
use JKingWeb\Arsse\Service\Daemon;
use JKingWeb\Arsse\Service\Exception;
use org\bovigo\vfs\vfsStream;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
/** @covers \JKingWeb\Arsse\Service\Daemon */
#[CoversClass(\JKingWeb\Arsse\Service\Daemon::class)]
class TestDaemon extends \JKingWeb\Arsse\Test\AbstractTest {
protected $pidfiles = [
'errors' => [
@ -47,7 +51,8 @@ class TestDaemon extends \JKingWeb\Arsse\Test\AbstractTest {
$this->daemon = \Phake::partialMock(Daemon::class);
}
/** @dataProvider providePathResolutions */
#[DataProvider('providePathResolutions')]
public function testResolveRelativePaths(string $path, $cwd, $exp): void {
// set up mock daemon class
\Phake::when($this->daemon)->cwd->thenReturn($cwd);
@ -73,7 +78,8 @@ class TestDaemon extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider providePidFileChecks */
#[DataProvider('providePidFileChecks')]
public function testCheckPidFiles(string $file, bool $accessible, $exp): void {
$vfs = vfsStream::setup("pidtest", 0777, $this->pidfiles);
$path = $vfs->url()."/";
@ -109,7 +115,8 @@ class TestDaemon extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/** @dataProvider providePidReadChecks */
#[DataProvider('providePidReadChecks')]
public function testCheckPidReads(string $file, $exp) {
$vfs = vfsStream::setup("pidtest", 0777, $this->pidfiles);
$path = $vfs->url()."/pid/";
@ -155,10 +162,8 @@ class TestDaemon extends \JKingWeb\Arsse\Test\AbstractTest {
];
}
/**
* @dataProvider providePidWriteChecks
* @requires extension posix
*/
#[DataProvider('providePidWriteChecks')]
#[RequiresPhpExtension('posix')]
public function testCheckPidWrites(string $file, $exp) {
$pid = (string) posix_getpid();
$vfs = vfsStream::setup("pidtest", 0777, $this->pidfiles);

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -11,8 +12,9 @@ use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Database;
use JKingWeb\Arsse\Service\Driver as DriverInterface;
use JKingWeb\Arsse\Service\Serial\Driver;
use PHPUnit\Framework\Attributes\CoversClass;
/** @covers \JKingWeb\Arsse\Service\Serial\Driver */
#[CoversClass(\JKingWeb\Arsse\Service\Serial\Driver::class)]
class TestSerial extends \JKingWeb\Arsse\Test\AbstractTest {
public function setUp(): void {
parent::setUp();

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -11,8 +12,9 @@ use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Database;
use JKingWeb\Arsse\Service;
use JKingWeb\Arsse\Misc\Date;
use PHPUnit\Framework\Attributes\CoversClass;
/** @covers \JKingWeb\Arsse\Service */
#[CoversClass(\JKingWeb\Arsse\Service::class)]
class TestService extends \JKingWeb\Arsse\Test\AbstractTest {
protected $srv;
@ -20,7 +22,7 @@ class TestService extends \JKingWeb\Arsse\Test\AbstractTest {
parent::setUp();
self::setConf();
Arsse::$db = \Phake::mock(Database::class);
$this->srv = new Service();
$this->srv = new Service;
}
public function testCheckIn(): void {

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -10,8 +11,9 @@ namespace JKingWeb\Arsse\TestCase\Service;
use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Service\Driver as DriverInterface;
use JKingWeb\Arsse\Service\Subprocess\Driver;
use PHPUnit\Framework\Attributes\CoversClass;
/** @covers \JKingWeb\Arsse\Service\Subprocess\Driver */
#[CoversClass(\JKingWeb\Arsse\Service\Subprocess\Driver::class)]
class TestSubprocess extends \JKingWeb\Arsse\Test\AbstractTest {
public function setUp(): void {
parent::setUp();

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -13,8 +14,10 @@ use JKingWeb\Arsse\Conf;
use JKingWeb\Arsse\Lang;
use JKingWeb\Arsse\User;
use JKingWeb\Arsse\Database;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
/** @covers \JKingWeb\Arsse\Arsse */
#[CoversClass(\JKingWeb\Arsse\Arsse::class)]
class TestArsse extends \JKingWeb\Arsse\Test\AbstractTest {
public function setUp(): void {
self::clearData(false);
@ -46,7 +49,8 @@ class TestArsse extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertInstanceOf(User::class, Arsse::$user);
}
/** @dataProvider provideExtensionChecks */
#[DataProvider('provideExtensionChecks')]
public function testCheckForExtensions(array $ext, $exp): void {
if ($exp instanceof \Exception) {
$this->assertException($exp);

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -11,8 +12,11 @@ use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Database;
use JKingWeb\Arsse\User\Driver as DriverInterface;
use JKingWeb\Arsse\User\Internal\Driver;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
/** @covers \JKingWeb\Arsse\User\Internal\Driver */
#[CoversClass(\JKingWeb\Arsse\User\Internal\Driver::class)]
class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest {
protected $d;
@ -33,10 +37,8 @@ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertTrue(strlen(Driver::driverName()) > 0);
}
/**
* @dataProvider provideAuthentication
* @group slow
*/
#[DataProvider('provideAuthentication')]
#[Group('slow')]
public function testAuthenticateAUser(string $user, $password, bool $exp): void {
\Phake::when(Arsse::$db)->userPasswordGet("john.doe@example.com")->thenReturn('$2y$10$1zbqRJhxM8uUjeSBPp4IhO90xrqK0XjEh9Z16iIYEFRV4U.zeAFom'); // hash of "secret"
\Phake::when(Arsse::$db)->userPasswordGet("jane.doe@example.com")->thenReturn('$2y$10$bK1ljXfTSyc2D.NYvT.Eq..OpehLRXVbglW.23ihVuyhgwJCd.7Im'); // hash of "superman"

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -14,8 +15,10 @@ use JKingWeb\Arsse\Db\Transaction;
use JKingWeb\Arsse\User\ExceptionConflict;
use JKingWeb\Arsse\User\ExceptionInput;
use JKingWeb\Arsse\User\Driver;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
/** @covers \JKingWeb\Arsse\User */
#[CoversClass(\JKingWeb\Arsse\User::class)]
class TestUser extends \JKingWeb\Arsse\Test\AbstractTest {
protected $drv;
@ -54,7 +57,8 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertNotEquals($pass1, $pass2);
}
/** @dataProvider provideAuthentication */
#[DataProvider('provideAuthentication')]
public function testAuthenticateAUser(bool $preAuth, string $user, string $password, bool $exp): void {
Arsse::$conf->userPreAuth = $preAuth;
\Phake::when($this->drv)->auth->thenReturn(false);
@ -156,7 +160,8 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest {
}
}
/** @dataProvider provideInvalidUserNames */
#[DataProvider('provideInvalidUserNames')]
public function testAddAnInvalidUser(string $user): void {
$u = new User($this->drv);
$this->assertException("invalidUsername", "User", "ExceptionInput");
@ -240,7 +245,8 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest {
\Phake::verify($this->drv)->userRename($old, $old);
}
/** @dataProvider provideInvalidUserNames */
#[DataProvider('provideInvalidUserNames')]
public function testRenameAUserToAnInvalidName(string $new): void {
$u = new User($this->drv);
$this->assertException("invalidUsername", "User", "ExceptionInput");
@ -405,7 +411,8 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest {
}
}
/** @dataProvider provideProperties */
#[DataProvider('provideProperties')]
public function testGetThePropertiesOfAUser(array $exp, array $base, array $extra): void {
$user = "john.doe@example.com";
$exp = array_merge(['num' => null], array_combine(array_keys(User::PROPERTIES), array_fill(0, sizeof(User::PROPERTIES), null)), $exp);
@ -460,7 +467,8 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest {
}
}
/** @dataProvider providePropertyChanges */
#[DataProvider('providePropertyChanges')]
public function testSetThePropertiesOfAUser(array $in, $out): void {
$user = "john.doe@example.com";
if ($out instanceof \Exception) {
@ -479,7 +487,8 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest {
}
}
/** @dataProvider providePropertyChanges */
#[DataProvider('providePropertyChanges')]
public function testSetThePropertiesOfAUserWeDoNotKnow(array $in, $out): void {
$user = "john.doe@example.com";
if ($out instanceof \Exception) {

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -24,15 +25,16 @@ use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use GuzzleHttp\Psr7\ServerRequest;
use PHPUnit\Framework\Attributes\CoversNothing;
/** @coversNothing */
#[CoversNothing]
abstract class AbstractTest extends \PHPUnit\Framework\TestCase {
public function setUp(): void {
self::clearData();
// create the object factory as a mock
Arsse::$obj = \Phake::mock(Factory::class);
\Phake::when(Arsse::$obj)->get->thenReturnCallback(function(string $class) {
return new $class;
return new $class();
});
}

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
@ -23,7 +24,7 @@ trait MySQL {
if (!class_exists("mysqli")) {
return null;
}
$drv = new \mysqli_driver;
$drv = new \mysqli_driver();
$drv->report_mode = \MYSQLI_REPORT_OFF;
$d = mysqli_init();
$d->options(\MYSQLI_OPT_INT_AND_FLOAT_NATIVE, false);

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */

View file

@ -1,4 +1,5 @@
<?php
/** @license MIT
* Copyright 2017 J. King, Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */