Skip to content

Commit

Permalink
Add adapter for image variations
Browse files Browse the repository at this point in the history
  • Loading branch information
christeredvartsen committed Sep 4, 2021
1 parent 692a857 commit ce19ae7
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 11 deletions.
28 changes: 17 additions & 11 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions src/EventListener/ImageVariations/Database/PostgreSQL.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php declare(strict_types=1);
namespace Imbo\EventListener\ImageVariations\Database;

/**
* PostgreSQL database adapter for the image variations
*/
class PostgreSQL extends PDOAdapter
{
protected function getIdentifierQuote(): string
{
return '"';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php declare(strict_types=1);
namespace Imbo\EventListener\ImageVariations\Database;

use PDO;

/**
* @coversDefaultClass Imbo\EventListener\ImageVariations\Database\PostgreSQL
*/
class PostgreSQLIntegrationTest extends DatabaseTests
{
protected function getAdapter(): PostgreSQL
{
return new PostgreSQL(
(string) getenv('DB_DSN'),
(string) getenv('DB_USERNAME'),
(string) getenv('DB_PASSWORD'),
);
}

protected function setUp(): void
{
parent::setUp();

$pdo = new PDO(
(string) getenv('DB_DSN'),
(string) getenv('DB_USERNAME'),
(string) getenv('DB_PASSWORD'),
);

$pdo->query(sprintf('DELETE FROM "%s"', PostgreSQL::IMAGEVARIATIONS_TABLE));
}
}

0 comments on commit ce19ae7

Please sign in to comment.