You are here

function SoundCloudWidgetValidationTest::testSoundCloudUrlValid in SoundCloud field 8

Test an a valid SoundCloud URL

File

src/Tests/SoundCloudWidgetValidationTest.php, line 55

Class

SoundCloudWidgetValidationTest
Test case for custom time field

Namespace

Drupal\soundcloudfield\Tests

Code

function testSoundCloudUrlValid() {
  $field = $this
    ->getField();

  // Display creation form.
  $this
    ->drupalGet('entity_test/add');
  $this
    ->assertFieldByName("{$this->fieldName}[0][url]", '', 'SoundCloud URL');
  $this
    ->assertRaw('value=""');

  // Create a path alias.
  \Drupal::service('path.alias_storage')
    ->save('/admin', '/a/path/alias');

  // Create a node to test the link widget.
  $node = $this
    ->drupalCreateNode();
  $validEntries = [
    'https://soundcloud.com/dioxidmusic/soncha-gona-the-ground-20-tribute-to-the-100',
  ];
  $this
    ->assertValidEntries($validEntries);
}