diff --git a/tests/RelMeTest.php b/tests/RelMeTest.php index 634c1e8..a745c88 100644 --- a/tests/RelMeTest.php +++ b/tests/RelMeTest.php @@ -2,24 +2,24 @@ namespace IndieWeb; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * RelMeTest * * @author barnabywalters */ -class RelMeTest extends PHPUnit_Framework_TestCase { +class RelMeTest extends TestCase { public function testUnparseUrl() { $this->assertEquals('http://example.com/', unparseUrl(parse_url('http://example.com'))); $this->assertEquals('http://example.com/?thing&more', unparseUrl(parse_url('http://example.com?thing&more'))); } - + public function testNormaliseUrl() { $this->assertEquals('http://example.com/', normaliseUrl('http://example.com')); $this->assertEquals('http://example.com/?thing=1', normaliseUrl('http://example.com?thing=1')); } - + public function testHttpParseHeaders() { $test = <<assertEquals($expected, $result); } - + /** @group network */ - /* There is already a test for this in indieweb/rel-me + /* There is already a test for this in indieweb/rel-me public function testFollowOneRedirect() { $this->assertEquals('https://brennannovak.com/', followOneRedirect('http://brennannovak.com')); }*/ - + public function testRelMeDocumentUrlHandlesNoRedirect() { $chain = mockFollowOneRedirect(array(null)); $meUrl = normaliseUrl('http://example.com'); @@ -52,17 +52,17 @@ public function testRelMeDocumentUrlHandlesNoRedirect() { $this->assertEquals($meUrl, $url); $this->assertTrue($isSecure); } - + public function testRelMeDocumentUrlHandlesSingleSecureHttpRedirect() { $finalUrl = normaliseUrl('http://example.org'); $chain = mockFollowOneRedirect(array($finalUrl)); $meUrl = normaliseUrl('http://example.com'); list($url, $isSecure, $previous) = relMeDocumentUrl($meUrl, $chain); $this->assertEquals($finalUrl, $url); - $this->assertTrue($isSecure); + $this->assertTrue($isSecure); $this->assertContains($finalUrl, $previous); } - + public function testRelMeDocumentUrlHandlesMultipleSecureHttpRedirects() { $finalUrl = normaliseUrl('http://example.org'); $intermediateUrl = normaliseUrl('http://www.example.org'); @@ -73,17 +73,17 @@ public function testRelMeDocumentUrlHandlesMultipleSecureHttpRedirects() { $this->assertTrue($isSecure); $this->assertContains($intermediateUrl, $previous); } - + public function testRelMeDocumentUrlHandlesSingleSecureHttpsRedirect() { $finalUrl = normaliseUrl('https://example.org'); $chain = mockFollowOneRedirect(array($finalUrl)); $meUrl = normaliseUrl('https://example.com'); list($url, $isSecure, $previous) = relMeDocumentUrl($meUrl, $chain); $this->assertEquals($finalUrl, $url); - $this->assertTrue($isSecure); + $this->assertTrue($isSecure); $this->assertContains($finalUrl, $previous); } - + public function testRelMeDocumentUrlHandlesMultipleSecureHttpsRedirects() { $finalUrl = normaliseUrl('https://example.org'); $intermediateUrl = normaliseUrl('https://www.example.org'); @@ -94,7 +94,7 @@ public function testRelMeDocumentUrlHandlesMultipleSecureHttpsRedirects() { $this->assertTrue($isSecure); $this->assertContains($intermediateUrl, $previous); } - + public function testRelMeDocumentUrlReportsInsecureRedirect() { $finalUrl = normaliseUrl('http://example.org'); $intermediateUrl = normaliseUrl('https://www.example.org'); @@ -104,7 +104,7 @@ public function testRelMeDocumentUrlReportsInsecureRedirect() { $this->assertFalse($isSecure); $this->assertContains($intermediateUrl, $previous); } - + public function testRelMeLinksFindsLinks() { $relMeLinks = relMeLinks(<< @@ -113,9 +113,9 @@ public function testRelMeLinksFindsLinks() { , 'http://example.com'); $this->assertEquals(array('http://example.org', 'http://twitter.com/barnabywalters'), $relMeLinks); } - + // backlinkingRelMeSuccessNoRedirect tests - + public function testBacklinkingRelMeSuccessNoRedirect() { $meUrl = $backlinkingMeUrl = 'http://example.com'; $chain = mockFollowOneRedirect(array($backlinkingMeUrl)); @@ -123,7 +123,7 @@ public function testBacklinkingRelMeSuccessNoRedirect() { $this->assertTrue($matches); $this->assertTrue($secure); } - + public function testBacklinkingRelMeSuccessOneRedirect() { $meUrl = 'http://example.com'; $backlinkingMeUrl = 'http://example.org'; @@ -132,7 +132,7 @@ public function testBacklinkingRelMeSuccessOneRedirect() { $this->assertTrue($matches); $this->assertTrue($secure); } - + public function testBacklinkingRelMeNoMatchInsecureRedirect() { $meUrl = 'http://example.com'; $backlinkingMeUrl = 'http://example.org'; @@ -141,7 +141,7 @@ public function testBacklinkingRelMeNoMatchInsecureRedirect() { $this->assertFalse($matches); $this->assertFalse($secure); } - + public function testBacklinkingRelMeSuccessInsecureRedirect() { $meUrl = 'http://example.org'; $backlinkingMeUrl = 'http://example.com'; @@ -150,7 +150,7 @@ public function testBacklinkingRelMeSuccessInsecureRedirect() { $this->assertTrue($matches); $this->assertFalse($secure); } - + public function testBacklinkingRelMeSecureRedirectNoMatch() { $meUrl = 'http://example.org'; $backlinkingMeUrl = 'http://example.com';