class StubTransactionManager

A stub of the TransactionManagerBase class for testing purposes.

Hierarchy

Expanded class hierarchy of StubTransactionManager

File

core/tests/Drupal/Tests/Core/Database/Stub/StubTransactionManager.php, line 14

Namespace

Drupal\Tests\Core\Database\Stub
View 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

Title Sort descending Deprecated Modifiers Object type Summary Overriden Title
StubTransactionManager::$success public property Should methods succeed or not.
StubTransactionManager::addClientSavepoint protected function Adds a savepoint on the client transaction. Overrides TransactionManagerBase::addClientSavepoint
StubTransactionManager::beginClientTransaction protected function Begins a transaction on the client connection. Overrides TransactionManagerBase::beginClientTransaction
StubTransactionManager::commitClientTransaction protected function Commits a client transaction. Overrides TransactionManagerBase::commitClientTransaction
StubTransactionManager::releaseClientSavepoint protected function Releases a savepoint on the client transaction. Overrides TransactionManagerBase::releaseClientSavepoint
StubTransactionManager::rollbackClientSavepoint protected function Rolls back to a savepoint on the client transaction. Overrides TransactionManagerBase::rollbackClientSavepoint
StubTransactionManager::rollbackClientTransaction protected function Rolls back a client transaction. Overrides TransactionManagerBase::rollbackClientTransaction
TransactionManagerBase::$connectionTransactionState private property The state of the underlying client connection transaction.
TransactionManagerBase::$exceptionThrown private property Indicates if a exception was thrown.
TransactionManagerBase::$isAutoCommitted private property Whether the root transaction was auto-committed.
TransactionManagerBase::$postTransactionCallbacks private property A list of post-transaction callbacks.
TransactionManagerBase::$rootId private property The ID of the root Transaction object.
TransactionManagerBase::$stack private property The stack of Drupal transactions currently active.
TransactionManagerBase::$triggerWarningWhenUnpilingOnVoidTransaction public property Whether to trigger warnings when unpiling a void transaction.
TransactionManagerBase::$voidedItems private property A list of voided stack items.
TransactionManagerBase::addPostTransactionCallback public function Adds a root transaction end callback. Overrides TransactionManagerInterface::addPostTransactionCallback
TransactionManagerBase::addStackItem protected function Adds an item to the transaction stack.
TransactionManagerBase::commit protected function Commits a Drupal transaction.
TransactionManagerBase::commitAll Deprecated public function Commits the entire transaction stack.
TransactionManagerBase::dumpStackItemsAsString protected function Produces a string representation of the stack items.
TransactionManagerBase::getConnectionTransactionState protected function Gets the state of the client connection transaction.
TransactionManagerBase::handleAutomaticCommit public function Manages the occurrence of an automatic commit. Overrides TransactionManagerInterface::handleAutomaticCommit
TransactionManagerBase::has public function Checks if a named Drupal transaction is active. Overrides TransactionManagerInterface::has
TransactionManagerBase::inTransaction public function Determines if there is an active transaction open. Overrides TransactionManagerInterface::inTransaction
TransactionManagerBase::processPostTransactionCallbacks protected function Processes the post-transaction callbacks.
TransactionManagerBase::processRootCommit protected function Processes the root transaction commit.
TransactionManagerBase::processRootRollback protected function Processes the root transaction rollback.
TransactionManagerBase::purge public function Purges a Drupal transaction from the manager. Overrides TransactionManagerInterface::purge
TransactionManagerBase::push public function Pushes a new Drupal transaction on the stack. Overrides TransactionManagerInterface::push
TransactionManagerBase::removeStackItem protected function Removes an item from the transaction stack.
TransactionManagerBase::rollback public function Rolls back a Drupal transaction. Overrides TransactionManagerInterface::rollback
TransactionManagerBase::setConnectionTransactionState protected function Sets the state of the client connection transaction.
TransactionManagerBase::stack protected function Returns the content of the transaction stack.
TransactionManagerBase::stackDepth public function Returns the current depth of the transaction stack.
TransactionManagerBase::unpile public function Removes a Drupal transaction from the stack. Overrides TransactionManagerInterface::unpile
TransactionManagerBase::voidClientTransaction public function Voids the client connection. Overrides TransactionManagerInterface::voidClientTransaction
TransactionManagerBase::voidStackItem protected function Voids an item from the transaction stack.
TransactionManagerBase::__construct public function Constructor.
TransactionManagerBase::__destruct public function Destructor.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.