Skip to content

Commit 52a1923

Browse files
committed
fix failing tests for postgres
1 parent 5a7b0a3 commit 52a1923

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/Fixture/ArticlesFixture.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace CakeDC\Api\Test\Fixture;
1313

14+
use Cake\Database\Driver\Postgres;
15+
use Cake\Datasource\ConnectionInterface;
1416
use Cake\TestSuite\Fixture\TestFixture;
1517

1618
/**
@@ -55,4 +57,14 @@ class ArticlesFixture extends TestFixture
5557
['id' => 14, 'author_id' => 6, 'title' => 'Article N14', 'body' => 'Article N14 Body', 'published' => 'Y'],
5658
['id' => 15, 'author_id' => 1, 'title' => 'Article N15', 'body' => 'Article N15 Body', 'published' => 'Y'],
5759
];
60+
61+
public function insert(ConnectionInterface $db) {
62+
parent::insert($db);
63+
64+
if ($db->getDriver() instanceof Postgres) {
65+
foreach (range(1,count($this->records)) as $i) {
66+
$db->execute('select nextval(\'articles_id_seq\'::regclass)');
67+
}
68+
}
69+
}
5870
}

0 commit comments

Comments
 (0)