Skip to content

Commit ca614d7

Browse files
committed
Merge branch 'master' of github.com:MonetDB/MonetDB-PHP
2 parents 9f83c96 + afa3669 commit ca614d7

File tree

4 files changed

+121
-1
lines changed

4 files changed

+121
-1
lines changed

.github/workflows/php-osx.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: OS X
2+
on: [push]
3+
jobs:
4+
build:
5+
runs-on: macos-10.15
6+
steps:
7+
- name: Checkout
8+
uses: actions/checkout@v2
9+
10+
- name: Install Composer
11+
run: |
12+
curl -sS https://getcomposer.org/installer | php
13+
sudo mv composer.phar /usr/local/bin/
14+
15+
- name: Validate composer.json and composer.lock
16+
run: php /usr/local/bin/composer.phar validate
17+
18+
- name: Install dependencies
19+
run: php /usr/local/bin/composer.phar install --prefer-dist --no-progress --no-suggest
20+
21+
- name: Install MonetDB
22+
run: brew install monetdb
23+
- name: Start MonetDB
24+
run: |
25+
monetdbd create /usr/local/var/lib/monetdb
26+
monetdbd set control=yes /usr/local/var/lib/monetdb/
27+
monetdbd set passphrase=testdb /usr/local/var/lib/monetdb
28+
monetdbd start /usr/local/var/lib/monetdb
29+
monetdb create temp
30+
monetdb release temp
31+
monetdb start temp
32+
33+
- name: Run Unit-Tests
34+
run: |
35+
./vendor/bin/phpunit tests/

.github/workflows/php-windows.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# name: Windows
2+
3+
# on: [push]
4+
5+
# jobs:
6+
# build:
7+
8+
# runs-on: windows-2019
9+
10+
# steps:
11+
# - uses: actions/checkout@v2
12+
13+
# - name: Install Composer
14+
# run: |
15+
# choco install composer
16+
# composer update
17+
18+
# - name: Install PHPUnit
19+
# run: |
20+
# composer require --dev --update-with-dependencies phpunit/phpunit ^9
21+
22+
# - name: Install MonetDB
23+
# run: |
24+
# curl https://www.monetdb.org/downloads/Windows/Oct2020-SP1/MonetDB-ODBC-Installer-i386-20201118.msi
25+
# msiexec /s MonetDB-ODBC-Installer-i386-20201118.msi
26+
27+
# - name: Validate composer.json and composer.lock
28+
# run: composer validate
29+
30+
# - name: Cache Composer packages
31+
# id: composer-cache
32+
# uses: actions/cache@v2
33+
# with:
34+
# path: vendor
35+
# key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
36+
# restore-keys: |
37+
# ${{ runner.os }}-php-
38+
39+
# - name: Install dependencies
40+
# if: steps.composer-cache.outputs.cache-hit != 'true'
41+
# run: composer install --prefer-dist --no-progress --no-suggest
42+
43+
# - name: Run Unit-Tests
44+
# run: |
45+
# ./vendor/bin/phpunit tests/

.github/workflows/php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PHP Composer
1+
name: Linux
22

33
on: [push]
44

tests/int64Test.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
use PHPUnit\Framework\TestCase;
3+
use MonetDB\Connection;
4+
5+
require_once(__DIR__. '../../src/include.php');
6+
7+
final class int64Test extends TestCase {
8+
public $conn;
9+
10+
public function setUp(): void
11+
{
12+
$this->conn = new Connection("127.0.0.1", 50000, "monetdb", "monetdb", "temp");
13+
}
14+
15+
public function testBigIntTable(): void
16+
{
17+
$res = $this->conn->Query("CREATE TABLE php_int64_dec18 (i BIGINT, d0 DECIMAL(18,0), d9 DECIMAL(18,9));");
18+
19+
$this->assertCount(0, $res);
20+
}
21+
22+
public function testInsertBigInt(): void
23+
{
24+
$res = $this->conn->Query("INSERT INTO php_int64_dec18 VALUES (1234567890987654321, 123456789987654321, 123456789.987654321);");
25+
26+
$this->assertCount(0, $res);
27+
}
28+
29+
public function testSelectBigInt(): void
30+
{
31+
$res = $this->conn->Query("SELECT * FROM php_int64_dec18;");
32+
$res_arr = iterator_to_array($res);
33+
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+
}
38+
39+
}
40+
?>

0 commit comments

Comments
 (0)