ListTablesOperationExecuteTest.php in OptimizeDB 8
File
tests/src/Functional/ListTablesOperationExecuteTest.php
View source
<?php
namespace Drupal\Tests\optimizedb\Functional;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Tests\BrowserTestBase;
class ListTablesOperationExecuteTest extends BrowserTestBase {
use StringTranslationTrait;
protected $defaultTheme = 'seven';
public static $modules = [
'optimizedb',
];
protected $strictConfigSchema = FALSE;
protected $adminUser;
public function setUp() {
parent::setUp();
$this->adminUser = $this
->drupalCreateUser([
'administer optimizedb settings',
]);
$this
->drupalLogin($this->adminUser);
}
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.'));
$tables = _optimizedb_tables_list();
$table_name = key($tables);
$edit = [];
$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.'));
}
}