Start adding SQLite database access
This commit is contained in:
1 parent
df226b2897
commit
adeb7a1b51
6 files changed
+176
No files matched your search
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
error_reporting(E_ALL); ini_set('display_errors',1);
|
||||
|
||||
|
||||
use Lewisdale\Webmentions\Gateways\SqliteGateway;
|
||||
use Lewisdale\Webmentions\Models\Webmention;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class SqliteGatewayTest extends TestCase
|
||||
{
|
||||
public function testCanInsertAWebmention()
|
||||
{
|
||||
$gateway = new SqliteGateway(":memory:");
|
||||
|
||||
$webmention = new Webmention(
|
||||
null,
|
||||
"https://lewisdale.dev/post/a-post",
|
||||
"https://a-source.url",
|
||||
"No content",
|
||||
"Some Author Name"
|
||||
);
|
||||
|
||||
$webmention->id = $gateway->save($webmention);
|
||||
$this->assertNotNull($webmention->id);
|
||||
}
|
||||
|
||||
public function testCanRetrieveAWebmention()
|
||||
{
|
||||
$gateway = new SqliteGateway(":memory:");
|
||||
|
||||
$webmention = new Webmention(
|
||||
null,
|
||||
"https://lewisdale.dev/post/a-post",
|
||||
"https://a-source.url",
|
||||
"No content",
|
||||
"Some Author Name"
|
||||
);
|
||||
|
||||
$webmention->id = $gateway->save($webmention);
|
||||
|
||||
$retrieved = $gateway->get($webmention->id);
|
||||
|
||||
$this->assertEquals($webmention, $retrieved, ((string) $webmention). " " . ((string) $retrieved));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user