Work on parsing authors and content from mentions

This commit is contained in:
Lewis Dale committed 2023-03-15 09:15:55 +00:00
1 parent a5e0902366
commit a429befc94
6 files changed
+282 -77

No files matched your search

+15 -14
View File
@@ -1,7 +1,8 @@
<?php
declare(strict_types=1);
error_reporting(E_ALL); ini_set('display_errors',1);
error_reporting(E_ALL);
ini_set('display_errors', 1);
use Lewisdale\Webmentions\Gateways\SqliteGateway;
@@ -27,7 +28,7 @@ class SqliteGatewayTest extends TestCase
"https://a-source.url",
MentionType::Like,
"No content",
"Some Author Name"
new \Lewisdale\Webmentions\Models\Author(),
);
$webmention->id = $this->gateway->save($webmention);
@@ -42,7 +43,7 @@ class SqliteGatewayTest extends TestCase
"https://a-source.url",
MentionType::Like,
"No content",
"Some Author Name"
new \Lewisdale\Webmentions\Models\Author(),
);
$webmention->id = $this->gateway->save($webmention);
@@ -60,7 +61,7 @@ class SqliteGatewayTest extends TestCase
"https://a-source.url",
MentionType::Like,
"No content",
"Some Author Name"
new \Lewisdale\Webmentions\Models\Author()
);
$webmention->id = $this->gateway->save($webmention);
@@ -73,25 +74,25 @@ class SqliteGatewayTest extends TestCase
public function testCanGetByPost()
{
foreach(range(0, 4) as $_) {
foreach (range(0, 4) as $_) {
$this->gateway->save(new Webmention(
null,
"https://lewisdale.dev/post/a-new-post",
"https://a-source.url",
MentionType::Reply,
"No content",
"Some Author Name"
new \Lewisdale\Webmentions\Models\Author()
));
}
foreach(range(0, 4) as $_) {
foreach (range(0, 4) as $_) {
$this->gateway->save(new Webmention(
null,
"https://lewisdale.dev/post/a-different-post",
"https://a-source.url",
MentionType::Like,
"No content",
"Some Author Name"
new \Lewisdale\Webmentions\Models\Author()
));
}
@@ -108,7 +109,7 @@ class SqliteGatewayTest extends TestCase
"https://a-source.url",
MentionType::Reply,
"No content",
"Some Author Name"
new \Lewisdale\Webmentions\Models\Author()
));
$this->gateway->save(new Webmention(
@@ -117,7 +118,7 @@ class SqliteGatewayTest extends TestCase
"https://a-different-source.url",
MentionType::Like,
"No content",
"Some Author Name"
new \Lewisdale\Webmentions\Models\Author()
));
$this->gateway->save(new Webmention(
@@ -126,14 +127,14 @@ class SqliteGatewayTest extends TestCase
"https://a-source.url",
MentionType::Reply,
"Some content",
"Some Author Name"
new \Lewisdale\Webmentions\Models\Author()
));
$this->assertCount(
2,
$this->gateway->find([
"target" => "https://lewisdale.dev/post/a-new-post",
"source" => "https://a-source.url"
"source" => "https://a-source.url",
])
);
@@ -141,7 +142,7 @@ class SqliteGatewayTest extends TestCase
1,
$this->gateway->find([
"target" => "https://lewisdale.dev/post/a-new-post",
"source" => "https://a-different-source.url"
"source" => "https://a-different-source.url",
])
);
@@ -150,7 +151,7 @@ class SqliteGatewayTest extends TestCase
$this->gateway->find([
"target" => "https://lewisdale.dev/post/a-new-post",
"source" => "https://a-source.url",
"content" => "Some content"
"content" => "Some content",
])
);
}