Skip to content

Commit e168048

Browse files
committed
tests
1 parent ca614d7 commit e168048

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

tests/dec38Test.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public function setUp(): void
1717

1818
public function testBigIntTable(): void
1919
{
20+
$this->conn->Query("drop table if exists php_dec38");
2021
$res = $this->conn->Query("CREATE TABLE php_dec38 (d38_0 DECIMAL(38,0), d38_19 DECIMAL(38,19), d38_38 DECIMAL(38,38));");
2122

2223
$this->assertCount(0, $res);

tests/int128Test.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function testStartTransaction(): void
2525

2626
public function testBigIntTable(): void
2727
{
28+
$this->conn->Query("drop table if exists php_int128");
2829
$res = $this->conn->Query("CREATE TABLE php_int128 (i HUGEINT);");
2930

3031
$this->assertCount(0, $res);

tests/int64Test.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@
55
require_once(__DIR__. '../../src/include.php');
66

77
final class int64Test extends TestCase {
8+
/**
9+
* @var Connection
10+
*/
811
public $conn;
912

1013
public function setUp(): void
1114
{
12-
$this->conn = new Connection("127.0.0.1", 50000, "monetdb", "monetdb", "temp");
15+
$this->conn = new Connection("127.0.0.1", 50000, "monetdb", "monetdb", "myDatabase");
1316
}
1417

1518
public function testBigIntTable(): void
1619
{
20+
$this->conn->Query("drop table if exists php_int64_dec18");
1721
$res = $this->conn->Query("CREATE TABLE php_int64_dec18 (i BIGINT, d0 DECIMAL(18,0), d9 DECIMAL(18,9));");
1822

1923
$this->assertCount(0, $res);
@@ -28,13 +32,10 @@ public function testInsertBigInt(): void
2832

2933
public function testSelectBigInt(): void
3034
{
31-
$res = $this->conn->Query("SELECT * FROM php_int64_dec18;");
32-
$res_arr = iterator_to_array($res);
35+
$res = $this->conn->QueryFirst("SELECT * FROM php_int64_dec18;");
3336

34-
$this->assertEquals($res_arr[1]["i"], "1234567890987654321");
35-
$this->assertEquals($res_arr[1]["d0"], "123456789987654321");
36-
$this->assertEquals($res_arr[1]["d9"], "123456789.987654321");
37+
$this->assertEquals($res["i"], "1234567890987654321");
38+
$this->assertEquals($res["d0"], "123456789987654321");
39+
$this->assertEquals($res["d9"], "123456789.987654321");
3740
}
38-
3941
}
40-
?>

0 commit comments

Comments
 (0)