1
0
mirror of https://github.com/danog/postgres.git synced 2024-11-26 12:04:50 +01:00

Fix Transaction; Fix tests; Remove extension repo directories after install on travis

This commit is contained in:
Chris Wright 2018-07-01 12:34:55 -05:00 committed by Aaron Piotrowski
parent 0472d5d560
commit 660209270d
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB
7 changed files with 11 additions and 6 deletions

View File

@ -10,6 +10,7 @@ use Amp\Loop;
use Amp\Promise;
use Amp\Sql\ConnectionException;
use Amp\Sql\FailureException;
use Amp\Sql\QueryError;
use Amp\Success;
use pq;
use function Amp\call;

View File

@ -81,7 +81,7 @@ final class Transaction implements Handle, SqlTransaction
*/
public function isAlive(): bool
{
return $this->handle->isAlive();
return $this->handle && $this->handle->isAlive();
}
/**

View File

@ -103,7 +103,7 @@ abstract class AbstractLinkTest extends TestCase
}
/**
* @expectedException QueryError
* @expectedException \Amp\Sql\QueryError
*/
public function testQueryWithEmptyQuery()
{
@ -669,7 +669,7 @@ abstract class AbstractLinkTest extends TestCase
/**
* @depends testListen
* @expectedException QueryError
* @expectedException \Amp\Sql\QueryError
* @expectedExceptionMessage Already listening on channel
*/
public function testListenOnSameChannel()

View File

@ -4,6 +4,7 @@ namespace Amp\Postgres\Test;
use Amp\Postgres\ConnectionConfig;
use Amp\Postgres\Link;
use Amp\Postgres\PgSqlConnection;
use Amp\Postgres\Pool;
use Amp\Promise;
use Amp\Sql\Connector;
@ -32,8 +33,9 @@ class PgSqlPoolTest extends AbstractLinkTest
if (!isset($this->handles[$count])) {
$this->fail("createConnection called too many times");
}
$handle = $this->handles[$count];
++$count;
return new Success();
return new Success(new PgSqlConnection($handle, \pg_socket($handle)));
}));
$pool = new Pool(new ConnectionConfig('connection string'), \count($this->handles), $connector);

View File

@ -4,11 +4,11 @@ namespace Amp\Postgres\Test;
use Amp\Delayed;
use Amp\Loop;
use Amp\Postgres\Pool;
use Amp\Postgres\ConnectionConfig;
use Amp\Postgres\Pool;
use PHPUnit\Framework\TestCase;
class DefaultPoolTest extends TestCase
class PoolTest extends TestCase
{
/**
* @expectedException \Error

View File

@ -8,3 +8,4 @@ make;
make install;
popd;
echo "extension=pq.so" >> "$(php -r 'echo php_ini_loaded_file();')";
rm -rf ext-pq

View File

@ -8,3 +8,4 @@ make;
make install;
popd;
echo "extension=raphf.so" >> "$(php -r 'echo php_ini_loaded_file();')";
rm -rf ext-raphf