DbToolsApplication example


class DbToolsApplicationTest extends KernelTestBase {

  /** * Tests that the dump command is correctly registered. */
  public function testDumpCommandRegistration() {
    $application = new DbToolsApplication();
    $command = $application->find('dump');
    $this->assertInstanceOf('\Drupal\Core\Command\DbDumpCommand', $command);
    $this->assertSame(\Drupal::VERSION, $application->getVersion());
  }

  /** * Tests that the dump command is correctly registered. */
  public function testImportCommandRegistration() {
    $application = new DbToolsApplication();
    $command = $application->find('import');
    
if (PHP_SAPI !== 'cli') {
  return;
}

// Bootstrap. $autoloader = require __DIR__ . '/../../autoload.php';
$request = Request::createFromGlobals();
Settings::initialize(dirname(__DIR__, 2), DrupalKernel::findSitePath($request)$autoloader);
DrupalKernel::createFromRequest($request$autoloader, 'prod')->boot();

// Run the database dump command. $application = new DbToolsApplication();
$application->run();
Home | Imprint | This part of the site doesn't use cookies.