function TestSiteApplicationTest::testInstallWithNonExistingFile

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php \Drupal\Tests\Scripts\TestSiteApplicationTest::testInstallWithNonExistingFile()
  2. 10 core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php \Drupal\Tests\Scripts\TestSiteApplicationTest::testInstallWithNonExistingFile()
  3. 11.x core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php \Drupal\Tests\Scripts\TestSiteApplicationTest::testInstallWithNonExistingFile()
  4. 11.x core/tests/Drupal/KernelTests/Scripts/TestSiteApplicationTest.php \Drupal\KernelTests\Scripts\TestSiteApplicationTest::testInstallWithNonExistingFile()

@coversNothing

File

core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php, line 51

Class

TestSiteApplicationTest
Tests core/scripts/test-site.php.

Namespace

Drupal\Tests\Scripts

Code

public function testInstallWithNonExistingFile() {
    // Create a connection to the DB configured in SIMPLETEST_DB.
    $connection = Database::getConnection('default', $this->addTestDatabase(''));
    $table_count = count($connection->schema()
        ->findTables('%'));
    $command_line = $this->php . ' core/scripts/test-site.php install --setup-file "this-class-does-not-exist" --db-url "' . getenv('SIMPLETEST_DB') . '"';
    $process = Process::fromShellCommandline($command_line, $this->root);
    $process->run();
    $this->assertStringContainsString('The file this-class-does-not-exist does not exist.', $process->getErrorOutput());
    $this->assertSame(1, $process->getExitCode());
    $this->assertCount($table_count, $connection->schema()
        ->findTables('%'), 'No additional tables created in the database');
}

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