/** * Test that the dump command is correctly registered. */ public function testImportCommandRegistration() { $application = new DbToolsApplication(); $command = $application->find('import'); $this->assertInstanceOf('\\Drupal\\Core\\Command\\DbImportCommand', $command); }
#!/usr/bin/env php <?php use Drupal\Core\Command\DbToolsApplication; use Drupal\Core\DrupalKernel; use Drupal\Core\Site\Settings; use Symfony\Component\HttpFoundation\Request; if (PHP_SAPI !== 'cli') { return; } // Bootstrap. $autoloader = (require __DIR__ . '/../../autoload.php'); require_once __DIR__ . '/../includes/bootstrap.inc'; $request = Request::createFromGlobals(); Settings::initialize(dirname(dirname(__DIR__)), DrupalKernel::findSitePath($request), $autoloader); $kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod')->boot(); // Run the database dump command. $application = new DbToolsApplication(); $application->run();