|
| 1 | +<?php |
| 2 | +class BasicTest extends PHPUnit_Framework_TestCase { |
| 3 | + |
| 4 | + public function setUp() { |
| 5 | + } |
| 6 | + |
| 7 | + private function _testEquals($expected, $headers) { |
| 8 | + $result = IndieWeb\http_rels($headers); |
| 9 | + $this->assertEquals($expected, $result); |
| 10 | + } |
| 11 | + |
| 12 | + public function testInvalidStartDate() { |
| 13 | + $this->_testEquals(array( |
| 14 | + 'rels' => array( |
| 15 | + 'd' => array('http://example.org/query?a=b,c'), |
| 16 | + 'e' => array('http://example.org/query?a=b,c'), |
| 17 | + 'f' => array('http://example.org/'), |
| 18 | + ) |
| 19 | + ), "Link: <http://example.org/query?a=b,c>; rel=\"d e\", <http://example.org/>; rel=f"); |
| 20 | + } |
| 21 | + |
| 22 | + public function testAaronParecki() { |
| 23 | + $this->_testEquals(array( |
| 24 | + 'rels' => array( |
| 25 | + 'http://webmention.org/' => array('http://aaronparecki.com/webmention.php'), |
| 26 | + 'indieauth' => array('https://indieauth.com'), |
| 27 | + ) |
| 28 | + ), "HTTP/1.1 200 OK |
| 29 | +Server: nginx/1.0.14 |
| 30 | +Date: Sat, 26 Oct 2013 01:40:11 GMT |
| 31 | +Content-Type: text/html; charset=UTF-8 |
| 32 | +Connection: keep-alive |
| 33 | +Link: <https://indieauth.com>; rel=\"indieauth\" |
| 34 | +X-Pingback: http://pingback.me/webmention?forward=http%3A%2F%2Faaronparecki.com%2Fwebmention.php |
| 35 | +Link: <http://aaronparecki.com/webmention.php>; rel=\"http://webmention.org/\""); |
| 36 | + } |
| 37 | + |
| 38 | + public function testBarryFrost() { |
| 39 | + $this->_testEquals(array( |
| 40 | + 'rels' => array( |
| 41 | + 'webmention' => array('http://aaronparecki.com/webmention.php'), |
| 42 | + ) |
| 43 | + ), "HTTP/1.1 200 OK |
| 44 | +Cache-Control: max-age=0, private, must-revalidate |
| 45 | +Content-length: 19600 |
| 46 | +Content-Type: text/html; charset=utf-8 |
| 47 | +Date: Sat, 26 Oct 2013 01:49:21 GMT |
| 48 | +Link: <http://barryfrost.com/webmention>; rel=\"webmention\""); |
| 49 | + } |
| 50 | + |
| 51 | + |
| 52 | +} |
0 commit comments