summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2018-07-11 14:11:41 (GMT)
committerAlex Pott2018-07-11 14:11:41 (GMT)
commit5a7dc82fe6c440551060b9bc6ec45b28966c098f (patch)
treeef435fbfe3f92945d70c09d39fa3c7a315762902
parentca1574e36e4777a42835d6097a5e940922bfdc2b (diff)
Issue #2616724 follow-up by alexpott: Warn when trying to create a database table with a NOT NULL => FALSE primary key
-rw-r--r--core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php9
1 files changed, 3 insertions, 6 deletions
diff --git a/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php b/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php
index 435b3f2..259f5f5 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php
@@ -828,8 +828,7 @@ class SchemaTest extends KernelTestBase {
],
'primary key' => ['test_field'],
];
- $this->expectException(SchemaException::class);
- $this->expectExceptionMessage("The 'test_field' field specification does not define 'not null' as TRUE.");
+ $this->setExpectedException(SchemaException::class, "The 'test_field' field specification does not define 'not null' as TRUE.");
$schema->createTable($table_name, $table_spec);
}
@@ -850,8 +849,7 @@ class SchemaTest extends KernelTestBase {
];
$schema->createTable($table_name, $table_spec);
- $this->expectException(SchemaException::class);
- $this->expectExceptionMessage("The 'new_test_field' field specification does not define 'not null' as TRUE.");
+ $this->setExpectedException(SchemaException::class, "The 'new_test_field' field specification does not define 'not null' as TRUE.");
$schema->addField($table_name, 'new_test_field', ['type' => 'int'], ['primary key' => ['test_field', 'new_test_field']]);
}
@@ -872,8 +870,7 @@ class SchemaTest extends KernelTestBase {
];
$schema->createTable($table_name, $table_spec);
- $this->expectException(SchemaException::class);
- $this->expectExceptionMessage("The 'changed_test_field' field specification does not define 'not null' as TRUE.");
+ $this->setExpectedException(SchemaException::class, "The 'changed_test_field' field specification does not define 'not null' as TRUE.");
$schema->dropPrimaryKey($table_name);
$schema->changeField($table_name, 'test_field', 'changed_test_field', ['type' => 'int'], ['primary key' => ['changed_test_field']]);
}