-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update existing tests and add new tests cover added classes
- Loading branch information
1 parent
1d78c25
commit 1764330
Showing
13 changed files
with
1,052 additions
and
461 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
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,76 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Jsor\Doctrine\PostGIS\Driver; | ||
|
||
use Doctrine\DBAL\Driver\API\ExceptionConverter; | ||
use Doctrine\DBAL\Driver\PDO\PgSQL\Driver as PgSQLDriver; | ||
use Doctrine\DBAL\Types\Type; | ||
use Jsor\Doctrine\PostGIS\Types\PostGISType; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @covers \Jsor\Doctrine\PostGIS\Driver\Driver | ||
* | ||
* @runTestsInSeparateProcesses | ||
* | ||
* @internal | ||
*/ | ||
final class DriverTest extends TestCase | ||
{ | ||
public function testConnect(): void | ||
{ | ||
static::assertFalse(Type::hasType(PostGISType::GEOGRAPHY)); | ||
static::assertFalse(Type::hasType(PostGISType::GEOMETRY)); | ||
|
||
$driver = $this->getDriver(); | ||
$driver->connect([ | ||
'driver' => getenv('DB_TYPE'), | ||
'user' => getenv('DB_USER'), | ||
'password' => getenv('DB_PASSWORD'), | ||
'host' => getenv('DB_HOST'), | ||
'dbname' => getenv('DB_NAME'), | ||
'port' => getenv('DB_PORT'), | ||
]); | ||
|
||
static::assertTrue(Type::hasType(PostGISType::GEOGRAPHY)); | ||
static::assertTrue(Type::hasType(PostGISType::GEOMETRY)); | ||
} | ||
|
||
public function testGetDatabasePlatform(): void | ||
{ | ||
$driver = $this->getDriver(); | ||
|
||
static::assertInstanceOf(PostGISPlatform::class, $driver->getDatabasePlatform()); | ||
} | ||
|
||
public function providerVersions(): iterable | ||
{ | ||
yield [11]; | ||
yield [12]; | ||
yield [13]; | ||
yield [14]; | ||
yield [15]; | ||
} | ||
|
||
/** @dataProvider providerVersions */ | ||
public function testCreateDatabasePlatformForVersion(int $version): void | ||
{ | ||
$driver = $this->getDriver(); | ||
|
||
static::assertInstanceOf(PostGISPlatform::class, $driver->createDatabasePlatformForVersion($version)); | ||
} | ||
|
||
public function testGetExceptionConverter(): void | ||
{ | ||
$driver = $this->getDriver(); | ||
|
||
static::assertInstanceOf(ExceptionConverter::class, $driver->getExceptionConverter()); | ||
} | ||
|
||
private function getDriver(): Driver | ||
{ | ||
return new Driver(new PgSQLDriver()); | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Jsor\Doctrine\PostGIS\Driver; | ||
|
||
use Doctrine\DBAL\Driver\PgSQL\Driver as PgSQLDriver; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @covers \Jsor\Doctrine\PostGIS\Driver\Middleware | ||
* | ||
* @internal | ||
*/ | ||
final class MiddlewareTest extends TestCase | ||
{ | ||
public function testWrap(): void | ||
{ | ||
$middleware = new Middleware(); | ||
|
||
static::assertInstanceOf(Driver::class, $middleware->wrap(new PgSQLDriver())); | ||
} | ||
} |
Oops, something went wrong.