You are here

public function SchemaTest::testDropFieldComment in Drupal driver for SQL Server and SQL Azure 8.2

Same name and namespace in other branches
  1. 4.2.x tests/src/Kernel/SchemaTest.php \Drupal\Tests\sqlsrv\Kernel\SchemaTest::testDropFieldComment()
  2. 3.0.x tests/src/Kernel/SchemaTest.php \Drupal\Tests\sqlsrv\Kernel\SchemaTest::testDropFieldComment()
  3. 3.1.x tests/src/Kernel/SchemaTest.php \Drupal\Tests\sqlsrv\Kernel\SchemaTest::testDropFieldComment()
  4. 4.0.x tests/src/Kernel/SchemaTest.php \Drupal\Tests\sqlsrv\Kernel\SchemaTest::testDropFieldComment()
  5. 4.1.x tests/src/Kernel/SchemaTest.php \Drupal\Tests\sqlsrv\Kernel\SchemaTest::testDropFieldComment()

Verify that comments are dropped when the field is dropped.

File

tests/src/Kernel/SchemaTest.php, line 100

Class

SchemaTest
Tests table creation and modification via the schema API.

Namespace

Drupal\Tests\sqlsrv\Kernel

Code

public function testDropFieldComment() {

  // Drop field and ensure comment does not exist.
  $this->schema
    ->dropField('test', 'name');
  $this
    ->assertEmpty($this->schema
    ->getComment('test', 'name'));

  // Add field with different description.
  $spec = $this->table['fields']['name'];
  $spec['description'] = 'New name comment';
  $this->schema
    ->addField('test', 'name', $spec);

  // Verify comment is correct.
  $comment = $this->schema
    ->getComment('test', 'name');
  $this
    ->assertEquals('New name comment', $comment);
}