Skip to content

Commit

Permalink
[Messenger] Use :memory: for SQLite tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Nov 4, 2022
1 parent 7649a80 commit e44bc95
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions Tests/Transport/DoctrineIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,17 @@ class DoctrineIntegrationTest extends TestCase
private $driverConnection;
/** @var Connection */
private $connection;
/** @var string */
private $sqliteFile;

protected function setUp(): void
{
$this->sqliteFile = sys_get_temp_dir().'/symfony.messenger.sqlite';
$dsn = getenv('MESSENGER_DOCTRINE_DSN') ?: 'sqlite:///'.$this->sqliteFile;
$dsn = getenv('MESSENGER_DOCTRINE_DSN') ?: 'sqlite://:memory:';
$this->driverConnection = DriverManager::getConnection(['url' => $dsn]);
$this->connection = new Connection([], $this->driverConnection);
}

protected function tearDown(): void
{
$this->driverConnection->close();
if (file_exists($this->sqliteFile)) {
@unlink($this->sqliteFile);
}
}

public function testConnectionSendAndGet()
Expand Down

0 comments on commit e44bc95

Please sign in to comment.