Code Duplication    Length = 20-22 lines in 2 locations

tests/Drupal/Tests/Driver/Kernel/Drupal8/Entity/ConfigurableLanguageTest.php 1 location

@@ 66-85 (lines=20) @@
63
  /**
64
   * Test that a language can be created and deleted.
65
   */
66
    public function testLanguageCreateDeleteByWrapper()
67
    {
68
        $langcode = $this->randomMachineName();
69
        $label = $this->randomMachineName();
70
        $entity = new DriverEntityDrupal8(
71
            $this->entityType
72
        );
73
        $entity->set('id', $langcode);
74
        $entity->set('label', $label);
75
        $entity->save();
76
77
        $language = ConfigurableLanguage::load($langcode);
78
        $this->assertNotNull($language);
79
        $this->assertEquals($langcode, $language->get('id'));
80
81
        // Check the language can be deleted.
82
        $entity->delete();
83
        $language = ConfigurableLanguage::load($langcode);
84
        $this->assertNull($language);
85
    }
86
87
    /**
88
     * Test that a default label is provided based on langcode.

tests/Drupal/Tests/Driver/Kernel/Drupal8/Entity/RoleTest.php 1 location

@@ 55-76 (lines=22) @@
52
  /**
53
   * Test that a role can be created and deleted.
54
   */
55
    public function testRoleCreateDeleteNew()
56
    {
57
        $name = $this->randomMachineName();
58
        $permissions = [
59
        'view the administration theme',
60
        ];
61
        $entity = new DriverEntityDrupal8(
62
            $this->entityType
63
        );
64
        $entity->set('id', $name);
65
        $entity->set('permissions', $permissions);
66
        $entity->save();
67
68
        $role = Role::load($name);
69
        $this->assertNotNull($role);
70
        $this->assertEquals($permissions, $role->getPermissions());
71
72
        // Check the role can be deleted.
73
        $entity->delete();
74
        $role = Role::load($name);
75
        $this->assertNull($role);
76
    }
77
78
  /**
79
   * Test that an exception is thrown if config property is missing.