class StubTransactionManager
A stub of the TransactionManagerBase class for testing purposes.
Hierarchy
- class \Drupal\Core\Database\Transaction\TransactionManagerBase implements \Drupal\Core\Database\Transaction\TransactionManagerInterface
- class \Drupal\Tests\Core\Database\Stub\StubTransactionManager extends \Drupal\Core\Database\Transaction\TransactionManagerBase
Expanded class hierarchy of StubTransactionManager
File
-
core/
tests/ Drupal/ Tests/ Core/ Database/ Stub/ StubTransactionManager.php, line 14
Namespace
Drupal\Tests\Core\Database\StubView source
class StubTransactionManager extends TransactionManagerBase {
/**
* Should methods succeed or not.
*/
public bool $success = TRUE;
/**
* {@inheritdoc}
*/
protected function beginClientTransaction() : bool {
return $this->success ? TRUE : throw new TransactionException('Failed start of transaction');
}
/**
* {@inheritdoc}
*/
protected function addClientSavepoint(string $name) : bool {
return $this->success ? TRUE : throw new TransactionException('Failed start of savepoint ' . $name);
}
/**
* {@inheritdoc}
*/
protected function rollbackClientSavepoint(string $name) : bool {
return $this->success ? TRUE : throw new TransactionException('Failed rollback of savepoint ' . $name);
}
/**
* {@inheritdoc}
*/
protected function releaseClientSavepoint(string $name) : bool {
return $this->success ? TRUE : throw new TransactionCommitFailedException('Failed release of savepoint ' . $name);
}
/**
* {@inheritdoc}
*/
protected function commitClientTransaction() : bool {
return $this->success ? TRUE : throw new TransactionCommitFailedException('Failed commit of transaction');
}
/**
* {@inheritdoc}
*/
protected function rollbackClientTransaction() : bool {
return $this->success ? TRUE : throw new TransactionException('Failed rollback of transaction');
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.