You are here

public function LinkTypeFieldEntryTest::doBadEditFlagField in Flag 8.4

Assert editing an invalid flagging throws an exception.

1 call to LinkTypeFieldEntryTest::doBadEditFlagField()
LinkTypeFieldEntryTest::testCreateFieldEntryFlag in tests/src/Functional/LinkTypeFieldEntryTest.php
Create a new flag with the Field Entry type, and add fields.

File

tests/src/Functional/LinkTypeFieldEntryTest.php, line 186

Class

LinkTypeFieldEntryTest
Test the Field Entry link type.

Namespace

Drupal\Tests\flag\Functional

Code

public function doBadEditFlagField() {
  $flag_id = $this->flag
    ->id();

  // Test a good flag ID param, but a bad flaggable ID param.
  $this
    ->drupalGet('flag/details/edit/' . $flag_id . '/-9999');
  $this
    ->assertResponse('404', 'Editing an invalid flagging path: good flag, bad entity.');

  // Test a bad flag ID param, but a good flaggable ID param.
  $this
    ->drupalGet('flag/details/edit/jibberish/' . $this->nodeId);
  $this
    ->assertResponse('404', 'Editing an invalid flagging path: bad flag, good entity');

  // Test editing a unflagged entity.
  $unlinked_node = $this
    ->drupalCreateNode([
    'type' => $this->nodeType,
  ]);
  $this
    ->drupalGet('flag/details/edit/' . $flag_id . '/' . $unlinked_node
    ->id());
  $this
    ->assertResponse('404', 'Editing an invalid flagging path: good flag, good entity, but not flagged');
}