You are here

public function HttpHelpersTest::httpResponses in Feeds 8.3

Data provider for testFindLinkHeader().

File

tests/src/Unit/Component/HttpHelpersTest.php, line 51

Class

HttpHelpersTest
@coversDefaultClass \Drupal\feeds\Component\HttpHelpers @group feeds

Namespace

Drupal\Tests\feeds\Unit\Component

Code

public function httpResponses() {
  $headers1 = [
    'Link' => '<http://example.com/TheBook/chapter2>;
         rel="previous";
         title="previous chapter"',
  ];
  $headers2 = [
    'Link' => [
      '<http://example.com/TheBook/chapter2>; rel="previous";
         title="previous chapter"',
    ],
  ];
  $headers3 = [
    'LINK' => '</>; rel="http://example.net/foo"',
  ];
  $headers4 = [
    'link' => '<http://example.com>; rel="hub self"',
  ];
  $headers5 = [
    'link' => '</TheBook/chapter2>;
         rel="previous"; title*=UTF-8\'de\'letztes%20Kapitel,
         </TheBook/chapter4>;
         rel="next"; title*=UTF-8\'de\'n%c3%a4chstes%20Kapitel',
  ];
  $headers6 = [
    'link' => '<http://example.com>; rel=hub',
  ];
  $headers7 = [
    'link' => '<http://example.com>; rel= hub ',
  ];
  return [
    [
      $headers1,
      'previous',
      'http://example.com/TheBook/chapter2',
    ],
    [
      $headers2,
      'previous',
      'http://example.com/TheBook/chapter2',
    ],
    [
      $headers3,
      'http://example.net/foo',
      '/',
    ],
    [
      $headers4,
      'hub',
      'http://example.com',
    ],
    [
      $headers4,
      'self',
      'http://example.com',
    ],
    [
      $headers5,
      'next',
      '/TheBook/chapter4',
    ],
    [
      $headers6,
      'hub',
      'http://example.com',
    ],
    [
      $headers7,
      'hub',
      'http://example.com',
    ],
    [
      $headers7,
      'self',
      FALSE,
    ],
    [
      [],
      'hub',
      FALSE,
    ],
    [
      [
        'link' => '',
      ],
      'hub',
      FALSE,
    ],
  ];
}