Fix tests

- Fix InstallerTest case
- Fix native function mocking
- Add returntype for Unit-Tests
- Fixing ExtendedPDO test troubles
- Fix wrong class inheritance path for DatabaseTestTrait.php
- Fix SyslogLogger Server Exception for PHP8
- Add user/contact to database.fixture.php
- Avoid invalid rollbacks for test setup in PHP8
This commit is contained in:
Philipp
2021-04-01 23:04:30 +02:00
parent 8cab5edea9
commit 02e6dff6a0
53 changed files with 171 additions and 69 deletions

View File

@@ -67,8 +67,9 @@ class ExtendedPDO extends PDO
*/
public function beginTransaction()
{
if($this->_transactionDepth == 0 || !$this->hasSavepoint()) {
if($this->_transactionDepth <= 0 || !$this->hasSavepoint()) {
parent::beginTransaction();
$this->_transactionDepth = $this->_transactionDepth < 0 ? 0 : $this->_transactionDepth;
} else {
$this->exec("SAVEPOINT LEVEL{$this->_transactionDepth}");
}
@@ -85,8 +86,9 @@ class ExtendedPDO extends PDO
{
$this->_transactionDepth--;
if($this->_transactionDepth == 0 || !$this->hasSavepoint()) {
if($this->_transactionDepth <= 0 || !$this->hasSavepoint()) {
parent::commit();
$this->_transactionDepth = $this->_transactionDepth < 0 ? 0 : $this->_transactionDepth;
} else {
$this->exec("RELEASE SAVEPOINT LEVEL{$this->_transactionDepth}");
}
@@ -100,8 +102,7 @@ class ExtendedPDO extends PDO
*/
public function rollBack()
{
if ($this->_transactionDepth == 0) {
if ($this->_transactionDepth <= 0) {
throw new PDOException('Rollback error : There is no transaction started');
}