Chris@0: installEntitySchema('comment'); Chris@18: $this->installEntitySchema('entity_test_string_id'); Chris@0: $this->installSchema('comment', ['comment_entity_statistics']); Chris@0: // Create the comment body field storage. Chris@0: $this->installConfig(['field']); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Tests that comment fields cannot be added entities with non-integer IDs. Chris@0: */ Chris@0: public function testCommentFieldNonStringId() { Chris@0: try { Chris@0: $bundle = CommentType::create([ Chris@0: 'id' => 'foo', Chris@0: 'label' => 'foo', Chris@0: 'description' => '', Chris@0: 'target_entity_type_id' => 'entity_test_string_id', Chris@0: ]); Chris@0: $bundle->save(); Chris@0: $field_storage = FieldStorageConfig::create([ Chris@0: 'field_name' => 'foo', Chris@0: 'entity_type' => 'entity_test_string_id', Chris@0: 'settings' => [ Chris@0: 'comment_type' => 'entity_test_string_id', Chris@0: ], Chris@0: 'type' => 'comment', Chris@0: ]); Chris@0: $field_storage->save(); Chris@0: $this->fail('Did not throw an exception as expected.'); Chris@0: } Chris@0: catch (\UnexpectedValueException $e) { Chris@0: $this->pass('Exception thrown when trying to create comment field on Entity Type with string ID.'); Chris@0: } Chris@0: } Chris@0: Chris@0: }