Loading core/modules/field/tests/src/Kernel/FieldCrudTest.php +4 −4 Changes for core/modules/field/tests/src/Kernel/FieldCrudTest.php: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -100,20 +100,20 @@ public function testCreateField() { // Guarantee that the field/bundle combination is unique. try { FieldConfig::create($this->fieldDefinition)->save(); $this->fail(t('Cannot create two fields with the same field / bundle combination.')); $this->fail('Cannot create two fields with the same field / bundle combination.'); } catch (EntityStorageException $e) { $this->pass(t('Cannot create two fields with the same field / bundle combination.')); $this->pass('Cannot create two fields with the same field / bundle combination.'); } // Check that the specified field exists. try { $this->fieldDefinition['field_name'] = $this->randomMachineName(); FieldConfig::create($this->fieldDefinition)->save(); $this->fail(t('Cannot create a field with a non-existing storage.')); $this->fail('Cannot create a field with a non-existing storage.'); } catch (FieldException $e) { $this->pass(t('Cannot create a field with a non-existing storage.')); $this->pass('Cannot create a field with a non-existing storage.'); } // TODO: test other failures. Loading core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php +20 −20 Changes for core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php: 20 added lines, 20 removed lines. Original line number Diff line number Diff line Loading @@ -78,10 +78,10 @@ public function testCreate() { // Guarantee that the name is unique. try { FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create two fields with the same name.')); $this->fail('Cannot create two fields with the same name.'); } catch (EntityStorageException $e) { $this->pass(t('Cannot create two fields with the same name.')); $this->pass('Cannot create two fields with the same name.'); } // Check that field type is required. Loading @@ -91,10 +91,10 @@ public function testCreate() { 'entity_type' => 'entity_type', ]; FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create a field with no type.')); $this->fail('Cannot create a field with no type.'); } catch (FieldException $e) { $this->pass(t('Cannot create a field with no type.')); $this->pass('Cannot create a field with no type.'); } // Check that field name is required. Loading @@ -104,10 +104,10 @@ public function testCreate() { 'entity_type' => 'entity_test', ]; FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create an unnamed field.')); $this->fail('Cannot create an unnamed field.'); } catch (FieldException $e) { $this->pass(t('Cannot create an unnamed field.')); $this->pass('Cannot create an unnamed field.'); } // Check that entity type is required. try { Loading @@ -130,10 +130,10 @@ public function testCreate() { 'type' => 'test_field', ]; FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create a field with a name starting with a digit.')); $this->fail('Cannot create a field with a name starting with a digit.'); } catch (FieldException $e) { $this->pass(t('Cannot create a field with a name starting with a digit.')); $this->pass('Cannot create a field with a name starting with a digit.'); } // Check that field name must only contain lowercase alphanumeric or _. Loading @@ -144,10 +144,10 @@ public function testCreate() { 'type' => 'test_field', ]; FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create a field with a name containing an illegal character.')); $this->fail('Cannot create a field with a name containing an illegal character.'); } catch (FieldException $e) { $this->pass(t('Cannot create a field with a name containing an illegal character.')); $this->pass('Cannot create a field with a name containing an illegal character.'); } // Check that field name cannot be longer than 32 characters long. Loading @@ -158,10 +158,10 @@ public function testCreate() { 'type' => 'test_field', ]; FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create a field with a name longer than 32 characters.')); $this->fail('Cannot create a field with a name longer than 32 characters.'); } catch (FieldException $e) { $this->pass(t('Cannot create a field with a name longer than 32 characters.')); $this->pass('Cannot create a field with a name longer than 32 characters.'); } // Check that field name can not be an entity key. Loading @@ -173,10 +173,10 @@ public function testCreate() { 'entity_type' => 'entity_test', ]; FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create a field bearing the name of an entity key.')); $this->fail('Cannot create a field bearing the name of an entity key.'); } catch (FieldException $e) { $this->pass(t('Cannot create a field bearing the name of an entity key.')); $this->pass('Cannot create a field bearing the name of an entity key.'); } } Loading Loading @@ -376,10 +376,10 @@ public function testUpdateFieldType() { try { $field_storage->set('type', 'integer'); $field_storage->save(); $this->fail(t('Cannot update a field to a different type.')); $this->fail('Cannot update a field to a different type.'); } catch (FieldException $e) { $this->pass(t('Cannot update a field to a different type.')); $this->pass('Cannot update a field to a different type.'); } } Loading Loading @@ -442,18 +442,18 @@ public function testUpdateForbid() { $field_storage->setSetting('changeable', $field_storage->getSetting('changeable') + 1); try { $field_storage->save(); $this->pass(t("A changeable setting can be updated.")); $this->pass('A changeable setting can be updated.'); } catch (FieldStorageDefinitionUpdateForbiddenException $e) { $this->fail(t("An unchangeable setting cannot be updated.")); $this->fail('An unchangeable setting cannot be updated.'); } $field_storage->setSetting('unchangeable', $field_storage->getSetting('unchangeable') + 1); try { $field_storage->save(); $this->fail(t("An unchangeable setting can be updated.")); $this->fail('An unchangeable setting can be updated.'); } catch (FieldStorageDefinitionUpdateForbiddenException $e) { $this->pass(t("An unchangeable setting cannot be updated.")); $this->pass('An unchangeable setting cannot be updated.'); } } Loading core/modules/node/tests/src/Functional/NodeCreationTest.php +2 −2 Changes for core/modules/node/tests/src/Functional/NodeCreationTest.php: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -97,10 +97,10 @@ public function testFailedPageCreation() { // An exception is generated by node_test_exception_node_insert() if the // title is 'testing_transaction_exception'. Node::create($edit)->save(); $this->fail(t('Expected exception has not been thrown.')); $this->fail('Expected exception has not been thrown.'); } catch (\Exception $e) { $this->pass(t('Expected exception has been thrown.')); $this->pass('Expected exception has been thrown.'); } if (Database::getConnection()->supportsTransactions()) { Loading core/modules/node/tests/src/Functional/NodeQueryAlterTest.php +5 −5 Changes for core/modules/node/tests/src/Functional/NodeQueryAlterTest.php: 5 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ public function testNodeQueryAlterLowLevelWithAccess() { $this->assertEqual(count($result), 4, 'User with access can see correct nodes'); } catch (\Exception $e) { $this->fail(t('Altered query is malformed')); $this->fail('Altered query is malformed'); } } Loading Loading @@ -106,7 +106,7 @@ public function testNodeQueryAlterLowLevelNoAccess() { $this->assertEqual(count($result), 0, 'User with no access cannot see nodes'); } catch (\Exception $e) { $this->fail(t('Altered query is malformed')); $this->fail('Altered query is malformed'); } } Loading @@ -131,7 +131,7 @@ public function testNodeQueryAlterLowLevelEditAccess() { catch (\Exception $e) { $this->fail($e->getMessage()); $this->fail((string) $query); $this->fail(t('Altered query is malformed')); $this->fail('Altered query is malformed'); } } Loading Loading @@ -170,7 +170,7 @@ public function testNodeQueryAlterOverride() { $this->assertEqual(count($result), 0, 'User view privileges are not overridden'); } catch (\Exception $e) { $this->fail(t('Altered query is malformed')); $this->fail('Altered query is malformed'); } // Have node_test_node_grants return a node_access_all privilege, Loading @@ -192,7 +192,7 @@ public function testNodeQueryAlterOverride() { $this->assertEqual(count($result), 4, 'User view privileges are overridden'); } catch (\Exception $e) { $this->fail(t('Altered query is malformed')); $this->fail('Altered query is malformed'); } \Drupal::state()->delete('node_access_test.no_access_uid'); } Loading core/modules/options/tests/src/Kernel/OptionsFieldTest.php +2 −2 Changes for core/modules/options/tests/src/Kernel/OptionsFieldTest.php: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -40,10 +40,10 @@ public function testUpdateAllowedValues() { $this->fieldStorage->setSetting('allowed_values', [2 => 'Two']); try { $this->fieldStorage->save(); $this->fail(t('Cannot update a list field storage to not include keys with existing data.')); $this->fail('Cannot update a list field storage to not include keys with existing data.'); } catch (FieldStorageDefinitionUpdateForbiddenException $e) { $this->pass(t('Cannot update a list field storage to not include keys with existing data.')); $this->pass('Cannot update a list field storage to not include keys with existing data.'); } // Empty the value, so that we can actually remove the option. unset($entity->{$this->fieldName}); Loading Loading
core/modules/field/tests/src/Kernel/FieldCrudTest.php +4 −4 Changes for core/modules/field/tests/src/Kernel/FieldCrudTest.php: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -100,20 +100,20 @@ public function testCreateField() { // Guarantee that the field/bundle combination is unique. try { FieldConfig::create($this->fieldDefinition)->save(); $this->fail(t('Cannot create two fields with the same field / bundle combination.')); $this->fail('Cannot create two fields with the same field / bundle combination.'); } catch (EntityStorageException $e) { $this->pass(t('Cannot create two fields with the same field / bundle combination.')); $this->pass('Cannot create two fields with the same field / bundle combination.'); } // Check that the specified field exists. try { $this->fieldDefinition['field_name'] = $this->randomMachineName(); FieldConfig::create($this->fieldDefinition)->save(); $this->fail(t('Cannot create a field with a non-existing storage.')); $this->fail('Cannot create a field with a non-existing storage.'); } catch (FieldException $e) { $this->pass(t('Cannot create a field with a non-existing storage.')); $this->pass('Cannot create a field with a non-existing storage.'); } // TODO: test other failures. Loading
core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php +20 −20 Changes for core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php: 20 added lines, 20 removed lines. Original line number Diff line number Diff line Loading @@ -78,10 +78,10 @@ public function testCreate() { // Guarantee that the name is unique. try { FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create two fields with the same name.')); $this->fail('Cannot create two fields with the same name.'); } catch (EntityStorageException $e) { $this->pass(t('Cannot create two fields with the same name.')); $this->pass('Cannot create two fields with the same name.'); } // Check that field type is required. Loading @@ -91,10 +91,10 @@ public function testCreate() { 'entity_type' => 'entity_type', ]; FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create a field with no type.')); $this->fail('Cannot create a field with no type.'); } catch (FieldException $e) { $this->pass(t('Cannot create a field with no type.')); $this->pass('Cannot create a field with no type.'); } // Check that field name is required. Loading @@ -104,10 +104,10 @@ public function testCreate() { 'entity_type' => 'entity_test', ]; FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create an unnamed field.')); $this->fail('Cannot create an unnamed field.'); } catch (FieldException $e) { $this->pass(t('Cannot create an unnamed field.')); $this->pass('Cannot create an unnamed field.'); } // Check that entity type is required. try { Loading @@ -130,10 +130,10 @@ public function testCreate() { 'type' => 'test_field', ]; FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create a field with a name starting with a digit.')); $this->fail('Cannot create a field with a name starting with a digit.'); } catch (FieldException $e) { $this->pass(t('Cannot create a field with a name starting with a digit.')); $this->pass('Cannot create a field with a name starting with a digit.'); } // Check that field name must only contain lowercase alphanumeric or _. Loading @@ -144,10 +144,10 @@ public function testCreate() { 'type' => 'test_field', ]; FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create a field with a name containing an illegal character.')); $this->fail('Cannot create a field with a name containing an illegal character.'); } catch (FieldException $e) { $this->pass(t('Cannot create a field with a name containing an illegal character.')); $this->pass('Cannot create a field with a name containing an illegal character.'); } // Check that field name cannot be longer than 32 characters long. Loading @@ -158,10 +158,10 @@ public function testCreate() { 'type' => 'test_field', ]; FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create a field with a name longer than 32 characters.')); $this->fail('Cannot create a field with a name longer than 32 characters.'); } catch (FieldException $e) { $this->pass(t('Cannot create a field with a name longer than 32 characters.')); $this->pass('Cannot create a field with a name longer than 32 characters.'); } // Check that field name can not be an entity key. Loading @@ -173,10 +173,10 @@ public function testCreate() { 'entity_type' => 'entity_test', ]; FieldStorageConfig::create($field_storage_definition)->save(); $this->fail(t('Cannot create a field bearing the name of an entity key.')); $this->fail('Cannot create a field bearing the name of an entity key.'); } catch (FieldException $e) { $this->pass(t('Cannot create a field bearing the name of an entity key.')); $this->pass('Cannot create a field bearing the name of an entity key.'); } } Loading Loading @@ -376,10 +376,10 @@ public function testUpdateFieldType() { try { $field_storage->set('type', 'integer'); $field_storage->save(); $this->fail(t('Cannot update a field to a different type.')); $this->fail('Cannot update a field to a different type.'); } catch (FieldException $e) { $this->pass(t('Cannot update a field to a different type.')); $this->pass('Cannot update a field to a different type.'); } } Loading Loading @@ -442,18 +442,18 @@ public function testUpdateForbid() { $field_storage->setSetting('changeable', $field_storage->getSetting('changeable') + 1); try { $field_storage->save(); $this->pass(t("A changeable setting can be updated.")); $this->pass('A changeable setting can be updated.'); } catch (FieldStorageDefinitionUpdateForbiddenException $e) { $this->fail(t("An unchangeable setting cannot be updated.")); $this->fail('An unchangeable setting cannot be updated.'); } $field_storage->setSetting('unchangeable', $field_storage->getSetting('unchangeable') + 1); try { $field_storage->save(); $this->fail(t("An unchangeable setting can be updated.")); $this->fail('An unchangeable setting can be updated.'); } catch (FieldStorageDefinitionUpdateForbiddenException $e) { $this->pass(t("An unchangeable setting cannot be updated.")); $this->pass('An unchangeable setting cannot be updated.'); } } Loading
core/modules/node/tests/src/Functional/NodeCreationTest.php +2 −2 Changes for core/modules/node/tests/src/Functional/NodeCreationTest.php: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -97,10 +97,10 @@ public function testFailedPageCreation() { // An exception is generated by node_test_exception_node_insert() if the // title is 'testing_transaction_exception'. Node::create($edit)->save(); $this->fail(t('Expected exception has not been thrown.')); $this->fail('Expected exception has not been thrown.'); } catch (\Exception $e) { $this->pass(t('Expected exception has been thrown.')); $this->pass('Expected exception has been thrown.'); } if (Database::getConnection()->supportsTransactions()) { Loading
core/modules/node/tests/src/Functional/NodeQueryAlterTest.php +5 −5 Changes for core/modules/node/tests/src/Functional/NodeQueryAlterTest.php: 5 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ public function testNodeQueryAlterLowLevelWithAccess() { $this->assertEqual(count($result), 4, 'User with access can see correct nodes'); } catch (\Exception $e) { $this->fail(t('Altered query is malformed')); $this->fail('Altered query is malformed'); } } Loading Loading @@ -106,7 +106,7 @@ public function testNodeQueryAlterLowLevelNoAccess() { $this->assertEqual(count($result), 0, 'User with no access cannot see nodes'); } catch (\Exception $e) { $this->fail(t('Altered query is malformed')); $this->fail('Altered query is malformed'); } } Loading @@ -131,7 +131,7 @@ public function testNodeQueryAlterLowLevelEditAccess() { catch (\Exception $e) { $this->fail($e->getMessage()); $this->fail((string) $query); $this->fail(t('Altered query is malformed')); $this->fail('Altered query is malformed'); } } Loading Loading @@ -170,7 +170,7 @@ public function testNodeQueryAlterOverride() { $this->assertEqual(count($result), 0, 'User view privileges are not overridden'); } catch (\Exception $e) { $this->fail(t('Altered query is malformed')); $this->fail('Altered query is malformed'); } // Have node_test_node_grants return a node_access_all privilege, Loading @@ -192,7 +192,7 @@ public function testNodeQueryAlterOverride() { $this->assertEqual(count($result), 4, 'User view privileges are overridden'); } catch (\Exception $e) { $this->fail(t('Altered query is malformed')); $this->fail('Altered query is malformed'); } \Drupal::state()->delete('node_access_test.no_access_uid'); } Loading
core/modules/options/tests/src/Kernel/OptionsFieldTest.php +2 −2 Changes for core/modules/options/tests/src/Kernel/OptionsFieldTest.php: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -40,10 +40,10 @@ public function testUpdateAllowedValues() { $this->fieldStorage->setSetting('allowed_values', [2 => 'Two']); try { $this->fieldStorage->save(); $this->fail(t('Cannot update a list field storage to not include keys with existing data.')); $this->fail('Cannot update a list field storage to not include keys with existing data.'); } catch (FieldStorageDefinitionUpdateForbiddenException $e) { $this->pass(t('Cannot update a list field storage to not include keys with existing data.')); $this->pass('Cannot update a list field storage to not include keys with existing data.'); } // Empty the value, so that we can actually remove the option. unset($entity->{$this->fieldName}); Loading