Initial commit, start creating a webmention sender
This commit is contained in:
commit
4eba80387d
7 files changed
+2588
No files matched your search
@@ -0,0 +1,38 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Contracts\HttpClient\ResponseInterface;
|
||||
use Lewisdale\Webmentions\EndpointParser;
|
||||
|
||||
|
||||
class EndpointParserTest extends TestCase {
|
||||
public function testParsesRelativeEndpointFromResponseHeaders() {
|
||||
$response = $this->createStub(ResponseInterface::class);
|
||||
|
||||
$response->method('getHeaders')
|
||||
->willReturn([
|
||||
"link" => ["</test/1/webmention>; rel=webmention"],
|
||||
]);
|
||||
|
||||
$response->method('getInfo')
|
||||
->willReturn('https://webmention.rocks/test/1');
|
||||
|
||||
$this->assertSame("https://webmention.rocks/test/1/webmention", EndpointParser::parse($response));
|
||||
}
|
||||
|
||||
public function testParsesRelativeEndpointWithQuotedRelInResponseHeader() {
|
||||
$response = $this->createStub(ResponseInterface::class);
|
||||
|
||||
$response->method('getHeaders')
|
||||
->willReturn([
|
||||
"link" => ['</test/5/webmention>; rel="webmention"'],
|
||||
]);
|
||||
|
||||
|
||||
$response->method('getInfo')
|
||||
->willReturn('https://webmention.rocks/test/5');
|
||||
|
||||
$this->assertSame("https://webmention.rocks/test/5/webmention", EndpointParser::parse($response));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user