master #3

Merged
timw4mail merged 10 commits from master into develop 2020-12-03 16:27:13 -05:00
6 changed files with 59 additions and 48 deletions

View File

@ -1,7 +1,10 @@
dist: xenial
dist: bionic
os: linux
arch: amd64
arch:
- amd64
- arm64
- ppc64le
language: php
@ -10,8 +13,10 @@ services:
- postgresql
php:
- 7.4
- nightly
- '7.4'
# - '8.0'
before_script:
- psql -c 'DROP DATABASE IF EXISTS test;' -U postgres
@ -31,4 +36,5 @@ after_script:
jobs:
allow_failures:
- arch: ppc64le
- php: nightly

View File

@ -1,36 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
beStrictAboutOutputDuringTests="false"
colors="true"
stopOnFailure="false"
bootstrap="./../tests/bootstrap.php"
verbose="true"
>
<filter>
<whitelist>
<directory suffix=".php">./../src/</directory>
</whitelist>
</filter>
<testsuites>
<testsuite name="CoreTests">
<file>./../tests/CoreTest.php</file>
<file>./../tests/ConnectionManagerTest.php</file>
<file>./../tests/QueryParserTest.php</file>
</testsuite>
<testsuite name="MySQL Tests">
<directory>./../tests/Drivers/MySQL/</directory>
</testsuite>
<testsuite name="PgSQL Tests">
<directory>./../tests/Drivers/PgSQL/</directory>
</testsuite>
<testsuite name="SQLite Tests">
<directory>./../tests/Drivers/SQLite/</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-html" target="./../coverage"/>
<log type="coverage-clover" target="logs/clover.xml"/>
<log type="coverage-xml" lowUpperBound="85" highLowerBound="90" showUncoveredFiles="true" target="logs/coverage" />
<log type="junit" target="logs/junit.xml" />
</logging>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" beStrictAboutOutputDuringTests="false" colors="true" stopOnFailure="false" bootstrap="./../tests/bootstrap.php" verbose="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">./../src/</directory>
</include>
<report>
<clover outputFile="logs/clover.xml"/>
<html outputDirectory="./../coverage"/>
<xml outputDirectory="logs/coverage"/>
</report>
</coverage>
<testsuites>
<testsuite name="CoreTests">
<file>./../tests/CoreTest.php</file>
<file>./../tests/ConnectionManagerTest.php</file>
<file>./../tests/QueryParserTest.php</file>
</testsuite>
<testsuite name="MySQL Tests">
<directory>./../tests/Drivers/MySQL/</directory>
</testsuite>
<testsuite name="PgSQL Tests">
<directory>./../tests/Drivers/PgSQL/</directory>
</testsuite>
<testsuite name="SQLite Tests">
<directory>./../tests/Drivers/SQLite/</directory>
</testsuite>
</testsuites>
<logging>
<junit outputFile="logs/junit.xml"/>
</logging>
</phpunit>

View File

@ -34,14 +34,13 @@
"require-dev": {
"consolidation/robo": "^2.0.0",
"monolog/monolog": "^2.0.1",
"phploc/phploc": "^5.0",
"phploc/phploc": "^7.0",
"phpmd/phpmd": "^2.8",
"phpstan/phpstan": "^0.12.2",
"phpunit/phpunit": "^8.5",
"sebastian/phpcpd": "^4.1",
"phpunit/phpunit": "^9.4",
"sebastian/phpcpd": "^6.0",
"simpletest/simpletest": "^1.1",
"squizlabs/php_codesniffer": "^3.0.0",
"theseer/phpdox": "^0.12.0"
"squizlabs/php_codesniffer": "^3.0.0"
},
"autoload": {
"psr-4": {

View File

@ -59,9 +59,8 @@ final class ConnectionManager {
* Prevent serialization of this object
*
* @throws DomainException
* @return void
*/
public function __sleep(): void
public function __sleep()
{
throw new DomainException('No serializing of singleton');
}

View File

@ -91,8 +91,6 @@ class ConnectionManagerTest extends TestCase {
};
$conn = self::$instance->connect($params);
$this->assertInstanceOf(QueryBuilderInterface::class, $conn);
// Check that the connection just made is returned from the get_connection method
$this->assertEqual($conn, self::$instance->getConnection());
@ -111,7 +109,6 @@ class ConnectionManagerTest extends TestCase {
];
$conn = self::$instance->connect($params);
$this->assertInstanceOf(QueryBuilderInterface::class, $conn);
$this->assertEqual($conn, self::$instance->getConnection('conn_manager'));
}

View File

@ -154,6 +154,13 @@ SQL;
public function testCommitTransaction(): void
{
// Make sure we aren't already in a transaction
if (self::$db->inTransaction())
{
self::$db->commit();
}
$this->assertFalse(self::$db->inTransaction());
$this->assertTrue(self::$db->beginTransaction());
$sql = 'INSERT INTO `create_test` (`id`, `key`, `val`) VALUES (10, 12, 14)';
@ -165,6 +172,13 @@ SQL;
public function testRollbackTransaction(): void
{
// Make sure we aren't already in a transaction
if (self::$db->inTransaction())
{
self::$db->commit();
}
$this->assertFalse(self::$db->inTransaction());
$this->assertTrue(self::$db->beginTransaction());
$sql = 'INSERT INTO `create_test` (`id`, `key`, `val`) VALUES (182, 96, 43)';