Commit 052fae4f authored by catch's avatar catch
Browse files

Issue #3205139 by longwave: Refactor away ModuleTestBase::assertTableCount()

parent 66fda844
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -44,8 +44,8 @@ public function testEnableWithoutDependency() {

    $this->assertModules(['content_translation', 'language'], FALSE);

    // Assert that the language tables weren't enabled.
    $this->assertTableCount('language', FALSE);
    // Assert that the language module config was not installed.
    $this->assertNoModuleConfig('language');

    $this->submitForm([], 'Continue');
    $this->assertText('2 modules have been enabled: Content Translation, Language.');
+0 −19
Original line number Diff line number Diff line
@@ -33,25 +33,6 @@ protected function setUp() {
    $this->drupalLogin($this->adminUser);
  }

  /**
   * Assert there are tables that begin with the specified base table name.
   *
   * @param $base_table
   *   Beginning of table name to look for.
   * @param $count
   *   (optional) Whether or not to assert that there are tables that match the
   *   specified base table. Defaults to TRUE.
   */
  public function assertTableCount($base_table, $count = TRUE) {
    $connection = Database::getConnection();
    $tables = $connection->schema()->findTables($connection->prefixTables('{' . $base_table . '}') . '%');

    if ($count) {
      $this->assertNotEmpty($tables, new FormattableMarkup('Tables matching "@base_table" found.', ['@base_table' => $base_table]));
    }
    $this->assertEmpty($tables, new FormattableMarkup('Tables matching "@base_table" not found.', ['@base_table' => $base_table]));
  }

  /**
   * Assert that all tables defined in a module's hook_schema() exist.
   *