Add some routing, start working on actually searching webmentions

This commit is contained in:
Lewis Dale committed 2023-03-09 21:50:59 +00:00
1 parent 15d03799bf
commit 45024faa5f
13 files changed
+308 -12

No files matched your search

+52 -6
View File
@@ -34,8 +34,6 @@ class SqliteGatewayTest extends TestCase
public function testCanRetrieveAWebmention()
{
$this->gateway = new SqliteGateway(":memory:");
$webmention = new Webmention(
null,
"https://lewisdale.dev/post/a-post",
@@ -53,8 +51,6 @@ class SqliteGatewayTest extends TestCase
public function testCanDeleteAWebmention()
{
$this->gateway = new SqliteGateway(":memory:");
$webmention = new Webmention(
null,
"https://lewisdale.dev/post/a-post",
@@ -73,8 +69,6 @@ class SqliteGatewayTest extends TestCase
public function testCanGetByPost()
{
$this->gateway = new SqliteGateway(":memory:");
foreach(range(0, 4) as $_) {
$this->gateway->save(new Webmention(
null,
@@ -99,4 +93,56 @@ class SqliteGatewayTest extends TestCase
$this->assertCount(5, $mentions);
}
public function testCanFindByParams()
{
$this->gateway->save(new Webmention(
null,
"https://lewisdale.dev/post/a-new-post",
"https://a-source.url",
"No content",
"Some Author Name"
));
$this->gateway->save(new Webmention(
null,
"https://lewisdale.dev/post/a-new-post",
"https://a-different-source.url",
"No content",
"Some Author Name"
));
$this->gateway->save(new Webmention(
null,
"https://lewisdale.dev/post/a-new-post",
"https://a-source.url",
"Some content",
"Some Author Name"
));
$this->assertCount(
2,
$this->gateway->find([
"target" => "https://lewisdale.dev/post/a-new-post",
"source" => "https://a-source.url"
])
);
$this->assertCount(
1,
$this->gateway->find([
"target" => "https://lewisdale.dev/post/a-new-post",
"source" => "https://a-different-source.url"
])
);
$this->assertCount(
1,
$this->gateway->find([
"target" => "https://lewisdale.dev/post/a-new-post",
"source" => "https://a-source.url",
"content" => "Some content"
])
);
}
}