diff --git a/tests/Cases/DatabasePostgresBuilderTest.php b/tests/Cases/DatabasePostgresBuilderTest.php index 3fb122a..0ef64ca 100644 --- a/tests/Cases/DatabasePostgresBuilderTest.php +++ b/tests/Cases/DatabasePostgresBuilderTest.php @@ -23,6 +23,7 @@ use Hyperf\Database\Schema\Schema; use Hyperf\DbConnection\Db; use HyperfTest\Database\PgSQL\Stubs\ContainerStub; +use HyperfTest\Database\PgSQL\Stubs\SwooleVersionStub; use Mockery as m; use PHPUnit\Framework\Attributes\CoversNothing; use PHPUnit\Framework\TestCase; @@ -43,6 +44,7 @@ protected function tearDown(): void public function testCreateDatabase() { + SwooleVersionStub::skipV6(); $grammar = new PostgresGrammar(); $connection = m::mock(Connection::class); @@ -58,6 +60,7 @@ public function testCreateDatabase() public function testDropDatabaseIfExists() { + SwooleVersionStub::skipV6(); $grammar = new PostgresGrammar(); $connection = m::mock(Connection::class); @@ -72,6 +75,7 @@ public function testDropDatabaseIfExists() public function testWhereFullText() { + SwooleVersionStub::skipV6(); $builder = $this->getPostgresBuilderWithProcessor(); $builder->select('*')->from('users')->whereFullText('body', 'Hello World'); $this->assertSame('select * from "users" where (to_tsvector(\'english\', "body")) @@ plainto_tsquery(\'english\', ?)', $builder->toSql()); @@ -110,6 +114,7 @@ public function testWhereFullText() public function testWhereFullTextForReal() { + SwooleVersionStub::skipV6(); $container = ContainerStub::getContainer(); $container->shouldReceive('get')->with(Db::class)->andReturn(new Db($container)); diff --git a/tests/Cases/PostgreSqlSwooleExtConnectionTest.php b/tests/Cases/PostgreSqlSwooleExtConnectionTest.php index d1aac19..2a5655f 100644 --- a/tests/Cases/PostgreSqlSwooleExtConnectionTest.php +++ b/tests/Cases/PostgreSqlSwooleExtConnectionTest.php @@ -23,6 +23,7 @@ use Hyperf\Database\Schema\Schema; use Hyperf\Support\Filesystem\Filesystem; use HyperfTest\Database\PgSQL\Stubs\ContainerStub; +use HyperfTest\Database\PgSQL\Stubs\SwooleVersionStub; use Mockery; use PHPUnit\Framework\Attributes\CoversNothing; use PHPUnit\Framework\TestCase; @@ -39,6 +40,7 @@ class PostgreSqlSwooleExtConnectionTest extends TestCase public function setUp(): void { + SwooleVersionStub::skipV6(); $resolver = ContainerStub::getContainer()->get(ConnectionResolverInterface::class); $this->migrator = new Migrator( diff --git a/tests/DBAL/ConnectionTest.php b/tests/DBAL/ConnectionTest.php index 516c06f..7cc2892 100644 --- a/tests/DBAL/ConnectionTest.php +++ b/tests/DBAL/ConnectionTest.php @@ -15,6 +15,7 @@ use Hyperf\Database\PgSQL\DBAL\Connection; use Hyperf\Database\PgSQL\DBAL\Result; use Hyperf\Database\PgSQL\DBAL\Statement; +use HyperfTest\Database\PgSQL\Stubs\SwooleVersionStub; use PHPUnit\Framework\Attributes\CoversNothing; use PHPUnit\Framework\TestCase; use Swoole\Coroutine\PostgreSQL; @@ -30,6 +31,7 @@ class ConnectionTest extends TestCase public function setUp(): void { + SwooleVersionStub::skipV6(); $pgsql = new PostgreSQL(); $connected = $pgsql->connect('host=127.0.0.1 port=5432 dbname=postgres user=postgres password=postgres'); if (! $connected) { diff --git a/tests/Stubs/ContainerStub.php b/tests/Stubs/ContainerStub.php index f5c9a04..c66e565 100644 --- a/tests/Stubs/ContainerStub.php +++ b/tests/Stubs/ContainerStub.php @@ -38,7 +38,6 @@ public static function getContainer() Connection::resolverFor('pgsql-swoole', static function ($connection, $database, $prefix, $config) { return new PostgreSqlSwooleExtConnection($connection, $database, $prefix, $config); }); - $connection = $connector->make([ 'driver' => 'pgsql-swoole', 'host' => '127.0.0.1', diff --git a/tests/Stubs/SwooleVersionStub.php b/tests/Stubs/SwooleVersionStub.php new file mode 100644 index 0000000..a999fa0 --- /dev/null +++ b/tests/Stubs/SwooleVersionStub.php @@ -0,0 +1,30 @@ +='); + } +}