Code Duplication    Length = 8-9 lines in 3 locations

tests/Drupal/Tests/Driver/Kernel/Drupal8/Entity/DriverEntityWithBundleTest.php 2 locations

@@ 131-138 (lines=8) @@
128
  /**
129
   * Test setting a nonexistent bundle.
130
   */
131
    public function testSetNonexistentBundle()
132
    {
133
        $entity = new DriverEntityDrupal8(
134
            $this->entityType
135
        );
136
        $this->setExpectedException(\Exception::class, "'nonexistent_bundle' could not be identified as a bundle of the '" . $this->entityType);
137
        $entity->setBundle('nonexistent_bundle');
138
    }
139
140
  /**
141
   * Test setting a non existent bundle as a field.
@@ 143-151 (lines=9) @@
140
  /**
141
   * Test setting a non existent bundle as a field.
142
   */
143
    public function testSetNonExistentBundleByField()
144
    {
145
        $entity = new DriverEntityDrupal8(
146
            $this->entityType
147
        );
148
149
        $this->setExpectedException(\Exception::class, "No entity of type 'entity_test_bundle' has id or label matching");
150
        $entity->set('type', ['nonexistent bundle']);
151
    }
152
153
  /**
154
   * Test modifying an already set the bundle.

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

@@ 81-89 (lines=9) @@
78
  /**
79
   * Test that an exception is thrown if config property is missing.
80
   */
81
    public function testMissingConfigProperty()
82
    {
83
        $name = $this->randomString();
84
        $entity = new DriverEntityDrupal8(
85
            $this->entityType
86
        );
87
        $this->setExpectedException(\Exception::class, "Field or property cannot be identified");
88
        $entity->set('nonexistentproperty', $name);
89
    }
90
}
91