Issue #3059090 by clepson, mondrake, alexpott: Deprecate \Drupal\Tests\PhpunitCompatibilityTrait::setExpectedException()
parent
6d3ac6c727
commit
e82e0c0573
|
|
@ -33,7 +33,7 @@ class BigPipeResponseAttachmentsProcessorTest extends UnitTestCase {
|
|||
$big_pipe_response_attachments_processor = $this->createBigPipeResponseAttachmentsProcessor($this->prophesize(AttachmentsResponseProcessorInterface::class));
|
||||
|
||||
$non_html_response = new $response_class();
|
||||
$this->setExpectedException(\AssertionError::class);
|
||||
$this->expectException(\AssertionError::class);
|
||||
$big_pipe_response_attachments_processor->processAttachments($non_html_response);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,8 @@ class BlockVisibilityTest extends MigrateProcessTestCase {
|
|||
->method('getSourceProperty')
|
||||
->willReturnMap([['bid', 99], ['module', 'foobar']]);
|
||||
$this->plugin = new BlockVisibility(['skip_php' => TRUE], 'block_visibility_pages', [], $this->moduleHandler->reveal(), $migration_plugin->reveal());
|
||||
$this->setExpectedException(MigrateSkipRowException::class, "The block with bid '99' from module 'foobar' will have no PHP or request_path visibility configuration.");
|
||||
$this->expectException(MigrateSkipRowException::class);
|
||||
$this->expectExceptionMessage("The block with bid '99' from module 'foobar' will have no PHP or request_path visibility configuration.");
|
||||
$this->plugin->transform([2, '<?php', []], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,8 @@ abstract class MessageResourceTestBase extends EntityResourceTestBase {
|
|||
*/
|
||||
public function testGet() {
|
||||
// Contact Message entities are not stored, so they cannot be retrieved.
|
||||
$this->setExpectedException(RouteNotFoundException::class, 'Route "rest.entity.contact_message.GET" does not exist.');
|
||||
$this->expectException(RouteNotFoundException::class);
|
||||
$this->expectExceptionMessage('Route "rest.entity.contact_message.GET" does not exist.');
|
||||
|
||||
$this->provisionEntityResource();
|
||||
Url::fromRoute('rest.entity.contact_message.GET')->toString(TRUE);
|
||||
|
|
@ -127,7 +128,8 @@ abstract class MessageResourceTestBase extends EntityResourceTestBase {
|
|||
*/
|
||||
public function testPatch() {
|
||||
// Contact Message entities are not stored, so they cannot be modified.
|
||||
$this->setExpectedException(RouteNotFoundException::class, 'Route "rest.entity.contact_message.PATCH" does not exist.');
|
||||
$this->expectException(RouteNotFoundException::class);
|
||||
$this->expectExceptionMessage('Route "rest.entity.contact_message.PATCH" does not exist.');
|
||||
|
||||
$this->provisionEntityResource();
|
||||
Url::fromRoute('rest.entity.contact_message.PATCH')->toString(TRUE);
|
||||
|
|
@ -138,7 +140,8 @@ abstract class MessageResourceTestBase extends EntityResourceTestBase {
|
|||
*/
|
||||
public function testDelete() {
|
||||
// Contact Message entities are not stored, so they cannot be deleted.
|
||||
$this->setExpectedException(RouteNotFoundException::class, 'Route "rest.entity.contact_message.DELETE" does not exist.');
|
||||
$this->expectException(RouteNotFoundException::class);
|
||||
$this->expectExceptionMessage('Route "rest.entity.contact_message.DELETE" does not exist.');
|
||||
|
||||
$this->provisionEntityResource();
|
||||
Url::fromRoute('rest.entity.contact_message.DELETE')->toString(TRUE);
|
||||
|
|
|
|||
|
|
@ -120,7 +120,8 @@ class MailHandlerTest extends UnitTestCase {
|
|||
$sender->expects($this->once())
|
||||
->method('isAnonymous')
|
||||
->willReturn(FALSE);
|
||||
$this->setExpectedException(MailHandlerException::class, 'Unable to determine message recipient');
|
||||
$this->expectException(MailHandlerException::class);
|
||||
$this->expectExceptionMessage('Unable to determine message recipient');
|
||||
$this->contactMailHandler->sendMailMessages($message, $sender);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ class ContentModerationStateResourceTest extends KernelTestBase {
|
|||
* @see \Drupal\content_moderation\Entity\ContentModerationState
|
||||
*/
|
||||
public function testCreateContentModerationStateResource() {
|
||||
$this->setExpectedException(PluginNotFoundException::class, 'The "entity:content_moderation_state" plugin does not exist.');
|
||||
$this->expectException(PluginNotFoundException::class);
|
||||
$this->expectExceptionMessage('The "entity:content_moderation_state" plugin does not exist.');
|
||||
RestResourceConfig::create([
|
||||
'id' => 'entity.content_moderation_state',
|
||||
'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY,
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ class ContentModerationStateTest extends KernelTestBase {
|
|||
}
|
||||
|
||||
// Set an invalid moderation state.
|
||||
$this->setExpectedException(EntityStorageException::class);
|
||||
$this->expectException(EntityStorageException::class);
|
||||
$entity->moderation_state->value = 'foobar';
|
||||
$entity->save();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ class ModerationStateFieldItemListTest extends KernelTestBase {
|
|||
*/
|
||||
public function testGet() {
|
||||
$this->assertEquals('draft', $this->testNode->moderation_state->get(0)->value);
|
||||
$this->setExpectedException(\InvalidArgumentException::class);
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->testNode->moderation_state->get(2);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ class DateTimeItemTest extends FieldKernelTestBase {
|
|||
* @dataProvider datetimeValidationProvider
|
||||
*/
|
||||
public function testDatetimeValidation($value) {
|
||||
$this->setExpectedException(\PHPUnit_Framework_AssertionFailedError::class);
|
||||
$this->expectException(\PHPUnit_Framework_AssertionFailedError::class);
|
||||
|
||||
$this->fieldStorage->setSetting('datetime_type', DateTimeItem::DATETIME_TYPE_DATETIME);
|
||||
$this->fieldStorage->save();
|
||||
|
|
@ -315,7 +315,7 @@ class DateTimeItemTest extends FieldKernelTestBase {
|
|||
* @dataProvider dateonlyValidationProvider
|
||||
*/
|
||||
public function testDateonlyValidation($value) {
|
||||
$this->setExpectedException(\PHPUnit_Framework_AssertionFailedError::class);
|
||||
$this->expectException(\PHPUnit_Framework_AssertionFailedError::class);
|
||||
|
||||
$this->fieldStorage->setSetting('datetime_type', DateTimeItem::DATETIME_TYPE_DATE);
|
||||
$this->fieldStorage->save();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ class DateFieldTest extends UnitTestCase {
|
|||
$migration = $this->prophesize('Drupal\migrate\Plugin\MigrationInterface')->reveal();
|
||||
$plugin = new DateField([], '', []);
|
||||
|
||||
$this->setExpectedException(MigrateException::class, "Field field_date of type 'timestamp' is an unknown date field type.");
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage("Field field_date of type 'timestamp' is an unknown date field type.");
|
||||
$plugin->$method($migration, 'field_date', ['type' => 'timestamp']);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ class DateFieldTest extends UnitTestCase {
|
|||
public function testUnknownDateType($method = 'defineValueProcessPipeline') {
|
||||
$plugin = new DateField([], '', []);
|
||||
|
||||
$this->setExpectedException(MigrateException::class, "Field field_date of type 'timestamp' is an unknown date field type.");
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage("Field field_date of type 'timestamp' is an unknown date field type.");
|
||||
$plugin->$method($this->migration, 'field_date', ['type' => 'timestamp']);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -207,7 +207,8 @@ class FieldConfigEntityUnitTest extends UnitTestCase {
|
|||
'bundle' => 'test_bundle_not_exists',
|
||||
'field_type' => 'test_field',
|
||||
], $this->entityTypeId);
|
||||
$this->setExpectedException(\LogicException::class, 'Missing bundle entity, entity type bundle_entity_type, entity id test_bundle_not_exists.');
|
||||
$this->expectException(\LogicException::class);
|
||||
$this->expectExceptionMessage('Missing bundle entity, entity type bundle_entity_type, entity id test_bundle_not_exists.');
|
||||
$field->calculateDependencies();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -192,7 +192,8 @@ class FieldStorageConfigEntityUnitTest extends UnitTestCase {
|
|||
'module' => 'test_module',
|
||||
]);
|
||||
|
||||
$this->setExpectedException(FieldException::class, "Invalid enforced cardinality '$enforced_cardinality'. Allowed values: a positive integer or -1.");
|
||||
$this->expectException(FieldException::class);
|
||||
$this->expectExceptionMessage("Invalid enforced cardinality '$enforced_cardinality'. Allowed values: a positive integer or -1.");
|
||||
$field_storage->getCardinality();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,8 @@ class ProcessFieldTest extends MigrateTestCase {
|
|||
$this->plugin = new ProcessField(['method' => $method], $value, [], $this->cckFieldManager->reveal(), $this->fieldManager->reveal(), $this->migration->reveal());
|
||||
|
||||
if ($migrate_exception) {
|
||||
$this->setExpectedException(MigrateException::class, $migrate_exception);
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage($migrate_exception);
|
||||
}
|
||||
|
||||
if ($plugin_not_found) {
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ class FieldTypeDefaultsTest extends MigrateProcessTestCase {
|
|||
* @covers ::transform
|
||||
*/
|
||||
public function testDefaultsException() {
|
||||
$this->setExpectedException(MigrateException::class,
|
||||
sprintf('Failed to lookup field type %s in the static map.', var_export([], TRUE)));
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage(sprintf('Failed to lookup field type %s in the static map.', var_export([], TRUE)));
|
||||
$this->plugin->transform([], $this->migrateExecutable, $this->row, 'property');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class DenormalizeTest extends NormalizerTestBase {
|
|||
],
|
||||
];
|
||||
|
||||
$this->setExpectedException(UnexpectedValueException::class);
|
||||
$this->expectException(UnexpectedValueException::class);
|
||||
$this->serializer->denormalize($data_with_invalid_type, $this->entityClass, $this->format);
|
||||
}
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ class DenormalizeTest extends NormalizerTestBase {
|
|||
],
|
||||
];
|
||||
|
||||
$this->setExpectedException(UnexpectedValueException::class);
|
||||
$this->expectException(UnexpectedValueException::class);
|
||||
$this->serializer->denormalize($data_with_no_types, $this->entityClass, $this->format);
|
||||
}
|
||||
|
||||
|
|
@ -146,7 +146,8 @@ class DenormalizeTest extends NormalizerTestBase {
|
|||
public function testDenormalizeSerializedItem() {
|
||||
$entity = EntitySerializedField::create(['serialized' => 'boo']);
|
||||
$normalized = $this->serializer->normalize($entity, $this->format);
|
||||
$this->setExpectedException(\LogicException::class, 'The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized" field (field item class: Drupal\entity_test\Plugin\Field\FieldType\SerializedItem).');
|
||||
$this->expectException(\LogicException::class);
|
||||
$this->expectExceptionMessage('The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized" field (field item class: Drupal\entity_test\Plugin\Field\FieldType\SerializedItem).');
|
||||
$this->serializer->denormalize($normalized, EntitySerializedField::class, $this->format);
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +160,8 @@ class DenormalizeTest extends NormalizerTestBase {
|
|||
$this->assertEquals($normalized['serialized_long'][0]['value'], ['Hello world!']);
|
||||
|
||||
$normalized['serialized_long'][0]['value'] = 'boo';
|
||||
$this->setExpectedException(\LogicException::class, 'The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized_long" field (field item class: Drupal\Core\Field\Plugin\Field\FieldType\StringLongItem).');
|
||||
$this->expectException(\LogicException::class);
|
||||
$this->expectExceptionMessage('The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized_long" field (field item class: Drupal\Core\Field\Plugin\Field\FieldType\StringLongItem).');
|
||||
$this->serializer->denormalize($normalized, EntitySerializedField::class);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class FieldItemNormalizerDenormalizeExceptionsUnitTest extends NormalizerDenorma
|
|||
$field_item_normalizer = new FieldItemNormalizer();
|
||||
$data = [];
|
||||
$class = [];
|
||||
$this->setExpectedException(InvalidArgumentException::class);
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$field_item_normalizer->denormalize($data, $class, NULL, $context);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class FieldNormalizerDenormalizeExceptionsUnitTest extends NormalizerDenormalize
|
|||
$field_item_normalizer = new FieldNormalizer();
|
||||
$data = [];
|
||||
$class = [];
|
||||
$this->setExpectedException(InvalidArgumentException::class);
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$field_item_normalizer->denormalize($data, $class, NULL, $context);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,8 @@ class MessageTest extends ResourceTestBase {
|
|||
*/
|
||||
public function testGetIndividual() {
|
||||
// Contact Message entities are not stored, so they cannot be retrieved.
|
||||
$this->setExpectedException(RouteNotFoundException::class, 'Route "jsonapi.contact_message--camelids.individual" does not exist.');
|
||||
$this->expectException(RouteNotFoundException::class);
|
||||
$this->expectExceptionMessage('Route "jsonapi.contact_message--camelids.individual" does not exist.');
|
||||
|
||||
Url::fromRoute('jsonapi.contact_message--camelids.individual')->toString(TRUE);
|
||||
}
|
||||
|
|
@ -125,7 +126,8 @@ class MessageTest extends ResourceTestBase {
|
|||
*/
|
||||
public function testPatchIndividual() {
|
||||
// Contact Message entities are not stored, so they cannot be modified.
|
||||
$this->setExpectedException(RouteNotFoundException::class, 'Route "jsonapi.contact_message--camelids.individual" does not exist.');
|
||||
$this->expectException(RouteNotFoundException::class);
|
||||
$this->expectExceptionMessage('Route "jsonapi.contact_message--camelids.individual" does not exist.');
|
||||
|
||||
Url::fromRoute('jsonapi.contact_message--camelids.individual')->toString(TRUE);
|
||||
}
|
||||
|
|
@ -135,7 +137,8 @@ class MessageTest extends ResourceTestBase {
|
|||
*/
|
||||
public function testDeleteIndividual() {
|
||||
// Contact Message entities are not stored, so they cannot be deleted.
|
||||
$this->setExpectedException(RouteNotFoundException::class, 'Route "jsonapi.contact_message--camelids.individual" does not exist.');
|
||||
$this->expectException(RouteNotFoundException::class);
|
||||
$this->expectExceptionMessage('Route "jsonapi.contact_message--camelids.individual" does not exist.');
|
||||
|
||||
Url::fromRoute('jsonapi.contact_message--camelids.individual')->toString(TRUE);
|
||||
}
|
||||
|
|
@ -145,7 +148,8 @@ class MessageTest extends ResourceTestBase {
|
|||
*/
|
||||
public function testRelated() {
|
||||
// Contact Message entities are not stored, so they cannot be retrieved.
|
||||
$this->setExpectedException(RouteNotFoundException::class, 'Route "jsonapi.contact_message--camelids.related" does not exist.');
|
||||
$this->expectException(RouteNotFoundException::class);
|
||||
$this->expectExceptionMessage('Route "jsonapi.contact_message--camelids.related" does not exist.');
|
||||
|
||||
Url::fromRoute('jsonapi.contact_message--camelids.related')->toString(TRUE);
|
||||
}
|
||||
|
|
@ -155,7 +159,8 @@ class MessageTest extends ResourceTestBase {
|
|||
*/
|
||||
public function testRelationships() {
|
||||
// Contact Message entities are not stored, so they cannot be retrieved.
|
||||
$this->setExpectedException(RouteNotFoundException::class, 'Route "jsonapi.contact_message--camelids.relationship.get" does not exist.');
|
||||
$this->expectException(RouteNotFoundException::class);
|
||||
$this->expectExceptionMessage('Route "jsonapi.contact_message--camelids.relationship.get" does not exist.');
|
||||
|
||||
Url::fromRoute('jsonapi.contact_message--camelids.relationship.get')->toString(TRUE);
|
||||
}
|
||||
|
|
@ -181,7 +186,8 @@ class MessageTest extends ResourceTestBase {
|
|||
*/
|
||||
public function testRevisions() {
|
||||
// Contact Message entities are not stored, so they cannot be retrieved.
|
||||
$this->setExpectedException(RouteNotFoundException::class, 'Route "jsonapi.contact_message--camelids.individual" does not exist.');
|
||||
$this->expectException(RouteNotFoundException::class);
|
||||
$this->expectExceptionMessage('Route "jsonapi.contact_message--camelids.individual" does not exist.');
|
||||
|
||||
Url::fromRoute('jsonapi.contact_message--camelids.individual')->toString(TRUE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,7 +126,10 @@ class FieldResolverTest extends JsonapiKernelTestBase {
|
|||
*/
|
||||
public function testResolveInternalIncludePathError($entity_type, $bundle, $external_path, $expected_message = '') {
|
||||
$path_parts = explode('.', $external_path);
|
||||
$this->setExpectedException(CacheableBadRequestHttpException::class, $expected_message);
|
||||
$this->expectException(CacheableBadRequestHttpException::class);
|
||||
if (!empty($expected_message)) {
|
||||
$this->expectExceptionMessage($expected_message);
|
||||
}
|
||||
$resource_type = $this->resourceTypeRepository->get($entity_type, $bundle);
|
||||
$this->sut->resolveInternalIncludePath($resource_type, $path_parts);
|
||||
}
|
||||
|
|
@ -245,7 +248,10 @@ class FieldResolverTest extends JsonapiKernelTestBase {
|
|||
* @dataProvider resolveInternalEntityQueryPathErrorProvider
|
||||
*/
|
||||
public function testResolveInternalEntityQueryPathError($entity_type, $bundle, $external_path, $expected_message = '') {
|
||||
$this->setExpectedException(CacheableBadRequestHttpException::class, $expected_message);
|
||||
$this->expectException(CacheableBadRequestHttpException::class);
|
||||
if (!empty($expected_message)) {
|
||||
$this->expectExceptionMessage($expected_message);
|
||||
}
|
||||
$this->sut->resolveInternalEntityQueryPath($entity_type, $bundle, $external_path);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ class EntityResourceTest extends JsonapiKernelTestBase {
|
|||
$role = Role::load(RoleInterface::ANONYMOUS_ID);
|
||||
$role->revokePermission('access content');
|
||||
$role->save();
|
||||
$this->setExpectedException(EntityAccessDeniedHttpException::class);
|
||||
$this->expectException(EntityAccessDeniedHttpException::class);
|
||||
$this->entityResource->getIndividual($this->node, Request::create('/jsonapi/node/article'));
|
||||
}
|
||||
|
||||
|
|
@ -420,7 +420,8 @@ class EntityResourceTest extends JsonapiKernelTestBase {
|
|||
Role::load(Role::ANONYMOUS_ID)
|
||||
->grantPermission('create article content')
|
||||
->save();
|
||||
$this->setExpectedException(HttpException::class, 'Unprocessable Entity: validation failed.');
|
||||
$this->expectException(HttpException::class);
|
||||
$this->expectExceptionMessage('Unprocessable Entity: validation failed.');
|
||||
$resource_type = new ResourceType('node', 'article', Node::class);
|
||||
$payload = Json::encode([
|
||||
'data' => [
|
||||
|
|
@ -455,7 +456,8 @@ class EntityResourceTest extends JsonapiKernelTestBase {
|
|||
],
|
||||
]);
|
||||
|
||||
$this->setExpectedException(ConflictHttpException::class, 'Conflict: Entity already exists.');
|
||||
$this->expectException(ConflictHttpException::class);
|
||||
$this->expectExceptionMessage('Conflict: Entity already exists.');
|
||||
$resource_type = new ResourceType('node', 'article', Node::class);
|
||||
$resource_type->setRelatableResourceTypes([
|
||||
'field_relationships' => [new ResourceType('node', 'article', NULL)],
|
||||
|
|
|
|||
|
|
@ -74,7 +74,8 @@ class FilterTest extends JsonapiKernelTestBase {
|
|||
* @covers ::queryCondition
|
||||
*/
|
||||
public function testInvalidFilterPathDueToMissingPropertyName() {
|
||||
$this->setExpectedException(CacheableBadRequestHttpException::class, 'Invalid nested filtering. The field `colors`, given in the path `colors` is incomplete, it must end with one of the following specifiers: `value`, `format`, `processed`.');
|
||||
$this->expectException(CacheableBadRequestHttpException::class);
|
||||
$this->expectExceptionMessage('Invalid nested filtering. The field `colors`, given in the path `colors` is incomplete, it must end with one of the following specifiers: `value`, `format`, `processed`.');
|
||||
$resource_type = new ResourceType('node', 'painting', NULL);
|
||||
Filter::createFromQueryParameter(['colors' => ''], $resource_type, $this->fieldResolver);
|
||||
}
|
||||
|
|
@ -83,7 +84,8 @@ class FilterTest extends JsonapiKernelTestBase {
|
|||
* @covers ::queryCondition
|
||||
*/
|
||||
public function testInvalidFilterPathDueToMissingPropertyNameReferenceFieldWithMetaProperties() {
|
||||
$this->setExpectedException(CacheableBadRequestHttpException::class, 'Invalid nested filtering. The field `photo`, given in the path `photo` is incomplete, it must end with one of the following specifiers: `id`, `meta.alt`, `meta.title`, `meta.width`, `meta.height`.');
|
||||
$this->expectException(CacheableBadRequestHttpException::class);
|
||||
$this->expectExceptionMessage('Invalid nested filtering. The field `photo`, given in the path `photo` is incomplete, it must end with one of the following specifiers: `id`, `meta.alt`, `meta.title`, `meta.width`, `meta.height`.');
|
||||
$resource_type = new ResourceType('node', 'painting', NULL);
|
||||
Filter::createFromQueryParameter(['photo' => ''], $resource_type, $this->fieldResolver);
|
||||
}
|
||||
|
|
@ -92,7 +94,8 @@ class FilterTest extends JsonapiKernelTestBase {
|
|||
* @covers ::queryCondition
|
||||
*/
|
||||
public function testInvalidFilterPathDueMissingMetaPrefixReferenceFieldWithMetaProperties() {
|
||||
$this->setExpectedException(CacheableBadRequestHttpException::class, 'Invalid nested filtering. The property `alt`, given in the path `photo.alt` belongs to the meta object of a relationship and must be preceded by `meta`.');
|
||||
$this->expectException(CacheableBadRequestHttpException::class);
|
||||
$this->expectExceptionMessage('Invalid nested filtering. The property `alt`, given in the path `photo.alt` belongs to the meta object of a relationship and must be preceded by `meta`.');
|
||||
$resource_type = new ResourceType('node', 'painting', NULL);
|
||||
Filter::createFromQueryParameter(['photo.alt' => ''], $resource_type, $this->fieldResolver);
|
||||
}
|
||||
|
|
@ -101,7 +104,8 @@ class FilterTest extends JsonapiKernelTestBase {
|
|||
* @covers ::queryCondition
|
||||
*/
|
||||
public function testInvalidFilterPathDueToMissingPropertyNameReferenceFieldWithoutMetaProperties() {
|
||||
$this->setExpectedException(CacheableBadRequestHttpException::class, 'Invalid nested filtering. The field `uid`, given in the path `uid` is incomplete, it must end with one of the following specifiers: `id`.');
|
||||
$this->expectException(CacheableBadRequestHttpException::class);
|
||||
$this->expectExceptionMessage('Invalid nested filtering. The field `uid`, given in the path `uid` is incomplete, it must end with one of the following specifiers: `id`.');
|
||||
$resource_type = new ResourceType('node', 'painting', NULL);
|
||||
Filter::createFromQueryParameter(['uid' => ''], $resource_type, $this->fieldResolver);
|
||||
}
|
||||
|
|
@ -110,7 +114,8 @@ class FilterTest extends JsonapiKernelTestBase {
|
|||
* @covers ::queryCondition
|
||||
*/
|
||||
public function testInvalidFilterPathDueToNonexistentProperty() {
|
||||
$this->setExpectedException(CacheableBadRequestHttpException::class, 'Invalid nested filtering. The property `foobar`, given in the path `colors.foobar`, does not exist. Must be one of the following property names: `value`, `format`, `processed`.');
|
||||
$this->expectException(CacheableBadRequestHttpException::class);
|
||||
$this->expectExceptionMessage('Invalid nested filtering. The property `foobar`, given in the path `colors.foobar`, does not exist. Must be one of the following property names: `value`, `format`, `processed`.');
|
||||
$resource_type = new ResourceType('node', 'painting', NULL);
|
||||
Filter::createFromQueryParameter(['colors.foobar' => ''], $resource_type, $this->fieldResolver);
|
||||
}
|
||||
|
|
@ -119,7 +124,8 @@ class FilterTest extends JsonapiKernelTestBase {
|
|||
* @covers ::queryCondition
|
||||
*/
|
||||
public function testInvalidFilterPathDueToElidedSoleProperty() {
|
||||
$this->setExpectedException(CacheableBadRequestHttpException::class, 'Invalid nested filtering. The property `value`, given in the path `promote.value`, does not exist. Filter by `promote`, not `promote.value` (the JSON:API module elides property names from single-property fields).');
|
||||
$this->expectException(CacheableBadRequestHttpException::class);
|
||||
$this->expectExceptionMessage('Invalid nested filtering. The property `value`, given in the path `promote.value`, does not exist. Filter by `promote`, not `promote.value` (the JSON:API module elides property names from single-property fields).');
|
||||
$resource_type = new ResourceType('node', 'painting', NULL);
|
||||
Filter::createFromQueryParameter(['promote.value' => ''], $resource_type, $this->fieldResolver);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,8 @@ class VersionNegotiatorTest extends JsonapiKernelTestBase {
|
|||
* @covers \Drupal\jsonapi\Revisions\VersionById::getRevision
|
||||
*/
|
||||
public function testInvalidRevisionId() {
|
||||
$this->setExpectedException(CacheableNotFoundHttpException::class, sprintf('The requested version, identified by `id:%s`, could not be found.', $this->node2->getRevisionId()));
|
||||
$this->expectException(CacheableNotFoundHttpException::class);
|
||||
$this->expectExceptionMessage(sprintf('The requested version, identified by `id:%s`, could not be found.', $this->node2->getRevisionId()));
|
||||
$this->versionNegotiator->getRevision($this->node, 'id:' . $this->node2->getRevisionId());
|
||||
}
|
||||
|
||||
|
|
@ -161,7 +162,8 @@ class VersionNegotiatorTest extends JsonapiKernelTestBase {
|
|||
* @covers \Drupal\jsonapi\Revisions\VersionByRel::getRevision
|
||||
*/
|
||||
public function testInvalidRevisionRel() {
|
||||
$this->setExpectedException(CacheableBadRequestHttpException::class, 'An invalid resource version identifier, `rel:erroneous-revision-name`, was provided.');
|
||||
$this->expectException(CacheableBadRequestHttpException::class);
|
||||
$this->expectExceptionMessage('An invalid resource version identifier, `rel:erroneous-revision-name`, was provided.');
|
||||
$this->versionNegotiator->getRevision($this->node, 'rel:erroneous-revision-name');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -216,10 +216,8 @@ class JsonApiDocumentTopLevelNormalizerTest extends UnitTestCase {
|
|||
['type' => 'node--article'];
|
||||
|
||||
if ($expect_exception) {
|
||||
$this->setExpectedException(
|
||||
UnprocessableEntityHttpException::class,
|
||||
'IDs should be properly generated and formatted UUIDs as described in RFC 4122.'
|
||||
);
|
||||
$this->expectException(UnprocessableEntityHttpException::class);
|
||||
$this->expectExceptionMessage('IDs should be properly generated and formatted UUIDs as described in RFC 4122.');
|
||||
}
|
||||
|
||||
$denormalized = $this->normalizer->denormalize($data, NULL, 'api_json', [
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ class ResourceIdentifierNormalizerTest extends UnitTestCase {
|
|||
'related' => $field_name,
|
||||
'target_entity' => $this->prophesize(FieldableEntityInterface::class)->reveal(),
|
||||
];
|
||||
$this->setExpectedException(BadRequestHttpException::class);
|
||||
$this->expectException(BadRequestHttpException::class);
|
||||
$this->normalizer->denormalize($data, NULL, 'api_json', $context);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class EntityConditionGroupTest extends UnitTestCase {
|
|||
* @covers ::__construct
|
||||
*/
|
||||
public function testConstructException() {
|
||||
$this->setExpectedException(\InvalidArgumentException::class);
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
new EntityConditionGroup('NOT_ALLOWED', []);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,8 @@ class EntityConditionTest extends UnitTestCase {
|
|||
*/
|
||||
public function testValidation($input, $exception) {
|
||||
if ($exception) {
|
||||
$this->setExpectedException(get_class($exception), $exception->getMessage());
|
||||
$this->expectException(get_class($exception));
|
||||
$this->expectExceptionMessage($exception->getMessage());
|
||||
}
|
||||
EntityCondition::createFromQueryParameter($input);
|
||||
$this->assertTrue(is_null($exception), 'No exception was expected.');
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class OffsetPageTest extends UnitTestCase {
|
|||
* @covers ::createFromQueryParameter
|
||||
*/
|
||||
public function testCreateFromQueryParameterFail() {
|
||||
$this->setExpectedException(BadRequestHttpException::class);
|
||||
$this->expectException(BadRequestHttpException::class);
|
||||
OffsetPage::createFromQueryParameter('lorem');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class SortTest extends UnitTestCase {
|
|||
* @dataProvider badParameterProvider
|
||||
*/
|
||||
public function testCreateFromQueryParameterFail($input) {
|
||||
$this->setExpectedException(BadRequestHttpException::class);
|
||||
$this->expectException(BadRequestHttpException::class);
|
||||
Sort::createFromQueryParameter($input);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,8 @@ class LanguageNegotiationTest extends MigrateProcessTestCase {
|
|||
*/
|
||||
public function testStringInput() {
|
||||
$this->plugin = new LanguageNegotiation([], 'map', []);
|
||||
$this->setExpectedException(MigrateException::class, 'The input should be an array');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('The input should be an array');
|
||||
$this->plugin->transform('foo', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@ class LanguageTypesTest extends MigrateProcessTestCase {
|
|||
*/
|
||||
public function testStringInput() {
|
||||
$this->plugin = new LanguageTypes([], 'map', []);
|
||||
$this->setExpectedException(MigrateException::class, 'The input should be an array');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('The input should be an array');
|
||||
$this->plugin->transform('foo', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -179,7 +179,8 @@ class DefaultsSectionStorageTest extends KernelTestBase {
|
|||
*/
|
||||
public function testSetSectionList() {
|
||||
$section_list = $this->prophesize(SectionListInterface::class);
|
||||
$this->setExpectedException(\Exception::class, '\Drupal\layout_builder\SectionStorageInterface::setSectionList() must no longer be called. The section list should be derived from context. See https://www.drupal.org/node/3016262.');
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessage('\Drupal\layout_builder\SectionStorageInterface::setSectionList() must no longer be called. The section list should be derived from context. See https://www.drupal.org/node/3016262.');
|
||||
$this->plugin->setSectionList($section_list->reveal());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ class FieldBlockTest extends EntityKernelTestBase {
|
|||
$entity->get('the_field_name')->willReturn($field->reveal());
|
||||
|
||||
$block = $this->getTestBlock($entity);
|
||||
$this->setExpectedException(EnforcedResponseException::class);
|
||||
$this->expectException(EnforcedResponseException::class);
|
||||
$block->build();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class LayoutBuilderEntityViewDisplayTest extends SectionStorageTestBase {
|
|||
* Tests that configuration schema enforces valid values.
|
||||
*/
|
||||
public function testInvalidConfiguration() {
|
||||
$this->setExpectedException(SchemaIncompleteException::class);
|
||||
$this->expectException(SchemaIncompleteException::class);
|
||||
$this->sectionStorage->getSection(0)->getComponent('first-uuid')->setConfiguration(['id' => 'foo', 'bar' => 'baz']);
|
||||
$this->sectionStorage->save();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,7 +216,8 @@ class OverridesSectionStorageTest extends KernelTestBase {
|
|||
*/
|
||||
public function testSetSectionList() {
|
||||
$section_list = $this->prophesize(SectionListInterface::class);
|
||||
$this->setExpectedException(\Exception::class, '\Drupal\layout_builder\SectionStorageInterface::setSectionList() must no longer be called. The section list should be derived from context. See https://www.drupal.org/node/3016262.');
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessage('\Drupal\layout_builder\SectionStorageInterface::setSectionList() must no longer be called. The section list should be derived from context. See https://www.drupal.org/node/3016262.');
|
||||
$this->plugin->setSectionList($section_list->reveal());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ class SectionListTraitTest extends SectionStorageTestBase {
|
|||
* @covers ::addBlankSection
|
||||
*/
|
||||
public function testAddBlankSection() {
|
||||
$this->setExpectedException(\Exception::class, 'A blank section must only be added to an empty list');
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessage('A blank section must only be added to an empty list');
|
||||
$this->sectionStorage->addBlankSection();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,8 @@ abstract class SectionStorageTestBase extends EntityKernelTestBase {
|
|||
* @covers ::getSection
|
||||
*/
|
||||
public function testGetSectionInvalidDelta() {
|
||||
$this->setExpectedException(\OutOfBoundsException::class, 'Invalid delta "2"');
|
||||
$this->expectException(\OutOfBoundsException::class);
|
||||
$this->expectExceptionMessage('Invalid delta "2"');
|
||||
$this->sectionStorage->getSection(2);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ class DefaultsSectionStorageTest extends UnitTestCase {
|
|||
}
|
||||
|
||||
if (!$success) {
|
||||
$this->setExpectedException(\InvalidArgumentException::class);
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
}
|
||||
|
||||
$result = $this->plugin->getSectionListFromId($value);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,8 @@ class LayoutTempstoreRepositoryTest extends UnitTestCase {
|
|||
|
||||
$repository = new LayoutTempstoreRepository($tempstore_factory->reveal());
|
||||
|
||||
$this->setExpectedException(\UnexpectedValueException::class, 'The entry with storage type "my_storage_type" and ID "my_storage_id" is invalid');
|
||||
$this->expectException(\UnexpectedValueException::class);
|
||||
$this->expectExceptionMessage('The entry with storage type "my_storage_type" and ID "my_storage_id" is invalid');
|
||||
$repository->get($section_storage->reveal());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ class OverridesSectionStorageTest extends UnitTestCase {
|
|||
}
|
||||
|
||||
if (!$success) {
|
||||
$this->setExpectedException(\InvalidArgumentException::class);
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
}
|
||||
|
||||
$result = $this->plugin->getSectionListFromId($id);
|
||||
|
|
|
|||
|
|
@ -296,7 +296,8 @@ class SectionRenderTest extends UnitTestCase {
|
|||
* @covers ::toRenderArray
|
||||
*/
|
||||
public function testToRenderArrayMissingPluginId() {
|
||||
$this->setExpectedException(PluginException::class, 'No plugin ID specified for component with "some_uuid" UUID');
|
||||
$this->expectException(PluginException::class);
|
||||
$this->expectExceptionMessage('No plugin ID specified for component with "some_uuid" UUID');
|
||||
(new Section('layout_onecol', [], [new SectionComponent('some_uuid', 'content')]))->toRenderArray();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ class SectionTest extends UnitTestCase {
|
|||
* @covers ::getComponent
|
||||
*/
|
||||
public function testGetComponentInvalidUuid() {
|
||||
$this->setExpectedException(\InvalidArgumentException::class, 'Invalid UUID "invalid-uuid"');
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Invalid UUID "invalid-uuid"');
|
||||
$this->section->getComponent('invalid-uuid');
|
||||
}
|
||||
|
||||
|
|
@ -122,7 +123,8 @@ class SectionTest extends UnitTestCase {
|
|||
* @covers ::insertAfterComponent
|
||||
*/
|
||||
public function testInsertAfterComponentValidUuidRegionMismatch() {
|
||||
$this->setExpectedException(\InvalidArgumentException::class, 'Invalid preceding UUID "existing-uuid"');
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Invalid preceding UUID "existing-uuid"');
|
||||
$this->section->insertAfterComponent('existing-uuid', new SectionComponent('new-uuid', 'ordered-region'));
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +132,8 @@ class SectionTest extends UnitTestCase {
|
|||
* @covers ::insertAfterComponent
|
||||
*/
|
||||
public function testInsertAfterComponentInvalidUuid() {
|
||||
$this->setExpectedException(\InvalidArgumentException::class, 'Invalid preceding UUID "invalid-uuid"');
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Invalid preceding UUID "invalid-uuid"');
|
||||
$this->section->insertAfterComponent('invalid-uuid', new SectionComponent('new-uuid', 'ordered-region'));
|
||||
}
|
||||
|
||||
|
|
@ -169,7 +172,8 @@ class SectionTest extends UnitTestCase {
|
|||
* @covers ::insertComponent
|
||||
*/
|
||||
public function testInsertComponentInvalidDelta() {
|
||||
$this->setExpectedException(\OutOfBoundsException::class, 'Invalid delta "7" for the "new-uuid" component');
|
||||
$this->expectException(\OutOfBoundsException::class);
|
||||
$this->expectExceptionMessage('Invalid delta "7" for the "new-uuid" component');
|
||||
$this->section->insertComponent(7, new SectionComponent('new-uuid', 'ordered-region'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,8 @@ class LinkItemSerializationTest extends FieldKernelTestBase {
|
|||
$json = json_decode($this->serializer->serialize($entity, 'json'), TRUE);
|
||||
$json['field_test'][0]['options'] = 'string data';
|
||||
$serialized = json_encode($json, TRUE);
|
||||
$this->setExpectedException(\LogicException::class, 'The generic FieldItemNormalizer cannot denormalize string values for "options" properties of the "field_test" field (field item class: Drupal\link\Plugin\Field\FieldType\LinkItem).');
|
||||
$this->expectException(\LogicException::class);
|
||||
$this->expectExceptionMessage('The generic FieldItemNormalizer cannot denormalize string values for "options" properties of the "field_test" field (field item class: Drupal\link\Plugin\Field\FieldType\LinkItem).');
|
||||
$this->serializer->deserialize($serialized, EntityTest::class, 'json');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ class StringBaseTest extends UnitTestCase {
|
|||
*/
|
||||
public function testSaveWithoutStorage() {
|
||||
$string = new SourceString(['source' => 'test']);
|
||||
$this->setExpectedException(StringStorageException::class, 'The string cannot be saved because its not bound to a storage: test');
|
||||
$this->expectException(StringStorageException::class);
|
||||
$this->expectExceptionMessage('The string cannot be saved because its not bound to a storage: test');
|
||||
$string->save();
|
||||
}
|
||||
|
||||
|
|
@ -26,7 +27,8 @@ class StringBaseTest extends UnitTestCase {
|
|||
*/
|
||||
public function testDeleteWithoutStorage() {
|
||||
$string = new SourceString(['lid' => 1, 'source' => 'test']);
|
||||
$this->setExpectedException(StringStorageException::class, 'The string cannot be deleted because its not bound to a storage: test');
|
||||
$this->expectException(StringStorageException::class);
|
||||
$this->expectExceptionMessage('The string cannot be deleted because its not bound to a storage: test');
|
||||
$string->delete();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@ class ProviderRepositoryTest extends MediaFunctionalTestBase {
|
|||
$client->method('request')->withAnyParameters()->willReturn($response->reveal());
|
||||
$this->container->set('http_client', $client);
|
||||
|
||||
$this->setExpectedException(ProviderException::class, 'Remote oEmbed providers database returned invalid or empty list.');
|
||||
$this->expectException(ProviderException::class);
|
||||
$this->expectExceptionMessage('Remote oEmbed providers database returned invalid or empty list.');
|
||||
$this->container->get('media.oembed.provider_repository')->getAll();
|
||||
}
|
||||
|
||||
|
|
@ -62,7 +63,8 @@ class ProviderRepositoryTest extends MediaFunctionalTestBase {
|
|||
->set('oembed_providers_url', $providers_url)
|
||||
->save();
|
||||
|
||||
$this->setExpectedException(ProviderException::class, $exception_message);
|
||||
$this->expectException(ProviderException::class);
|
||||
$this->expectExceptionMessage($exception_message);
|
||||
$this->container->get('media.oembed.provider_repository')->getAll();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ class OEmbedIframeControllerTest extends MediaKernelTestBase {
|
|||
|
||||
$this->assertInternalType('callable', $controller);
|
||||
|
||||
$this->setExpectedException('\Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException', 'This resource is not available');
|
||||
$this->expectException('\Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException');
|
||||
$this->expectExceptionMessage('This resource is not available');
|
||||
$request = new Request([
|
||||
'url' => 'https://example.com/path/to/resource',
|
||||
'hash' => $hash,
|
||||
|
|
|
|||
|
|
@ -120,7 +120,8 @@ class MediaLibraryAddFormTest extends KernelTestBase {
|
|||
*/
|
||||
public function testFormStateValidation() {
|
||||
$form_state = new FormState();
|
||||
$this->setExpectedException(\InvalidArgumentException::class, 'The media library state is not present in the form state.');
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('The media library state is not present in the form state.');
|
||||
\Drupal::formBuilder()->buildForm(FileUploadForm::class, $form_state);
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +132,8 @@ class MediaLibraryAddFormTest extends KernelTestBase {
|
|||
$state = MediaLibraryState::create('test', ['image', 'remote_video', 'header_image'], 'header_image', -1);
|
||||
$form_state = new FormState();
|
||||
$form_state->set('media_library_state', $state);
|
||||
$this->setExpectedException(\InvalidArgumentException::class, "The 'header_image' media type does not exist.");
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage("The 'header_image' media type does not exist.");
|
||||
\Drupal::formBuilder()->buildForm(FileUploadForm::class, $form_state);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,8 @@ class MediaLibraryStateTest extends KernelTestBase {
|
|||
*/
|
||||
public function testCreate($opener_id, array $allowed_media_type_ids, $selected_type_id, $remaining_slots, $exception_message = '') {
|
||||
if ($exception_message) {
|
||||
$this->setExpectedException(\InvalidArgumentException::class, $exception_message);
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage($exception_message);
|
||||
}
|
||||
$state = MediaLibraryState::create($opener_id, $allowed_media_type_ids, $selected_type_id, $remaining_slots);
|
||||
$this->assertInstanceOf(MediaLibraryState::class, $state);
|
||||
|
|
@ -275,7 +276,8 @@ class MediaLibraryStateTest extends KernelTestBase {
|
|||
$query = MediaLibraryState::create('test', ['file', 'image'], 'image', 2)->all();
|
||||
$query = array_merge($query, $query_overrides);
|
||||
if ($exception_expected) {
|
||||
$this->setExpectedException(BadRequestHttpException::class, "Invalid media library parameters specified.");
|
||||
$this->expectException(BadRequestHttpException::class);
|
||||
$this->expectExceptionMessage("Invalid media library parameters specified.");
|
||||
}
|
||||
$state = MediaLibraryState::fromRequest(new Request($query));
|
||||
$this->assertInstanceOf(MediaLibraryState::class, $state);
|
||||
|
|
@ -285,7 +287,8 @@ class MediaLibraryStateTest extends KernelTestBase {
|
|||
* @covers ::fromRequest
|
||||
*/
|
||||
public function testFromRequestQueryLess() {
|
||||
$this->setExpectedException(\InvalidArgumentException::class, 'The opener ID parameter is required and must be a string.');
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('The opener ID parameter is required and must be a string.');
|
||||
$state = MediaLibraryState::fromRequest(new Request());
|
||||
$this->assertInstanceOf(MediaLibraryState::class, $state);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,8 @@ class LinkUriTest extends KernelTestBase {
|
|||
* @dataProvider providerTestNotRouted
|
||||
*/
|
||||
public function testNotRouted($value, $exception_message) {
|
||||
$this->setExpectedException(MigrateException::class, $exception_message);
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage($exception_message);
|
||||
$this->doTransform($value);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ class MigrationProvidersExistTest extends MigrateDrupalTestBase {
|
|||
*/
|
||||
public function testSourceProvider() {
|
||||
$this->enableModules(['migration_provider_test']);
|
||||
$this->setExpectedException(BadPluginDefinitionException::class, 'The no_source_module plugin must define the source_module property.');
|
||||
$this->expectException(BadPluginDefinitionException::class);
|
||||
$this->expectExceptionMessage('The no_source_module plugin must define the source_module property.');
|
||||
$this->container->get('plugin.manager.migration')->getDefinition('migration_provider_no_annotation');
|
||||
}
|
||||
|
||||
|
|
@ -173,7 +174,8 @@ class MigrationProvidersExistTest extends MigrateDrupalTestBase {
|
|||
$plugin_manager->method('getDiscovery')
|
||||
->willReturn($discovery);
|
||||
|
||||
$this->setExpectedException(BadPluginDefinitionException::class, "The missing_{$missing_property} plugin must define the $missing_property property.");
|
||||
$this->expectException(BadPluginDefinitionException::class);
|
||||
$this->expectExceptionMessage("The missing_{$missing_property} plugin must define the $missing_property property.");
|
||||
$plugin_manager->getDefinitions();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ class MigrationTest extends KernelTestBase {
|
|||
*/
|
||||
public function testGetProcessPluginsException() {
|
||||
$migration = \Drupal::service('plugin.manager.migration')->createStubMigration([]);
|
||||
$this->setExpectedException(MigrateException::class, 'Invalid process configuration for foobar');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('Invalid process configuration for foobar');
|
||||
$migration->getProcessPlugins(['foobar' => ['plugin' => 'get']]);
|
||||
}
|
||||
|
||||
|
|
@ -123,7 +124,8 @@ class MigrationTest extends KernelTestBase {
|
|||
*/
|
||||
public function testGetDestinationPlugin() {
|
||||
$migration = \Drupal::service('plugin.manager.migration')->createStubMigration(['destination' => ['no_stub' => TRUE]]);
|
||||
$this->setExpectedException(MigrateSkipRowException::class, "Stub requested but not made because no_stub configuration is set.");
|
||||
$this->expectException(MigrateSkipRowException::class);
|
||||
$this->expectExceptionMessage("Stub requested but not made because no_stub configuration is set.");
|
||||
$migration->getDestinationPlugin(TRUE);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ class QueryBatchTest extends KernelTestBase {
|
|||
* Tests a negative batch size throws an exception.
|
||||
*/
|
||||
public function testBatchSizeNegative() {
|
||||
$this->setExpectedException(MigrateException::class, 'batch_size must be greater than or equal to zero');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('batch_size must be greater than or equal to zero');
|
||||
$plugin = $this->getPlugin(['batch_size' => -1]);
|
||||
$plugin->next();
|
||||
}
|
||||
|
|
@ -66,7 +67,8 @@ class QueryBatchTest extends KernelTestBase {
|
|||
* Tests a non integer batch size throws an exception.
|
||||
*/
|
||||
public function testBatchSizeNonInteger() {
|
||||
$this->setExpectedException(MigrateException::class, 'batch_size must be greater than or equal to zero');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('batch_size must be greater than or equal to zero');
|
||||
$plugin = $this->getPlugin(['batch_size' => '1']);
|
||||
$plugin->next();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,8 +123,8 @@ class SqlBaseTest extends MigrateTestBase {
|
|||
\Drupal::state()->delete('migrate.fallback_state_key');
|
||||
$sql_base->setConfiguration([]);
|
||||
Database::renameConnection('migrate', 'fallback_connection');
|
||||
$this->setExpectedException(RequirementsException::class,
|
||||
'No database connection configured for source plugin');
|
||||
$this->expectException(RequirementsException::class);
|
||||
$this->expectExceptionMessage('No database connection configured for source plugin');
|
||||
$sql_base->getDatabase();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,8 @@ class FileCopyTest extends FileTestBase {
|
|||
*/
|
||||
public function testNonExistentSourceFile() {
|
||||
$source = '/non/existent/file';
|
||||
$this->setExpectedException(MigrateException::class, "File '/non/existent/file' does not exist");
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage("File '/non/existent/file' does not exist");
|
||||
$this->doTransform($source, 'public://wontmatter.jpg');
|
||||
}
|
||||
|
||||
|
|
@ -191,7 +192,8 @@ class FileCopyTest extends FileTestBase {
|
|||
$this->fileSystem->chmod('public://dir', 0);
|
||||
|
||||
// Check that the proper exception is raised.
|
||||
$this->setExpectedException(MigrateException::class, "Could not create or write to directory 'public://dir/subdir2'");
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage("Could not create or write to directory 'public://dir/subdir2'");
|
||||
$this->doTransform($source, 'public://dir/subdir2/file.txt');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -435,7 +435,8 @@ class MigrateExecutableTest extends MigrateTestCase {
|
|||
$plugins['destination_id'] = [$plugin, $plugin];
|
||||
$this->migration->method('getProcessPlugins')->willReturn($plugins);
|
||||
|
||||
$this->setExpectedException(MigrateException::class, 'Pipeline failed at plugin_id plugin for destination destination_id: transform_return_string received instead of an array,');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('Pipeline failed at plugin_id plugin for destination destination_id: transform_return_string received instead of an array,');
|
||||
$this->executable->processRow($row);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ class MigrateSourceTest extends MigrateTestCase {
|
|||
*/
|
||||
public function testHighwaterTrackChangesIncompatible() {
|
||||
$source_config = ['track_changes' => TRUE, 'high_water_property' => ['name' => 'something']];
|
||||
$this->setExpectedException(MigrateException::class);
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->getSource($source_config);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ class MigrationTest extends UnitTestCase {
|
|||
$migration->setSourcePlugin($source_plugin);
|
||||
$migration->setDestinationPlugin($destination_plugin);
|
||||
|
||||
$this->setExpectedException(RequirementsException::class, 'Missing source requirement');
|
||||
$this->expectException(RequirementsException::class);
|
||||
$this->expectExceptionMessage('Missing source requirement');
|
||||
$migration->checkRequirements();
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +62,8 @@ class MigrationTest extends UnitTestCase {
|
|||
$migration->setSourcePlugin($source_plugin);
|
||||
$migration->setDestinationPlugin($destination_plugin);
|
||||
|
||||
$this->setExpectedException(RequirementsException::class, 'Missing destination requirement');
|
||||
$this->expectException(RequirementsException::class);
|
||||
$this->expectExceptionMessage('Missing destination requirement');
|
||||
$migration->checkRequirements();
|
||||
}
|
||||
|
||||
|
|
@ -105,7 +107,8 @@ class MigrationTest extends UnitTestCase {
|
|||
->with(['test_a', 'test_b', 'test_c', 'test_d'])
|
||||
->willReturn(['test_b' => $migration_b, 'test_c' => $migration_c, 'test_d' => $migration_d]);
|
||||
|
||||
$this->setExpectedException(RequirementsException::class, 'Missing migrations test_a, test_c');
|
||||
$this->expectException(RequirementsException::class);
|
||||
$this->expectExceptionMessage('Missing migrations test_a, test_c');
|
||||
$migration->checkRequirements();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ class CheckRequirementsTest extends UnitTestCase {
|
|||
$this->prophesize(ConfigFactoryInterface::class)->reveal(),
|
||||
$this->prophesize(LanguageManagerInterface::class)->reveal()
|
||||
);
|
||||
$this->setExpectedException(RequirementsException::class, "Destination plugin 'test' did not meet the requirements");
|
||||
$this->expectException(RequirementsException::class);
|
||||
$this->expectExceptionMessage("Destination plugin 'test' did not meet the requirements");
|
||||
$destination->checkRequirements();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,8 @@ class EntityContentBaseTest extends EntityTestBase {
|
|||
$this->entityFieldManager->reveal(),
|
||||
$this->prophesize(FieldTypePluginManagerInterface::class)->reveal());
|
||||
$destination->setEntity(FALSE);
|
||||
$this->setExpectedException(MigrateException::class, 'Unable to get entity');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('Unable to get entity');
|
||||
$destination->import(new Row());
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +88,8 @@ class EntityContentBaseTest extends EntityTestBase {
|
|||
$this->entityFieldManager->reveal(),
|
||||
$this->prophesize(FieldTypePluginManagerInterface::class)->reveal()
|
||||
);
|
||||
$this->setExpectedException(MigrateException::class, 'The "foo" entity type does not support translations.');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('The "foo" entity type does not support translations.');
|
||||
$destination->getIds();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ class EntityRevisionTest extends EntityTestBase {
|
|||
$this->entityFieldManager->reveal(),
|
||||
$this->prophesize(FieldTypePluginManagerInterface::class)->reveal()
|
||||
);
|
||||
$this->setExpectedException(MigrateException::class, 'The "foo" entity type does not support revisions.');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('The "foo" entity type does not support revisions.');
|
||||
$destination->getIds();
|
||||
}
|
||||
|
||||
|
|
@ -82,7 +83,8 @@ class EntityRevisionTest extends EntityTestBase {
|
|||
$this->entityFieldManager->reveal(),
|
||||
$this->prophesize(FieldTypePluginManagerInterface::class)->reveal()
|
||||
);
|
||||
$this->setExpectedException(MigrateException::class, 'The "foo" entity type does not support translations.');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('The "foo" entity type does not support translations.');
|
||||
$destination->getIds();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ class RowTest extends UnitTestCase {
|
|||
$invalid_values = [
|
||||
'title' => 'node X',
|
||||
];
|
||||
$this->setExpectedException(\Exception::class);
|
||||
$this->expectException(\Exception::class);
|
||||
$row = new Row($invalid_values, $this->testSourceIds);
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ class RowTest extends UnitTestCase {
|
|||
$row->rehash();
|
||||
$this->assertSame($this->testHashMod, $row->getHash(), 'Hash changed correctly.');
|
||||
$row->freezeSource();
|
||||
$this->setExpectedException(\Exception::class);
|
||||
$this->expectException(\Exception::class);
|
||||
$row->setSourceProperty('title', 'new title');
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +140,8 @@ class RowTest extends UnitTestCase {
|
|||
public function testSetFrozenRow() {
|
||||
$row = new Row($this->testValues, $this->testSourceIds);
|
||||
$row->freezeSource();
|
||||
$this->setExpectedException(\Exception::class, "The source is frozen and can't be changed any more");
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessage("The source is frozen and can't be changed any more");
|
||||
$row->setSourceProperty('title', 'new title');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ class ArrayBuildTest extends MigrateProcessTestCase {
|
|||
$source = [
|
||||
['bar' => 'foo'],
|
||||
];
|
||||
$this->setExpectedException(MigrateException::class, "The key 'foo' does not exist");
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage("The key 'foo' does not exist");
|
||||
$this->plugin->transform($source, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +58,8 @@ class ArrayBuildTest extends MigrateProcessTestCase {
|
|||
$source = [
|
||||
['foo' => 'bar'],
|
||||
];
|
||||
$this->setExpectedException(MigrateException::class, "The key 'bar' does not exist");
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage("The key 'bar' does not exist");
|
||||
$this->plugin->transform($source, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +68,8 @@ class ArrayBuildTest extends MigrateProcessTestCase {
|
|||
*/
|
||||
public function testOneDimensionalArrayInput() {
|
||||
$source = ['foo' => 'bar'];
|
||||
$this->setExpectedException(MigrateException::class, 'The input should be an array of arrays');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('The input should be an array of arrays');
|
||||
$this->plugin->transform($source, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
@ -75,7 +78,8 @@ class ArrayBuildTest extends MigrateProcessTestCase {
|
|||
*/
|
||||
public function testStringInput() {
|
||||
$source = 'foo';
|
||||
$this->setExpectedException(MigrateException::class, 'The input should be an array of arrays');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('The input should be an array of arrays');
|
||||
$this->plugin->transform($source, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ class CallbackTest extends MigrateProcessTestCase {
|
|||
* @dataProvider providerCallbackExceptions
|
||||
*/
|
||||
public function testCallbackExceptions($message, $configuration) {
|
||||
$this->setExpectedException(\InvalidArgumentException::class, $message);
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage($message);
|
||||
$this->plugin = new Callback($configuration, 'map', []);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class ConcatTest extends MigrateProcessTestCase {
|
|||
* Test concat fails properly on non-arrays.
|
||||
*/
|
||||
public function testConcatWithNonArray() {
|
||||
$this->setExpectedException(MigrateException::class);
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->plugin->transform('foo', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,8 @@ class DedupeEntityTest extends MigrateProcessTestCase {
|
|||
'start' => 'foobar',
|
||||
];
|
||||
$plugin = new DedupeEntity($configuration, 'dedupe_entity', [], $this->getMigration(), $this->entityTypeManager);
|
||||
$this->setExpectedException('Drupal\migrate\MigrateException', 'The start position configuration key should be an integer. Omit this key to capture from the beginning of the string.');
|
||||
$this->expectException('Drupal\migrate\MigrateException');
|
||||
$this->expectExceptionMessage('The start position configuration key should be an integer. Omit this key to capture from the beginning of the string.');
|
||||
$plugin->transform('test_start', $this->migrateExecutable, $this->row, 'testproperty');
|
||||
}
|
||||
|
||||
|
|
@ -105,7 +106,8 @@ class DedupeEntityTest extends MigrateProcessTestCase {
|
|||
'length' => 'foobar',
|
||||
];
|
||||
$plugin = new DedupeEntity($configuration, 'dedupe_entity', [], $this->getMigration(), $this->entityTypeManager);
|
||||
$this->setExpectedException('Drupal\migrate\MigrateException', 'The character length configuration key should be an integer. Omit this key to capture the entire string.');
|
||||
$this->expectException('Drupal\migrate\MigrateException');
|
||||
$this->expectExceptionMessage('The character length configuration key should be an integer. Omit this key to capture the entire string.');
|
||||
$plugin->transform('test_length', $this->migrateExecutable, $this->row, 'testproperty');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ class ExplodeTest extends MigrateProcessTestCase {
|
|||
* Test explode fails properly on non-strings.
|
||||
*/
|
||||
public function testExplodeWithNonString() {
|
||||
$this->setExpectedException(MigrateException::class, 'is not a string');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('is not a string');
|
||||
$this->plugin->transform(['foo'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
@ -93,7 +94,8 @@ class ExplodeTest extends MigrateProcessTestCase {
|
|||
*/
|
||||
public function testExplodeWithNonStrictAndNonCastable() {
|
||||
$plugin = new Explode(['delimiter' => '|', 'strict' => FALSE], 'map', []);
|
||||
$this->setExpectedException(MigrateException::class, 'cannot be casted to a string');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('cannot be casted to a string');
|
||||
$processed = $plugin->transform(['foo'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$this->assertSame(['foo'], $processed);
|
||||
}
|
||||
|
|
@ -112,7 +114,8 @@ class ExplodeTest extends MigrateProcessTestCase {
|
|||
* Test explode fails with empty delimiter.
|
||||
*/
|
||||
public function testExplodeWithEmptyDelimiter() {
|
||||
$this->setExpectedException(MigrateException::class, 'delimiter is empty');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('delimiter is empty');
|
||||
$plugin = new Explode(['delimiter' => ''], 'map', []);
|
||||
$plugin->transform('foo,bar', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ class ExtractTest extends MigrateProcessTestCase {
|
|||
* Tests invalid input.
|
||||
*/
|
||||
public function testExtractFromString() {
|
||||
$this->setExpectedException(MigrateException::class, 'Input should be an array.');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('Input should be an array.');
|
||||
$this->plugin->transform('bar', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
@ -40,7 +41,8 @@ class ExtractTest extends MigrateProcessTestCase {
|
|||
* Tests unsuccessful extraction.
|
||||
*/
|
||||
public function testExtractFail() {
|
||||
$this->setExpectedException(MigrateException::class, 'Array index missing, extraction failed.');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('Array index missing, extraction failed.');
|
||||
$this->plugin->transform(['bar' => 'foo'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ class FormatDateTest extends MigrateProcessTestCase {
|
|||
'to_format' => 'Y-m-d',
|
||||
];
|
||||
|
||||
$this->setExpectedException(MigrateException::class, 'Format date plugin is missing from_format configuration.');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('Format date plugin is missing from_format configuration.');
|
||||
$this->plugin = new FormatDate($configuration, 'test_format_date', []);
|
||||
$this->plugin->transform('01/05/1955', $this->migrateExecutable, $this->row, 'field_date');
|
||||
}
|
||||
|
|
@ -37,7 +38,8 @@ class FormatDateTest extends MigrateProcessTestCase {
|
|||
'to_format' => '',
|
||||
];
|
||||
|
||||
$this->setExpectedException(MigrateException::class, 'Format date plugin is missing to_format configuration.');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('Format date plugin is missing to_format configuration.');
|
||||
$this->plugin = new FormatDate($configuration, 'test_format_date', []);
|
||||
$this->plugin->transform('01/05/1955', $this->migrateExecutable, $this->row, 'field_date');
|
||||
}
|
||||
|
|
@ -51,7 +53,8 @@ class FormatDateTest extends MigrateProcessTestCase {
|
|||
'to_format' => 'Y-m-d',
|
||||
];
|
||||
|
||||
$this->setExpectedException(MigrateException::class, "Format date plugin could not transform 'January 5, 1955' using the format 'm/d/Y' for destination 'field_date'. Error: The date cannot be created from a format.");
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage("Format date plugin could not transform 'January 5, 1955' using the format 'm/d/Y' for destination 'field_date'. Error: The date cannot be created from a format.");
|
||||
$this->plugin = new FormatDate($configuration, 'test_format_date', []);
|
||||
$this->plugin->transform('January 5, 1955', $this->migrateExecutable, $this->row, 'field_date');
|
||||
}
|
||||
|
|
@ -65,7 +68,8 @@ class FormatDateTest extends MigrateProcessTestCase {
|
|||
'to_format' => 'Y-m-d',
|
||||
];
|
||||
|
||||
$this->setExpectedException(MigrateException::class, "Format date plugin could not transform '01/05/55' using the format 'm/d/Y' for destination 'field_date'. Error: The created date does not match the input value.");
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage("Format date plugin could not transform '01/05/55' using the format 'm/d/Y' for destination 'field_date'. Error: The created date does not match the input value.");
|
||||
$this->plugin = new FormatDate($configuration, 'test_format_date', []);
|
||||
$this->plugin->transform('01/05/55', $this->migrateExecutable, $this->row, 'field_date');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,8 @@ class MakeUniqueEntityFieldTest extends MigrateProcessTestCase {
|
|||
'start' => 'foobar',
|
||||
];
|
||||
$plugin = new MakeUniqueEntityField($configuration, 'make_unique', [], $this->getMigration(), $this->entityTypeManager);
|
||||
$this->setExpectedException('Drupal\migrate\MigrateException', 'The start position configuration key should be an integer. Omit this key to capture from the beginning of the string.');
|
||||
$this->expectException('Drupal\migrate\MigrateException');
|
||||
$this->expectExceptionMessage('The start position configuration key should be an integer. Omit this key to capture from the beginning of the string.');
|
||||
$plugin->transform('test_start', $this->migrateExecutable, $this->row, 'testproperty');
|
||||
}
|
||||
|
||||
|
|
@ -104,7 +105,8 @@ class MakeUniqueEntityFieldTest extends MigrateProcessTestCase {
|
|||
'length' => 'foobar',
|
||||
];
|
||||
$plugin = new MakeUniqueEntityField($configuration, 'make_unique', [], $this->getMigration(), $this->entityTypeManager);
|
||||
$this->setExpectedException('Drupal\migrate\MigrateException', 'The character length configuration key should be an integer. Omit this key to capture the entire string.');
|
||||
$this->expectException('Drupal\migrate\MigrateException');
|
||||
$this->expectExceptionMessage('The character length configuration key should be an integer. Omit this key to capture the entire string.');
|
||||
$plugin->transform('test_length', $this->migrateExecutable, $this->row, 'testproperty');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ class MenuLinkParentTest extends MigrateProcessTestCase {
|
|||
* @covers ::transform
|
||||
*/
|
||||
public function testTransformException() {
|
||||
$this->setExpectedException(MigrateSkipRowException::class, "No parent link found for plid '1' in menu 'admin'.");
|
||||
$this->expectException(MigrateSkipRowException::class);
|
||||
$this->expectExceptionMessage("No parent link found for plid '1' in menu 'admin'.");
|
||||
$this->plugin->transform([1, 'admin', NULL], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class MigrationLookupTest extends MigrateProcessTestCase {
|
|||
$migration_plugin_manager->createInstances(['foobaz'])
|
||||
->willReturn(['foobaz' => $migration_plugin->reveal()]);
|
||||
$migration = new MigrationLookup($configuration, 'migration_lookup', [], $migration_plugin->reveal(), $migration_plugin_manager->reveal());
|
||||
$this->setExpectedException(MigrateSkipProcessException::class);
|
||||
$this->expectException(MigrateSkipProcessException::class);
|
||||
$migration->transform($value, $this->migrateExecutable, $this->row, 'foo');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ class MigrationTest extends MigrateProcessTestCase {
|
|||
$this->migration_plugin_manager->createInstances(['foobaz'])
|
||||
->willReturn(['foobaz' => $this->migration_plugin->reveal()]);
|
||||
$migration = new Migration($configuration, 'migration', [], $this->migration_plugin->reveal(), $this->migration_plugin_manager->reveal(), $this->process_plugin_manager->reveal());
|
||||
$this->setExpectedException(MigrateSkipProcessException::class);
|
||||
$this->expectException(MigrateSkipProcessException::class);
|
||||
$migration->transform(FALSE, $this->migrateExecutable, $this->row, 'foo');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class SkipOnEmptyTest extends MigrateProcessTestCase {
|
|||
*/
|
||||
public function testProcessSkipsOnEmpty() {
|
||||
$configuration['method'] = 'process';
|
||||
$this->setExpectedException(MigrateSkipProcessException::class);
|
||||
$this->expectException(MigrateSkipProcessException::class);
|
||||
(new SkipOnEmpty($configuration, 'skip_on_empty', []))
|
||||
->transform('', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
|
@ -39,7 +39,7 @@ class SkipOnEmptyTest extends MigrateProcessTestCase {
|
|||
*/
|
||||
public function testRowSkipsOnEmpty() {
|
||||
$configuration['method'] = 'row';
|
||||
$this->setExpectedException(MigrateSkipRowException::class);
|
||||
$this->expectException(MigrateSkipRowException::class);
|
||||
(new SkipOnEmpty($configuration, 'skip_on_empty', []))
|
||||
->transform('', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@ class SkipOnEmptyTest extends MigrateProcessTestCase {
|
|||
'method' => 'row',
|
||||
];
|
||||
$process = new SkipOnEmpty($configuration, 'skip_on_empty', []);
|
||||
$this->setExpectedException(MigrateSkipRowException::class);
|
||||
$this->expectException(MigrateSkipRowException::class);
|
||||
$process->transform('', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +79,8 @@ class SkipOnEmptyTest extends MigrateProcessTestCase {
|
|||
'message' => 'The value is empty',
|
||||
];
|
||||
$process = new SkipOnEmpty($configuration, 'skip_on_empty', []);
|
||||
$this->setExpectedException(MigrateSkipRowException::class, 'The value is empty');
|
||||
$this->expectException(MigrateSkipRowException::class);
|
||||
$this->expectExceptionMessage('The value is empty');
|
||||
$process->transform('', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class SkipRowIfNotSetTest extends MigrateProcessTestCase {
|
|||
'index' => 'some_key',
|
||||
];
|
||||
$process = new SkipRowIfNotSet($configuration, 'skip_row_if_not_set', []);
|
||||
$this->setExpectedException(MigrateSkipRowException::class);
|
||||
$this->expectException(MigrateSkipRowException::class);
|
||||
$process->transform('', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +38,8 @@ class SkipRowIfNotSetTest extends MigrateProcessTestCase {
|
|||
'message' => "The 'some_key' key is not set",
|
||||
];
|
||||
$process = new SkipRowIfNotSet($configuration, 'skip_row_if_not_set', []);
|
||||
$this->setExpectedException(MigrateSkipRowException::class, "The 'some_key' key is not set");
|
||||
$this->expectException(MigrateSkipRowException::class);
|
||||
$this->expectExceptionMessage("The 'some_key' key is not set");
|
||||
$process->transform('', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class StaticMapTest extends MigrateProcessTestCase {
|
|||
* Tests when the source is empty.
|
||||
*/
|
||||
public function testMapwithEmptySource() {
|
||||
$this->setExpectedException(MigrateException::class);
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->plugin->transform([], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
@ -51,7 +51,8 @@ class StaticMapTest extends MigrateProcessTestCase {
|
|||
* Tests when the source is invalid.
|
||||
*/
|
||||
public function testMapwithInvalidSource() {
|
||||
$this->setExpectedException(MigrateSkipRowException::class, sprintf("No static mapping found for '%s' and no default value provided for destination '%s'.", Variable::export(['bar']), 'destinationproperty'));
|
||||
$this->expectException(MigrateSkipRowException::class);
|
||||
$this->expectExceptionMessage(sprintf("No static mapping found for '%s' and no default value provided for destination '%s'.", Variable::export(['bar']), 'destinationproperty'));
|
||||
$this->plugin->transform(['bar'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +86,8 @@ class StaticMapTest extends MigrateProcessTestCase {
|
|||
$configuration['default_value'] = 'test';
|
||||
$configuration['bypass'] = TRUE;
|
||||
$this->plugin = new StaticMap($configuration, 'map', []);
|
||||
$this->setExpectedException(MigrateException::class, 'Setting both default_value and bypass is invalid.');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('Setting both default_value and bypass is invalid.');
|
||||
$this->plugin->transform(['bar'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,8 @@ class SubstrTest extends MigrateProcessTestCase {
|
|||
public function testSubstrFail() {
|
||||
$configuration = [];
|
||||
$this->plugin = new Substr($configuration, 'map', []);
|
||||
$this->setExpectedException(MigrateException::class, 'The input value must be a string.');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('The input value must be a string.');
|
||||
$this->plugin->transform(['Captain Janeway'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
@ -70,7 +71,8 @@ class SubstrTest extends MigrateProcessTestCase {
|
|||
public function testStartIsString() {
|
||||
$configuration['start'] = '2';
|
||||
$this->plugin = new Substr($configuration, 'map', []);
|
||||
$this->setExpectedException(MigrateException::class, 'The start position configuration value should be an integer. Omit this key to capture from the beginning of the string.');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('The start position configuration value should be an integer. Omit this key to capture from the beginning of the string.');
|
||||
$this->plugin->transform(['foo'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +82,8 @@ class SubstrTest extends MigrateProcessTestCase {
|
|||
public function testLengthIsString() {
|
||||
$configuration['length'] = '1';
|
||||
$this->plugin = new Substr($configuration, 'map', []);
|
||||
$this->setExpectedException(MigrateException::class, 'The character length configuration value should be an integer. Omit this key to capture from the start position to the end of the string.');
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('The character length configuration value should be an integer. Omit this key to capture from the start position to the end of the string.');
|
||||
$this->plugin->transform(['foo'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,8 @@ class MigrateFieldPluginManagerTest extends MigrateDrupalTestBase {
|
|||
* @dataProvider nonExistentPluginExceptionsData
|
||||
*/
|
||||
public function testNonExistentPluginExceptions($core, $field_type) {
|
||||
$this->setExpectedException(PluginNotFoundException::class, sprintf("Plugin ID '%s' was not found.", $field_type));
|
||||
$this->expectException(PluginNotFoundException::class);
|
||||
$this->expectExceptionMessage(sprintf("Plugin ID '%s' was not found.", $field_type));
|
||||
$this->pluginManager->getPluginIdFromFieldType($field_type, ['core' => $core]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -188,7 +188,8 @@ class ContentEntityTest extends KernelTestBase {
|
|||
$plugin_definition = [
|
||||
'entity_type' => '',
|
||||
];
|
||||
$this->setExpectedException(InvalidPluginDefinitionException::class, 'Missing required "entity_type" definition.');
|
||||
$this->expectException(InvalidPluginDefinitionException::class);
|
||||
$this->expectExceptionMessage('Missing required "entity_type" definition.');
|
||||
ContentEntity::create($this->container, $configuration, 'content_entity', $plugin_definition, $migration);
|
||||
}
|
||||
|
||||
|
|
@ -201,7 +202,8 @@ class ContentEntityTest extends KernelTestBase {
|
|||
$plugin_definition = [
|
||||
'entity_type' => 'node_type',
|
||||
];
|
||||
$this->setExpectedException(InvalidPluginDefinitionException::class, 'The entity type (node_type) is not supported. The "content_entity" source plugin only supports content entities.');
|
||||
$this->expectException(InvalidPluginDefinitionException::class);
|
||||
$this->expectExceptionMessage('The entity type (node_type) is not supported. The "content_entity" source plugin only supports content entities.');
|
||||
ContentEntity::create($this->container, $configuration, 'content_entity:node_type', $plugin_definition, $migration);
|
||||
}
|
||||
|
||||
|
|
@ -216,7 +218,8 @@ class ContentEntityTest extends KernelTestBase {
|
|||
$plugin_definition = [
|
||||
'entity_type' => 'user',
|
||||
];
|
||||
$this->setExpectedException(\InvalidArgumentException::class, 'A bundle was provided but the entity type (user) is not bundleable');
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('A bundle was provided but the entity type (user) is not bundleable');
|
||||
ContentEntity::create($this->container, $configuration, 'content_entity:user', $plugin_definition, $migration);
|
||||
}
|
||||
|
||||
|
|
@ -231,7 +234,8 @@ class ContentEntityTest extends KernelTestBase {
|
|||
$plugin_definition = [
|
||||
'entity_type' => 'node',
|
||||
];
|
||||
$this->setExpectedException(\InvalidArgumentException::class, 'The provided bundle (foo) is not valid for the (node) entity type.');
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('The provided bundle (foo) is not valid for the (node) entity type.');
|
||||
ContentEntity::create($this->container, $configuration, 'content_entity:node', $plugin_definition, $migration);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ class FieldDiscoveryTest extends UnitTestCase {
|
|||
$migration->getMigrationTags()->willReturn($tags);
|
||||
$field_discovery = new FieldDiscoveryTestClass($this->fieldPluginManager->reveal(), $this->migrationPluginManager->reveal(), $this->logger->reveal());
|
||||
if (!$expected_result) {
|
||||
$this->setExpectedException(\InvalidArgumentException::class);
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
}
|
||||
$actual_result = $field_discovery->getCoreVersion($migration->reveal());
|
||||
$this->assertEquals($expected_result, $actual_result);
|
||||
|
|
@ -316,7 +316,8 @@ class FieldDiscoveryTest extends UnitTestCase {
|
|||
public function testGetFieldInstanceStubMigrationDefinition($core, $expected_definition) {
|
||||
$field_discovery = new FieldDiscoveryTestClass($this->fieldPluginManager->reveal(), $this->migrationPluginManager->reveal(), $this->logger->reveal());
|
||||
if (!$expected_definition) {
|
||||
$this->setExpectedException(\InvalidArgumentException::class, sprintf("Drupal version %s is not supported. Valid values for Drupal core version are '6' and '7'.", $core));
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage(sprintf("Drupal version %s is not supported. Valid values for Drupal core version are '6' and '7'.", $core));
|
||||
}
|
||||
$actual_definition = $field_discovery->getFieldInstanceStubMigrationDefinition($core);
|
||||
$this->assertSame($expected_definition, $actual_definition);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ class MigrateFieldPluginManagerTest extends UnitTestCase {
|
|||
$discovery->getDefinitions()->willReturn($this->pluginFixtureData());
|
||||
$manager = new MigrateFieldPluginManagerTestClass('field', new \ArrayObject(), $cache, $module_handler, MigrateField::class, $discovery->reveal());
|
||||
if (!$expected_plugin_id) {
|
||||
$this->setExpectedException(PluginNotFoundException::class, sprintf("Plugin ID '%s' was not found.", $field_type));
|
||||
$this->expectException(PluginNotFoundException::class);
|
||||
$this->expectExceptionMessage(sprintf("Plugin ID '%s' was not found.", $field_type));
|
||||
}
|
||||
$actual_plugin_id = $manager->getPluginIdFromFieldType($field_type, ['core' => $core]);
|
||||
$this->assertSame($expected_plugin_id, $actual_plugin_id);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ class DrupalSqlBaseTest extends MigrateTestCase {
|
|||
$plugin = new TestDrupalSqlBase([], 'placeholder_id', $plugin_definition, $this->getMigration(), $state, $entity_type_manager);
|
||||
$plugin->setDatabase($this->getDatabase($this->databaseContents));
|
||||
$system_data = $plugin->getSystemData();
|
||||
$this->setExpectedException(RequirementsException::class, 'The module module1 is not enabled in the source site.');
|
||||
$this->expectException(RequirementsException::class);
|
||||
$this->expectExceptionMessage('The module module1 is not enabled in the source site.');
|
||||
try {
|
||||
$plugin->checkRequirements();
|
||||
}
|
||||
|
|
@ -75,7 +76,8 @@ class DrupalSqlBaseTest extends MigrateTestCase {
|
|||
$entity_manager = $this->createMock('Drupal\Core\Entity\EntityTypeManagerInterface');
|
||||
$plugin = new TestDrupalSqlBase([], 'test', $plugin_definition, $this->getMigration(), $state, $entity_manager);
|
||||
$system_data = $plugin->getSystemData();
|
||||
$this->setExpectedException(RequirementsException::class, 'No database connection configured for source plugin test');
|
||||
$this->expectException(RequirementsException::class);
|
||||
$this->expectExceptionMessage('No database connection configured for source plugin test');
|
||||
$plugin->checkRequirements();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ trait FormatSpecificGetBcRouteTestTrait {
|
|||
* @see \Drupal\rest\Plugin\ResourceBase::routes
|
||||
*/
|
||||
public function testNoFormatSpecificGetBcRouteForOtherFormats() {
|
||||
$this->setExpectedException(RouteNotFoundException::class);
|
||||
$this->expectException(RouteNotFoundException::class);
|
||||
|
||||
$this->provisionEntityResource();
|
||||
$url = $this->getEntityResourceUrl();
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class EntityResourceValidationTraitTest extends UnitTestCase {
|
|||
$method = new \ReflectionMethod($trait, 'validate');
|
||||
$method->setAccessible(TRUE);
|
||||
|
||||
$this->setExpectedException(UnprocessableEntityHttpException::class);
|
||||
$this->expectException(UnprocessableEntityHttpException::class);
|
||||
|
||||
$method->invoke($trait, $entity->reveal());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,7 +265,8 @@ class EntitySerializationTest extends NormalizerTestBase {
|
|||
* Tests denormalizing serialized columns.
|
||||
*/
|
||||
public function testDenormalizeSerializedItem() {
|
||||
$this->setExpectedException(\LogicException::class, 'The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized" field (field item class: Drupal\entity_test\Plugin\Field\FieldType\SerializedItem).');
|
||||
$this->expectException(\LogicException::class);
|
||||
$this->expectExceptionMessage('The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized" field (field item class: Drupal\entity_test\Plugin\Field\FieldType\SerializedItem).');
|
||||
$this->serializer->denormalize([
|
||||
'serialized' => [
|
||||
[
|
||||
|
|
@ -283,7 +284,8 @@ class EntitySerializationTest extends NormalizerTestBase {
|
|||
$entity = EntitySerializedField::create(['serialized_text' => serialize(['Hello world!'])]);
|
||||
$normalized = $this->serializer->normalize($entity);
|
||||
$this->assertEquals($normalized['serialized_text'][0]['value'], ['Hello world!']);
|
||||
$this->setExpectedException(\LogicException::class, 'The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized_text" field (field item class: Drupal\entity_test\Plugin\Field\FieldType\SerializedPropertyItem).');
|
||||
$this->expectException(\LogicException::class);
|
||||
$this->expectExceptionMessage('The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized_text" field (field item class: Drupal\entity_test\Plugin\Field\FieldType\SerializedPropertyItem).');
|
||||
$this->serializer->denormalize([
|
||||
'serialized_text' => [
|
||||
[
|
||||
|
|
@ -301,7 +303,8 @@ class EntitySerializationTest extends NormalizerTestBase {
|
|||
$entity = EntitySerializedField::create(['serialized_long' => serialize(['Hello world!'])]);
|
||||
$normalized = $this->serializer->normalize($entity);
|
||||
$this->assertEquals($normalized['serialized_long'][0]['value'], ['Hello world!']);
|
||||
$this->setExpectedException(\LogicException::class, 'The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized_long" field (field item class: Drupal\Core\Field\Plugin\Field\FieldType\StringLongItem).');
|
||||
$this->expectException(\LogicException::class);
|
||||
$this->expectExceptionMessage('The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized_long" field (field item class: Drupal\Core\Field\Plugin\Field\FieldType\StringLongItem).');
|
||||
$this->serializer->denormalize([
|
||||
'serialized_long' => [
|
||||
[
|
||||
|
|
@ -342,7 +345,8 @@ class EntitySerializationTest extends NormalizerTestBase {
|
|||
* Tests normalizing/denormalizing using string values.
|
||||
*/
|
||||
public function testDenormalizeStringValue() {
|
||||
$this->setExpectedException(\LogicException::class, 'The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized_long" field (field item class: Drupal\Core\Field\Plugin\Field\FieldType\StringLongItem).');
|
||||
$this->expectException(\LogicException::class);
|
||||
$this->expectExceptionMessage('The generic FieldItemNormalizer cannot denormalize string values for "value" properties of the "serialized_long" field (field item class: Drupal\Core\Field\Plugin\Field\FieldType\StringLongItem).');
|
||||
$this->serializer->denormalize([
|
||||
'serialized_long' => ['boo'],
|
||||
'type' => 'entity_test_serialized_field',
|
||||
|
|
|
|||
|
|
@ -138,7 +138,8 @@ class FieldItemSerializationTest extends NormalizerTestBase {
|
|||
* Tests denormalizing using a scalar field value.
|
||||
*/
|
||||
public function testFieldDenormalizeWithScalarValue() {
|
||||
$this->setExpectedException(UnexpectedValueException::class, 'Field values for "uuid" must use an array structure');
|
||||
$this->expectException(UnexpectedValueException::class);
|
||||
$this->expectExceptionMessage('Field values for "uuid" must use an array structure');
|
||||
|
||||
$normalized = $this->serializer->normalize($this->entity, 'json');
|
||||
|
||||
|
|
|
|||
|
|
@ -231,7 +231,8 @@ class DateTimeIso8601NormalizerTest extends UnitTestCase {
|
|||
* @covers ::denormalize
|
||||
*/
|
||||
public function testDenormalizeDateOnlyException() {
|
||||
$this->setExpectedException(UnexpectedValueException::class, 'The specified date "2016/11/06" is not in an accepted format: "Y-m-d" (date-only).');
|
||||
$this->expectException(UnexpectedValueException::class);
|
||||
$this->expectExceptionMessage('The specified date "2016/11/06" is not in an accepted format: "Y-m-d" (date-only).');
|
||||
|
||||
$normalized = '2016/11/06';
|
||||
|
||||
|
|
@ -246,7 +247,8 @@ class DateTimeIso8601NormalizerTest extends UnitTestCase {
|
|||
* @covers ::denormalize
|
||||
*/
|
||||
public function testDenormalizeDateAndTimeException() {
|
||||
$this->setExpectedException(UnexpectedValueException::class, 'The specified date "on a rainy day" is not in an accepted format: "Y-m-d\TH:i:sP" (RFC 3339), "Y-m-d\TH:i:sO" (ISO 8601), "Y-m-d\TH:i:s" (backward compatibility — deprecated).');
|
||||
$this->expectException(UnexpectedValueException::class);
|
||||
$this->expectExceptionMessage('The specified date "on a rainy day" is not in an accepted format: "Y-m-d\TH:i:sP" (RFC 3339), "Y-m-d\TH:i:sO" (ISO 8601), "Y-m-d\TH:i:s" (backward compatibility — deprecated).');
|
||||
|
||||
$normalized = 'on a rainy day';
|
||||
|
||||
|
|
@ -261,7 +263,8 @@ class DateTimeIso8601NormalizerTest extends UnitTestCase {
|
|||
* @covers ::denormalize
|
||||
*/
|
||||
public function testDenormalizeNoTargetInstanceOrFieldDefinitionException() {
|
||||
$this->setExpectedException(InvalidArgumentException::class, '$context[\'target_instance\'] or $context[\'field_definition\'] must be set to denormalize with the DateTimeIso8601Normalizer');
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('$context[\'target_instance\'] or $context[\'field_definition\'] must be set to denormalize with the DateTimeIso8601Normalizer');
|
||||
$this->normalizer->denormalize('', DateTimeIso8601::class, NULL, []);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,8 @@ class DateTimeNormalizerTest extends UnitTestCase {
|
|||
* @covers ::denormalize
|
||||
*/
|
||||
public function testDenormalizeException() {
|
||||
$this->setExpectedException(UnexpectedValueException::class, 'The specified date "2016/11/06 09:02am GMT" is not in an accepted format: "Y-m-d\TH:i:sP" (RFC 3339), "Y-m-d\TH:i:sO" (ISO 8601).');
|
||||
$this->expectException(UnexpectedValueException::class);
|
||||
$this->expectExceptionMessage('The specified date "2016/11/06 09:02am GMT" is not in an accepted format: "Y-m-d\TH:i:sP" (RFC 3339), "Y-m-d\TH:i:sO" (ISO 8601).');
|
||||
|
||||
$normalized = '2016/11/06 09:02am GMT';
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ class EntityNormalizerTest extends UnitTestCase {
|
|||
* @covers ::denormalize
|
||||
*/
|
||||
public function testDenormalizeWithNoEntityType() {
|
||||
$this->setExpectedException(UnexpectedValueException::class);
|
||||
$this->expectException(UnexpectedValueException::class);
|
||||
$this->entityNormalizer->denormalize([], 'Drupal\Core\Entity\ContentEntityBase');
|
||||
}
|
||||
|
||||
|
|
@ -310,7 +310,7 @@ class EntityNormalizerTest extends UnitTestCase {
|
|||
->with('test_bundle')
|
||||
->will($this->returnValue($entity_type_storage));
|
||||
|
||||
$this->setExpectedException(UnexpectedValueException::class);
|
||||
$this->expectException(UnexpectedValueException::class);
|
||||
$this->entityNormalizer->denormalize($test_data, 'Drupal\Core\Entity\ContentEntityBase', NULL, ['entity_type' => 'test']);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -349,7 +349,8 @@ class EntityReferenceFieldItemNormalizerTest extends UnitTestCase {
|
|||
* @covers ::denormalize
|
||||
*/
|
||||
public function testDenormalizeWithUuidWithIncorrectType() {
|
||||
$this->setExpectedException(UnexpectedValueException::class, 'The field "field_reference" property "target_type" must be set to "test_type" or omitted.');
|
||||
$this->expectException(UnexpectedValueException::class);
|
||||
$this->expectExceptionMessage('The field "field_reference" property "target_type" must be set to "test_type" or omitted.');
|
||||
|
||||
$data = [
|
||||
'target_id' => 'test',
|
||||
|
|
@ -369,7 +370,8 @@ class EntityReferenceFieldItemNormalizerTest extends UnitTestCase {
|
|||
* @covers ::denormalize
|
||||
*/
|
||||
public function testDenormalizeWithTypeWithIncorrectUuid() {
|
||||
$this->setExpectedException(InvalidArgumentException::class, 'No "test_type" entity found with UUID "unique-but-none-non-existent" for field "field_reference"');
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('No "test_type" entity found with UUID "unique-but-none-non-existent" for field "field_reference"');
|
||||
|
||||
$data = [
|
||||
'target_id' => 'test',
|
||||
|
|
@ -392,7 +394,8 @@ class EntityReferenceFieldItemNormalizerTest extends UnitTestCase {
|
|||
* @covers ::denormalize
|
||||
*/
|
||||
public function testDenormalizeWithEmtpyUuid() {
|
||||
$this->setExpectedException(InvalidArgumentException::class, 'If provided "target_uuid" cannot be empty for field "test_type".');
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('If provided "target_uuid" cannot be empty for field "test_type".');
|
||||
|
||||
$data = [
|
||||
'target_id' => 'test',
|
||||
|
|
|
|||
|
|
@ -122,7 +122,8 @@ class TimestampNormalizerTest extends UnitTestCase {
|
|||
* @covers ::denormalize
|
||||
*/
|
||||
public function testDenormalizeException() {
|
||||
$this->setExpectedException(UnexpectedValueException::class, 'The specified date "2016/11/06 09:02am GMT" is not in an accepted format: "U" (UNIX timestamp), "Y-m-d\TH:i:sO" (ISO 8601), "Y-m-d\TH:i:sP" (RFC 3339).');
|
||||
$this->expectException(UnexpectedValueException::class);
|
||||
$this->expectExceptionMessage('The specified date "2016/11/06 09:02am GMT" is not in an accepted format: "U" (UNIX timestamp), "Y-m-d\TH:i:sO" (ISO 8601), "Y-m-d\TH:i:sP" (RFC 3339).');
|
||||
|
||||
$normalized = '2016/11/06 09:02am GMT';
|
||||
|
||||
|
|
|
|||
|
|
@ -279,7 +279,8 @@ class TestDiscoveryTest extends UnitTestCase {
|
|||
* Bulk delete storages and fields, and clean up afterwards.
|
||||
*/
|
||||
EOT;
|
||||
$this->setExpectedException(MissingGroupException::class, 'Missing @group annotation in Drupal\KernelTests\field\BulkDeleteTest');
|
||||
$this->expectException(MissingGroupException::class);
|
||||
$this->expectExceptionMessage('Missing @group annotation in Drupal\KernelTests\field\BulkDeleteTest');
|
||||
TestDiscovery::getTestInfo($classname, $doc_comment);
|
||||
}
|
||||
|
||||
|
|
@ -530,7 +531,7 @@ EOF;
|
|||
// We want to make sure it didn't do that, because we already did some
|
||||
// analysis and already have an empty docblock. getTestInfo() will throw
|
||||
// MissingGroupException because the annotation is empty.
|
||||
$this->setExpectedException(MissingGroupException::class);
|
||||
$this->expectException(MissingGroupException::class);
|
||||
TestDiscovery::getTestInfo('Drupal\Tests\simpletest\ThisTestDoesNotExistTest', '');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -222,7 +222,8 @@ class ModuleHandlerTest extends KernelTestBase {
|
|||
$this->assertNotContains($profile, $uninstalled_modules, 'The installation profile is not in the list of uninstalled modules.');
|
||||
|
||||
// Try uninstalling the required module.
|
||||
$this->setExpectedException(ModuleUninstallValidatorException::class, 'The following reasons prevent the modules from being uninstalled: The Testing install profile dependencies module is required');
|
||||
$this->expectException(ModuleUninstallValidatorException::class);
|
||||
$this->expectExceptionMessage('The following reasons prevent the modules from being uninstalled: The Testing install profile dependencies module is required');
|
||||
$this->moduleInstaller()->uninstall([$dependency]);
|
||||
}
|
||||
|
||||
|
|
@ -253,7 +254,8 @@ class ModuleHandlerTest extends KernelTestBase {
|
|||
}
|
||||
|
||||
// Try uninstalling the dependencies.
|
||||
$this->setExpectedException(ModuleUninstallValidatorException::class, 'The following reasons prevent the modules from being uninstalled: The Testing install profile all dependencies module is required');
|
||||
$this->expectException(ModuleUninstallValidatorException::class);
|
||||
$this->expectExceptionMessage('The following reasons prevent the modules from being uninstalled: The Testing install profile all dependencies module is required');
|
||||
$this->moduleInstaller()->uninstall($dependencies);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class DbCommandBaseTest extends KernelTestBase {
|
|||
$command_tester->execute([
|
||||
'--database' => 'dne',
|
||||
]);
|
||||
$this->setExpectedException(ConnectionNotDefinedException::class);
|
||||
$this->expectException(ConnectionNotDefinedException::class);
|
||||
$command->getDatabaseConnection($command_tester->getInput());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -103,7 +103,8 @@ class MachineNameControllerTest extends UnitTestCase {
|
|||
public function testMachineNameControllerWithInvalidReplacePattern() {
|
||||
$request = Request::create('', 'GET', ['text' => 'Bob', 'langcode' => 'en', 'replace' => 'Alice', 'replace_pattern' => 'Bob', 'replace_token' => 'invalid']);
|
||||
|
||||
$this->setExpectedException(AccessDeniedHttpException::class, "Invalid 'replace_token' query parameter.");
|
||||
$this->expectException(AccessDeniedHttpException::class);
|
||||
$this->expectExceptionMessage("Invalid 'replace_token' query parameter.");
|
||||
$this->machineNameController->transliterate($request);
|
||||
}
|
||||
|
||||
|
|
@ -113,7 +114,8 @@ class MachineNameControllerTest extends UnitTestCase {
|
|||
public function testMachineNameControllerWithMissingToken() {
|
||||
$request = Request::create('', 'GET', ['text' => 'Bob', 'langcode' => 'en', 'replace' => 'Alice', 'replace_pattern' => 'Bob']);
|
||||
|
||||
$this->setExpectedException(AccessDeniedHttpException::class, "Missing 'replace_token' query parameter.");
|
||||
$this->expectException(AccessDeniedHttpException::class);
|
||||
$this->expectExceptionMessage("Missing 'replace_token' query parameter.");
|
||||
$this->machineNameController->transliterate($request);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ class ProfileFieldCheckRequirementsTest extends MigrateDrupal6TestBase {
|
|||
* Tests exception in thrown when profile_fields tables does not exist.
|
||||
*/
|
||||
public function testCheckRequirements() {
|
||||
$this->setExpectedException(RequirementsException::class, 'Profile module not enabled on source site');
|
||||
$this->expectException(RequirementsException::class);
|
||||
$this->expectExceptionMessage('Profile module not enabled on source site');
|
||||
$this->getMigration('user_profile_field')
|
||||
->getSourcePlugin()
|
||||
->checkRequirements();
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ class ProfileFieldCheckRequirementsTest extends MigrateDrupal7TestBase {
|
|||
* Tests exception in thrown when profile_fields tables does not exist.
|
||||
*/
|
||||
public function testCheckRequirements() {
|
||||
$this->setExpectedException(RequirementsException::class, 'Profile module not enabled on source site');
|
||||
$this->expectException(RequirementsException::class);
|
||||
$this->expectExceptionMessage('Profile module not enabled on source site');
|
||||
$this->getMigration('user_profile_field')
|
||||
->getSourcePlugin()
|
||||
->checkRequirements();
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ class PrivateTempStoreTest extends UnitTestCase {
|
|||
$this->keyValue->expects($this->once())
|
||||
->method('getCollectionName');
|
||||
|
||||
$this->setExpectedException(TempStoreException::class);
|
||||
$this->expectException(TempStoreException::class);
|
||||
$this->tempStore->set('test', 'value');
|
||||
}
|
||||
|
||||
|
|
@ -250,7 +250,7 @@ class PrivateTempStoreTest extends UnitTestCase {
|
|||
$this->keyValue->expects($this->once())
|
||||
->method('getCollectionName');
|
||||
|
||||
$this->setExpectedException(TempStoreException::class);
|
||||
$this->expectException(TempStoreException::class);
|
||||
$this->tempStore->delete('test');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ class SharedTempStoreTest extends UnitTestCase {
|
|||
$this->keyValue->expects($this->once())
|
||||
->method('getCollectionName');
|
||||
|
||||
$this->setExpectedException(TempStoreException::class);
|
||||
$this->expectException(TempStoreException::class);
|
||||
$this->tempStore->set('test', 'value');
|
||||
}
|
||||
|
||||
|
|
@ -328,7 +328,7 @@ class SharedTempStoreTest extends UnitTestCase {
|
|||
$this->keyValue->expects($this->once())
|
||||
->method('getCollectionName');
|
||||
|
||||
$this->setExpectedException(TempStoreException::class);
|
||||
$this->expectException(TempStoreException::class);
|
||||
$this->tempStore->delete('test');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class UserRegistrationResourceTest extends UnitTestCase {
|
|||
* Tests that an exception is thrown when no data provided for the account.
|
||||
*/
|
||||
public function testEmptyPost() {
|
||||
$this->setExpectedException(BadRequestHttpException::class);
|
||||
$this->expectException(BadRequestHttpException::class);
|
||||
$this->testClass->post(NULL);
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ class UserRegistrationResourceTest extends UnitTestCase {
|
|||
public function testExistedEntityPost() {
|
||||
$entity = $this->prophesize(User::class);
|
||||
$entity->isNew()->willReturn(FALSE);
|
||||
$this->setExpectedException(BadRequestHttpException::class);
|
||||
$this->expectException(BadRequestHttpException::class);
|
||||
|
||||
$this->testClass->post($entity->reveal());
|
||||
}
|
||||
|
|
@ -106,7 +106,7 @@ class UserRegistrationResourceTest extends UnitTestCase {
|
|||
$entity = $this->prophesize(User::class);
|
||||
$entity->isNew()->willReturn(TRUE);
|
||||
|
||||
$this->setExpectedException(AccessDeniedHttpException::class);
|
||||
$this->expectException(AccessDeniedHttpException::class);
|
||||
|
||||
$this->testClass->post($entity->reveal());
|
||||
}
|
||||
|
|
@ -122,7 +122,7 @@ class UserRegistrationResourceTest extends UnitTestCase {
|
|||
$entity = $this->prophesize(User::class);
|
||||
$entity->isNew()->willReturn(TRUE);
|
||||
|
||||
$this->setExpectedException(AccessDeniedHttpException::class);
|
||||
$this->expectException(AccessDeniedHttpException::class);
|
||||
|
||||
$this->testClass->post($entity->reveal());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ class ViewAjaxControllerTest extends UnitTestCase {
|
|||
*/
|
||||
public function testMissingViewName() {
|
||||
$request = new Request();
|
||||
$this->setExpectedException(NotFoundHttpException::class);
|
||||
$this->expectException(NotFoundHttpException::class);
|
||||
$this->viewAjaxController->ajaxView($request);
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ class ViewAjaxControllerTest extends UnitTestCase {
|
|||
->with('test_view')
|
||||
->will($this->returnValue(FALSE));
|
||||
|
||||
$this->setExpectedException(NotFoundHttpException::class);
|
||||
$this->expectException(NotFoundHttpException::class);
|
||||
$this->viewAjaxController->ajaxView($request);
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ class ViewAjaxControllerTest extends UnitTestCase {
|
|||
->with($view)
|
||||
->will($this->returnValue($executable));
|
||||
|
||||
$this->setExpectedException(AccessDeniedHttpException::class);
|
||||
$this->expectException(AccessDeniedHttpException::class);
|
||||
$this->viewAjaxController->ajaxView($request);
|
||||
}
|
||||
|
||||
|
|
@ -215,7 +215,7 @@ class ViewAjaxControllerTest extends UnitTestCase {
|
|||
|
||||
$this->setupValidMocks(static::USE_NO_AJAX);
|
||||
|
||||
$this->setExpectedException(AccessDeniedHttpException::class);
|
||||
$this->expectException(AccessDeniedHttpException::class);
|
||||
$this->viewAjaxController->ajaxView($request);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class PageTest extends UnitTestCase {
|
|||
* @covers ::buildBasicRenderable
|
||||
*/
|
||||
public function testBuildBasicRenderableWithMissingRoute() {
|
||||
$this->setExpectedException(\BadFunctionCallException::class);
|
||||
$this->expectException(\BadFunctionCallException::class);
|
||||
Page::buildBasicRenderable('test_view', 'page_1', []);
|
||||
}
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue