From 537a9d9f85d4f624b49258f2b09ff2a2b0b73461 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Kucha=C5=99?= <honza.kuchar@grifart.cz>
Date: Thu, 12 May 2016 12:20:12 +0200
Subject: [PATCH] tests: added optional Cursor test which uses PostgresDriver
 (requires connection to PostgreSQL)

---
 .../PostgresDriver/PostgresCursorTest.phpt    | 49 +++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 tests/Store/PostgresDriver/PostgresCursorTest.phpt

diff --git a/tests/Store/PostgresDriver/PostgresCursorTest.phpt b/tests/Store/PostgresDriver/PostgresCursorTest.phpt
new file mode 100644
index 0000000..ada9cac
--- /dev/null
+++ b/tests/Store/PostgresDriver/PostgresCursorTest.phpt
@@ -0,0 +1,49 @@
+<?php
+/**
+ * @testCase
+ */
+
+namespace Grifart\Mappi\Tests\Store\Store\PostgresDriver;
+
+use Dibi\DriverException;
+use Grifart\Mappi\Store\PostgresDriver\ArrayCursorDriver;
+use Grifart\Mappi\Store\PostgresDriver\Cursor;
+use Grifart\Mappi\Store\PostgresDriver\CursorFactory;
+use Grifart\Mappi\Store\PostgresDriver\ICursor;
+use Grifart\Mappi\Store\PostgresDriver\ICursorDriver;
+use Tester\Environment;
+
+require_once __DIR__ . "/../../bootstrap.php";
+require_once __DIR__ . "/ICursorTest.php";
+
+class PostgresCursorTest extends ICursorTest
+{
+	/** @var ICursor */
+	protected $uut;
+
+	protected function setUp()
+	{
+		global $connection, $SQL_thousandRowsAscending;
+		try{
+			$connection->begin();
+
+			$factory = new CursorFactory($connection);
+			$this->uut = $factory->create($SQL_thousandRowsAscending, true);
+		} catch (DriverException $e) {
+			Environment::skip("It looks like you haven't properly set-up dibi connection to PostgreSQL. Check tests/bootstrap.php");
+		}
+
+		parent::setUp();
+	}
+
+	public function tearDown()
+	{
+		global $connection;
+		$connection->rollback();
+
+		parent::tearDown();
+	}
+
+}
+
+(new PostgresCursorTest())->run();
-- 
GitLab