You are here

public function ListTablesOperationExecuteTest::testListTablesOperationExecute in OptimizeDB 8

Performing operations on tables.

File

tests/src/Functional/ListTablesOperationExecuteTest.php, line 56

Class

ListTablesOperationExecuteTest
Testing the performance of operations on tables.

Namespace

Drupal\Tests\optimizedb\Functional

Code

public function testListTablesOperationExecute() {
  $this
    ->drupalPostForm('admin/config/development/optimizedb/list_tables', [], $this
    ->t('Check tables'));
  $this
    ->assertText($this
    ->t('To execute, you must select at least one table from the list.'));

  // Output all database tables.
  $tables = _optimizedb_tables_list();
  $table_name = key($tables);
  $edit = [];

  // Selected first table in list.
  $edit['tables[' . $table_name . ']'] = $table_name;
  $this
    ->drupalPostForm('admin/config/development/optimizedb/list_tables', $edit, $this
    ->t('Check tables'));
  $this
    ->assertText($this
    ->t('The operation completed successfully.'));
}