You are here

public function ConstraintsTest::embedCodeProvider in Media entity Twitter 8

Provides test data for testTweetEmbedCodeConstraint().

File

tests/src/Unit/ConstraintsTest.php, line 75

Class

ConstraintsTest
Tests media_entity_twitter constraints.

Namespace

Drupal\Tests\media_entity_twitter\Unit

Code

public function embedCodeProvider() {
  return [
    'valid tweet URL' => [
      'https://twitter.com/drupal8changes/status/649167396230578176',
      0,
    ],
    'valid tweet embed code' => [
      '<blockquote class="twitter-tweet" lang="en"><p lang="en" dir="ltr">EntityChangedInterface now also defines the function setChangedTime <a href="http://t.co/1Q58UcR8OY">http://t.co/1Q58UcR8OY</a></p>&mdash; Drupal 8 Changes (@drupal8changes) <a href="https://twitter.com/drupal8changes/status/649167396230578176">September 30, 2015</a></blockquote><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>',
      0,
    ],
    'invalid URL' => [
      'https://drupal.org/project/media_entity_twitter',
      1,
    ],
    'invalid text' => [
      'I want my Tweet!',
      1,
    ],
    'invalid tweet URL' => [
      'https://twitter.com/drupal8changes/statustypo/649167396230578176',
      1,
    ],
    'invalid tweet ID' => [
      'https://twitter.com/drupal8changes/status/aa64916739bb6230578176',
      1,
    ],
  ];
}