You are here

public function RelationAPITest::testRelationDelete in Relation 8.2

Same name and namespace in other branches
  1. 8 src/Tests/RelationAPITest.php \Drupal\relation\Tests\RelationAPITest::testRelationDelete()

Tests relation delete.

File

src/Tests/RelationAPITest.php, line 281

Class

RelationAPITest
Test general API for Relation.

Namespace

Drupal\relation\Tests

Code

public function testRelationDelete() {

  // Invalid relations are deleted when any endpoint entity is deleted.
  // Octopus relation is valid with 3 endpoints, currently it has 4.
  $this->node1
    ->delete();
  $this
    ->assertTrue(Relation::load($this->relation_id_octopus), 'Relation is not deleted.');
  $this->node2
    ->delete();
  $this
    ->assertFalse(Relation::load($this->relation_id_octopus), 'Relation is deleted.');
}