-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 6.4: [TwigBridge] foundation 5 layout: use form_label_content block for checkbox and radio labels [TwigBridge] Fix compat with Twig v3.9 [Cache] Sync the Redis proxies with upstream [Doctrine Messenger] Fix support for pgsql + pgbouncer. [Mailer] Simplify fix Do not produce notice/warning when consuming from multiple transports and explicitly listed queues [FrameworkBundle] Check if the _route attribute exists on the request [Scheduler] fix documentation link [PropertyAccess] Fixes getValue() on an unitialized object property on a lazy ghost [HttpClient] Make retry strategy work again AssetMapper: Remove 'auto-generated' info [Mailer] Fix signed emails breaking the profiler [Mailer] [Mailgun] Fix expecting payload without tags or user variables [Validator] Update Spanish (es) translations Fix fetching data in `W3CReferenceTest` on AppVeyor Fix SQS visibility_timeout type [VarDumper] Fix serialization of stubs with null or uninitialized values
- Loading branch information
Showing
6 changed files
with
340 additions
and
13 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[databases] | ||
postgres = host=localhost port=5432 user=postgres dbname=postgres pool_mode=transaction | ||
|
||
[pgbouncer] | ||
logfile = /var/log/postgresql/pgbouncer.log | ||
pidfile = /var/run/postgresql/pgbouncer.pid | ||
listen_addr = localhost | ||
listen_port = 6432 | ||
unix_socket_dir = /var/run/postgresql | ||
auth_type = md5 | ||
auth_file = /etc/pgbouncer/userlist.txt | ||
max_client_conn = 20 | ||
default_pool_size = 20 |
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 @@ | ||
"postgres" "md532e12f215ba27cb750c9e093ce4b5127" |
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
89 changes: 89 additions & 0 deletions
89
Tests/Transport/DoctrinePostgreSqlPgbouncerIntegrationTest.php
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,89 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Messenger\Bridge\Doctrine\Tests\Transport; | ||
|
||
use Doctrine\DBAL\Configuration; | ||
use Doctrine\DBAL\Connection; | ||
use Doctrine\DBAL\DriverManager; | ||
use Doctrine\DBAL\Schema\AbstractSchemaManager; | ||
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory; | ||
use Doctrine\DBAL\Tools\DsnParser; | ||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\Messenger\Bridge\Doctrine\Tests\Fixtures\DummyMessage; | ||
use Symfony\Component\Messenger\Bridge\Doctrine\Transport\PostgreSqlConnection; | ||
|
||
/** | ||
* This tests using PostgreSqlConnection with PgBouncer between pgsql and the application. | ||
* | ||
* @requires extension pdo_pgsql | ||
* | ||
* @group integration | ||
*/ | ||
class DoctrinePostgreSqlPgbouncerIntegrationTest extends TestCase | ||
{ | ||
private Connection $driverConnection; | ||
private PostgreSqlConnection $connection; | ||
|
||
public function testSendAndGetWithAutoSetupEnabledAndNotSetupAlready() | ||
{ | ||
$this->connection->send('{"message": "Hi"}', ['type' => DummyMessage::class]); | ||
|
||
$encoded = $this->connection->get(); | ||
$this->assertSame('{"message": "Hi"}', $encoded['body']); | ||
$this->assertSame(['type' => DummyMessage::class], $encoded['headers']); | ||
|
||
$this->assertNull($this->connection->get()); | ||
} | ||
|
||
public function testSendAndGetWithAutoSetupEnabledAndSetupAlready() | ||
{ | ||
$this->connection->setup(); | ||
|
||
$this->connection->send('{"message": "Hi"}', ['type' => DummyMessage::class]); | ||
|
||
$encoded = $this->connection->get(); | ||
$this->assertSame('{"message": "Hi"}', $encoded['body']); | ||
$this->assertSame(['type' => DummyMessage::class], $encoded['headers']); | ||
|
||
$this->assertNull($this->connection->get()); | ||
} | ||
|
||
protected function setUp(): void | ||
{ | ||
if (!$host = getenv('PGBOUNCER_HOST')) { | ||
$this->markTestSkipped('Missing PGBOUNCER_HOST env variable'); | ||
} | ||
|
||
$url = "pdo-pgsql://postgres:password@$host"; | ||
$params = class_exists(DsnParser::class) ? (new DsnParser())->parse($url) : ['url' => $url]; | ||
$config = new Configuration(); | ||
if (class_exists(DefaultSchemaManagerFactory::class)) { | ||
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory()); | ||
} | ||
|
||
$this->driverConnection = DriverManager::getConnection($params, $config); | ||
$this->connection = new PostgreSqlConnection(['table_name' => 'queue_table'], $this->driverConnection); | ||
} | ||
|
||
protected function tearDown(): void | ||
{ | ||
$this->createSchemaManager()->dropTable('queue_table'); | ||
$this->driverConnection->close(); | ||
} | ||
|
||
private function createSchemaManager(): AbstractSchemaManager | ||
{ | ||
return method_exists($this->driverConnection, 'createSchemaManager') | ||
? $this->driverConnection->createSchemaManager() | ||
: $this->driverConnection->getSchemaManager(); | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
Tests/Transport/DoctrinePostgreSqlRegularIntegrationTest.php
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,89 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Messenger\Bridge\Doctrine\Tests\Transport; | ||
|
||
use Doctrine\DBAL\Configuration; | ||
use Doctrine\DBAL\DriverManager; | ||
use Doctrine\DBAL\Schema\AbstractSchemaManager; | ||
use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory; | ||
use Doctrine\DBAL\Tools\DsnParser; | ||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\Messenger\Bridge\Doctrine\Tests\Fixtures\DummyMessage; | ||
use Symfony\Component\Messenger\Bridge\Doctrine\Transport\Connection; | ||
|
||
/** | ||
* This tests a using Doctrine PostgreSql connection without using PostgreSqlConnection | ||
* that gets used when use_notify is enabled. | ||
* | ||
* @requires extension pdo_pgsql | ||
* | ||
* @group integration | ||
*/ | ||
class DoctrinePostgreSqlRegularIntegrationTest extends TestCase | ||
{ | ||
private \Doctrine\DBAL\Connection $driverConnection; | ||
private Connection $connection; | ||
|
||
public function testSendAndGetWithAutoSetupEnabledAndNotSetupAlready() | ||
{ | ||
$this->connection->send('{"message": "Hi"}', ['type' => DummyMessage::class]); | ||
|
||
$encoded = $this->connection->get(); | ||
$this->assertSame('{"message": "Hi"}', $encoded['body']); | ||
$this->assertSame(['type' => DummyMessage::class], $encoded['headers']); | ||
|
||
$this->assertNull($this->connection->get()); | ||
} | ||
|
||
public function testSendAndGetWithAutoSetupEnabledAndSetupAlready() | ||
{ | ||
$this->connection->setup(); | ||
|
||
$this->connection->send('{"message": "Hi"}', ['type' => DummyMessage::class]); | ||
|
||
$encoded = $this->connection->get(); | ||
$this->assertSame('{"message": "Hi"}', $encoded['body']); | ||
$this->assertSame(['type' => DummyMessage::class], $encoded['headers']); | ||
|
||
$this->assertNull($this->connection->get()); | ||
} | ||
|
||
protected function setUp(): void | ||
{ | ||
if (!$host = getenv('POSTGRES_HOST')) { | ||
$this->markTestSkipped('Missing POSTGRES_HOST env variable'); | ||
} | ||
|
||
$url = "pdo-pgsql://postgres:password@$host"; | ||
$params = class_exists(DsnParser::class) ? (new DsnParser())->parse($url) : ['url' => $url]; | ||
$config = new Configuration(); | ||
if (class_exists(DefaultSchemaManagerFactory::class)) { | ||
$config->setSchemaManagerFactory(new DefaultSchemaManagerFactory()); | ||
} | ||
|
||
$this->driverConnection = DriverManager::getConnection($params, $config); | ||
$this->connection = new Connection(['table_name' => 'queue_table'], $this->driverConnection); | ||
} | ||
|
||
protected function tearDown(): void | ||
{ | ||
$this->createSchemaManager()->dropTable('queue_table'); | ||
$this->driverConnection->close(); | ||
} | ||
|
||
private function createSchemaManager(): AbstractSchemaManager | ||
{ | ||
return method_exists($this->driverConnection, 'createSchemaManager') | ||
? $this->driverConnection->createSchemaManager() | ||
: $this->driverConnection->getSchemaManager(); | ||
} | ||
} |
Oops, something went wrong.