You are here

public function RemoteStreamWrapperWidgetTest::testBasicFunctionality in Remote stream wrapper widget 8

Tests the basic functionality of the Remote Stream Wrapper Widget.

File

tests/src/Functional/RemoteStreamWrapperWidgetTest.php, line 94

Class

RemoteStreamWrapperWidgetTest
Tests the Remote Stream Wrapper Widget.

Namespace

Drupal\Tests\remote_stream_wrapper_widget\Functional

Code

public function testBasicFunctionality() {
  $nodeTitle = $this
    ->randomString();
  $values = [
    'title[0][value]' => $nodeTitle,
    "{$this->fieldName}[0][url]" => 'http://example.com/test.txt',
  ];
  $this
    ->getSession()
    ->visit("/node/add/{$this->contentType->id()}");
  $this
    ->assertSame(200, $this
    ->getSession()
    ->getStatusCode());
  $this
    ->submitForm($values, 'Save');
  $this
    ->assertSame(200, $this
    ->getSession()
    ->getStatusCode());
  $this
    ->assertSession()
    ->pageTextContains($nodeTitle);
  $this
    ->assertSession()
    ->pageTextContains($this->fieldName);
  $this
    ->assertSession()
    ->pageTextContains('http://example.com/test.txt');
}