-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
153 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,8 +59,8 @@ jobs: | |
- name: "Run vimeo/psalm" | ||
run: vendor/bin/psalm --diff --show-info=false --stats --threads=4 | ||
|
||
tests: | ||
name: "Tests" | ||
tests-mariadb: | ||
name: "Tests with MariaDB" | ||
|
||
runs-on: "ubuntu-latest" | ||
|
||
|
@@ -105,3 +105,53 @@ jobs: | |
run: vendor/bin/simple-phpunit | ||
env: | ||
TEST_DATABASE_DSN: mysql://root:[email protected]:${{ job.services.mariadb.ports[3306] }}/messenger_monitor_bundle_test | ||
|
||
tests-postgres: | ||
name: "Tests with PostgreSQL" | ||
|
||
runs-on: "ubuntu-latest" | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: | ||
- "8.0" | ||
- "8.1" | ||
postgres-version: | ||
- "9.4" | ||
- "13" | ||
- "14" | ||
dependencies: | ||
- "lowest" | ||
- "highest" | ||
|
||
services: | ||
postgres: | ||
image: "postgres:${{ matrix.postgres-version }}" | ||
ports: | ||
- "5432:5432" | ||
env: | ||
POSTGRES_DB: messenger_monitor_bundle_test | ||
POSTGRES_USER: user | ||
POSTGRES_PASSWORD: password | ||
options: --health-cmd "pg_isready -U user" --health-interval 1s --health-timeout 5s --health-retries 5 | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v3 | ||
|
||
- name: "Set up PHP" | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
coverage: none | ||
php-version: ${{ matrix.php }} | ||
|
||
- name: "Install dependencies with composer" | ||
uses: ramsey/composer-install@v2 | ||
with: | ||
dependency-versions: ${{ matrix.dependencies }} | ||
|
||
- name: "Unit Tests" | ||
run: vendor/bin/simple-phpunit | ||
env: | ||
TEST_DATABASE_DSN: postgres://user:[email protected]:${{ job.services.postgres.ports[5432] }}/messenger_monitor_bundle_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SymfonyCasts\MessengerMonitorBundle\Storage\Doctrine\Driver; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
final class PostgreSQLDriver implements SQLDriverInterface | ||
{ | ||
public function getDateDiffInSecondsExpression(string $fieldFrom, string $fieldTo): string | ||
{ | ||
return sprintf('extract(epoch from (%s - %s))', $fieldFrom, $fieldTo); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SymfonyCasts\MessengerMonitorBundle\Tests\Storage\Doctrine\Driver; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use SymfonyCasts\MessengerMonitorBundle\Storage\Doctrine\Driver\PostgreSQLDriver; | ||
|
||
final class PostgreSQLDriverTest extends TestCase | ||
{ | ||
public function testGetDateDiffInSecondsExpression(): void | ||
{ | ||
$mysqlDriver = new PostgreSQLDriver(); | ||
$this->assertSame( | ||
'extract(epoch from (field_from - field_to))', | ||
$mysqlDriver->getDateDiffInSecondsExpression('field_from', 'field_to') | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters