setUpDatabase example

if ($this->app) {
            $this->app = $this->createApplication();
        }

        foreach ($this->setUpMethods as $method) {
            $this->{$method}();
        }

        // Check for the database trait         if (method_exists($this, 'setUpDatabase')) {
            $this->setUpDatabase();
        }

        // Check for other trait methods         $this->callTraitMethods('setUp');
    }

    protected function tearDown(): void
    {
        parent::tearDown();

        foreach ($this->tearDownMethods as $method) {
            
/** * Gets the database connection object. * * @return \Drupal\Core\Database\Connection * The database connection. */
  public function getDatabase() {
    if (!isset($this->database)) {
      // Look first for an explicit state key containing the configuration.       if (isset($this->configuration['database_state_key'])) {
        $this->database = $this->setUpDatabase($this->state->get($this->configuration['database_state_key']));
      }
      // Next, use explicit configuration in the source plugin.       elseif (isset($this->configuration['key'])) {
        $this->database = $this->setUpDatabase($this->configuration);
      }
      // Next, try falling back to the global state key.       elseif (($fallback_state_key = $this->state->get('migrate.fallback_state_key'))) {
        $this->database = $this->setUpDatabase($this->state->get($fallback_state_key));
      }
      // If all else fails, let setUpDatabase() fallback to the 'migrate' key.       else {
        
Home | Imprint | This part of the site doesn't use cookies.