Commit 7e240334 authored by alexpott's avatar alexpott

Issue #2443663 by daffie, vlad.n: PostgreSQL: Fix system\Tests\Entity\EntityDefinitionUpdateTest

parent 8e54eca0
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\system\Tests\Entity; namespace Drupal\system\Tests\Entity;
use Drupal\Core\Database\DatabaseExceptionWrapper; use Drupal\Core\Database\DatabaseExceptionWrapper;
use Drupal\Core\Database\IntegrityConstraintViolationException;
use Drupal\Core\Entity\EntityStorageException; use Drupal\Core\Entity\EntityStorageException;
use Drupal\Core\Entity\EntityTypeEvents; use Drupal\Core\Entity\EntityTypeEvents;
use Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException; use Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException;
...@@ -359,14 +360,19 @@ public function testBundleFieldCreateDeleteWithExistingEntities() { ...@@ -359,14 +360,19 @@ public function testBundleFieldCreateDeleteWithExistingEntities() {
->execute(); ->execute();
$this->fail($message); $this->fail($message);
} }
catch (DatabaseExceptionWrapper $e) { catch (\RuntimeException $e) {
// Now provide a value for the 'not null' column. This is expected to if ($e instanceof DatabaseExceptionWrapper || $e instanceof IntegrityConstraintViolationException) {
// succeed. // Now provide a value for the 'not null' column. This is expected to
$values['new_bundle_field_shape'] = $this->randomString(); // succeed.
$this->database->insert('entity_test_update__new_bundle_field') $values['new_bundle_field_shape'] = $this->randomString();
->fields($values) $this->database->insert('entity_test_update__new_bundle_field')
->execute(); ->fields($values)
$this->pass($message); ->execute();
$this->pass($message);
} else {
// Keep throwing it.
throw $e;
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment