summaryrefslogtreecommitdiff
path: root/ext/pdo_sqlite/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pdo_sqlite/tests')
-rw-r--r--ext/pdo_sqlite/tests/bug35336.phpt2
-rw-r--r--ext/pdo_sqlite/tests/bug50728.phpt2
-rw-r--r--ext/pdo_sqlite/tests/bug60104.phpt2
-rw-r--r--ext/pdo_sqlite/tests/bug66033.phpt2
-rw-r--r--ext/pdo_sqlite/tests/bug70862.phpt2
-rw-r--r--ext/pdo_sqlite/tests/bug_42589.phpt2
-rw-r--r--ext/pdo_sqlite/tests/bug_63916-2.phpt4
-rw-r--r--ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt20
-rw-r--r--ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt4
-rw-r--r--ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt2
-rw-r--r--ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt8
-rw-r--r--ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt2
-rw-r--r--ext/pdo_sqlite/tests/pdo_sqlite_lastinsertid.phpt6
-rw-r--r--ext/pdo_sqlite/tests/pdo_sqlite_open_flags.phpt33
-rw-r--r--ext/pdo_sqlite/tests/pdo_sqlite_transaction.phpt2
15 files changed, 63 insertions, 30 deletions
diff --git a/ext/pdo_sqlite/tests/bug35336.phpt b/ext/pdo_sqlite/tests/bug35336.phpt
index b80ce629c2..1f9fda12b6 100644
--- a/ext/pdo_sqlite/tests/bug35336.phpt
+++ b/ext/pdo_sqlite/tests/bug35336.phpt
@@ -20,7 +20,7 @@ $rez = $a->query ("SELECT * FROM test")->fetchAll(PDO::FETCH_CLASS, 'EEE');
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
hello world
hello world
Done
diff --git a/ext/pdo_sqlite/tests/bug50728.phpt b/ext/pdo_sqlite/tests/bug50728.phpt
index 3dbbb1ffff..b00ea50cf0 100644
--- a/ext/pdo_sqlite/tests/bug50728.phpt
+++ b/ext/pdo_sqlite/tests/bug50728.phpt
@@ -12,5 +12,5 @@ try {
var_dump($e->getCode());
}
?>
---EXPECTF--
+--EXPECT--
int(14)
diff --git a/ext/pdo_sqlite/tests/bug60104.phpt b/ext/pdo_sqlite/tests/bug60104.phpt
index fd36b57b76..7a71df8c68 100644
--- a/ext/pdo_sqlite/tests/bug60104.phpt
+++ b/ext/pdo_sqlite/tests/bug60104.phpt
@@ -17,5 +17,5 @@ setUp();
setUp();
echo "done";
?>
---EXPECTF--
+--EXPECT--
done
diff --git a/ext/pdo_sqlite/tests/bug66033.phpt b/ext/pdo_sqlite/tests/bug66033.phpt
index 28da3b54bf..ebd519171a 100644
--- a/ext/pdo_sqlite/tests/bug66033.phpt
+++ b/ext/pdo_sqlite/tests/bug66033.phpt
@@ -29,5 +29,5 @@ try {
var_dump($e->getMessage());
}
?>
---EXPECTF--
+--EXPECT--
string(4) "Blah"
diff --git a/ext/pdo_sqlite/tests/bug70862.phpt b/ext/pdo_sqlite/tests/bug70862.phpt
index 3df1e4f2bd..b0b133d870 100644
--- a/ext/pdo_sqlite/tests/bug70862.phpt
+++ b/ext/pdo_sqlite/tests/bug70862.phpt
@@ -31,6 +31,6 @@ var_dump($f);
?>
+++DONE+++
---EXPECTF--
+--EXPECT--
string(0) ""
+++DONE+++
diff --git a/ext/pdo_sqlite/tests/bug_42589.phpt b/ext/pdo_sqlite/tests/bug_42589.phpt
index abd5e8cea7..de614648a7 100644
--- a/ext/pdo_sqlite/tests/bug_42589.phpt
+++ b/ext/pdo_sqlite/tests/bug_42589.phpt
@@ -18,6 +18,6 @@ $meta2 = $result->getColumnMeta(1);
var_dump(!empty($meta1['table']) && $meta1['table'] == 'test');
var_dump(!empty($meta2['table']) && $meta2['table'] == 'test');
?>
---EXPECTF--
+--EXPECT--
bool(true)
bool(true)
diff --git a/ext/pdo_sqlite/tests/bug_63916-2.phpt b/ext/pdo_sqlite/tests/bug_63916-2.phpt
index bc9bfc9c98..4535410b55 100644
--- a/ext/pdo_sqlite/tests/bug_63916-2.phpt
+++ b/ext/pdo_sqlite/tests/bug_63916-2.phpt
@@ -2,8 +2,8 @@
Bug #63916 PDO::PARAM_INT casts to 32bit int internally even on 64bit builds in pdo_sqlite
--SKIPIF--
<?php
-if (!extension_loaded('pdo_sqlite')) die('skip');
-if (PHP_INT_SIZE > 4) die('skip');
+if (!extension_loaded('pdo_sqlite')) die('skip pdo_sqlite extension not loaded');
+if (PHP_INT_SIZE > 4) die('skip 32-bit only');
?>
--FILE--
<?php
diff --git a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt
index 31eec63e21..c452d4c34f 100644
--- a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt
+++ b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt
@@ -75,19 +75,19 @@ var_dump($st->fetchAll(PDO::FETCH_FUNC, array('bar', 'inexistent')));
--EXPECTF--
object(PDOStatement)#%d (1) {
["queryString"]=>
- %string|unicode%(21) "SELECT * FROM testing"
+ string(21) "SELECT * FROM testing"
}
data: 1, php
object(PDOStatement)#%d (1) {
["queryString"]=>
- %string|unicode%(21) "SELECT * FROM testing"
+ string(21) "SELECT * FROM testing"
}
data: 2,
array(2) {
[0]=>
- %string|unicode%(3) "PHP"
+ string(3) "PHP"
[1]=>
- %string|unicode%(0) ""
+ string(0) ""
}
Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: function 'nothing' not found or invalid function name in %s on line %d
@@ -106,24 +106,24 @@ Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: class 'PDOSta
bool(false)
array(2) {
[0]=>
- %string|unicode%(9) "--- 1 ---"
+ string(9) "--- 1 ---"
[1]=>
- %string|unicode%(9) "--- 2 ---"
+ string(9) "--- 2 ---"
}
array(2) {
[0]=>
- %string|unicode%(7) "1---php"
+ string(7) "1---php"
[1]=>
- %string|unicode%(4) "2---"
+ string(4) "2---"
}
Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: cannot access private method bar::test2() in %s on line %d
bool(false)
array(2) {
[0]=>
- %string|unicode%(7) "1===php"
+ string(7) "1===php"
[1]=>
- %string|unicode%(4) "2==="
+ string(4) "2==="
}
Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: class 'bar' does not have a method 'inexistent' in %s on line %d
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt
index 975dcd96bd..54eb06411f 100644
--- a/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt
@@ -25,7 +25,7 @@ $db->query('DROP TABLE foobar');
--EXPECTF--
array(2) {
["testing(name)"]=>
- %string|unicode%(2) "12"
+ string(2) "12"
[0]=>
- %string|unicode%(2) "12"
+ string(2) "12"
}
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt
index c35e3637ac..efcce00e3d 100644
--- a/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt
@@ -29,7 +29,7 @@ foreach ($result as $row) {
$db->query('DROP TABLE foobar');
?>
---EXPECTF--
+--EXPECT--
1
2
10
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt
index b675879980..13867ae25c 100644
--- a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt
@@ -26,13 +26,13 @@ $db->query('DROP TABLE foobar');
--EXPECTF--
array(2) {
["testing(name)"]=>
- %string|unicode%(3) "php"
+ string(3) "php"
[0]=>
- %string|unicode%(3) "php"
+ string(3) "php"
}
array(2) {
["testing(name)"]=>
- %string|unicode%(4) "php6"
+ string(4) "php6"
[0]=>
- %string|unicode%(4) "php6"
+ string(4) "php6"
}
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt
index 70ccdd0cd3..da6f3cf0fb 100644
--- a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_with_flags.phpt
@@ -26,7 +26,7 @@ foreach ($db->query('SELECT testing(name) FROM foobar') as $row) {
$db->query('DROP TABLE foobar');
?>
---EXPECTF--
+--EXPECT--
array(2) {
["testing(name)"]=>
string(3) "php"
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_lastinsertid.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_lastinsertid.phpt
index 2ff0acd772..bb4d033dda 100644
--- a/ext/pdo_sqlite/tests/pdo_sqlite_lastinsertid.phpt
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_lastinsertid.phpt
@@ -19,14 +19,14 @@ $db->query('DROP TABLE foo');
--EXPECTF--
object(PDOStatement)#2 (1) {
["queryString"]=>
- %string|unicode%(17) "SELECT * FROM foo"
+ string(17) "SELECT * FROM foo"
}
array(3) {
[0]=>
- %string|unicode%(5) "00000"
+ string(5) "00000"
[1]=>
NULL
[2]=>
NULL
}
-%string|unicode%(1) "2"
+string(1) "2"
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_open_flags.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_open_flags.phpt
new file mode 100644
index 0000000000..89cb6c89bd
--- /dev/null
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_open_flags.phpt
@@ -0,0 +1,33 @@
+--TEST--
+PDO_sqlite: Testing open flags
+--SKIPIF--
+<?php if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; ?>
+--FILE--
+<?php
+
+$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . "pdo_sqlite_open_flags.db";
+
+// Default open flag is read-write|create
+$db = new PDO('sqlite:' . $filename, null, null, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
+
+var_dump($db->exec('CREATE TABLE test1 (id INT);'));
+
+$db = new PDO('sqlite:' . $filename, null, null, [PDO::SQLITE_ATTR_OPEN_FLAGS => PDO::SQLITE_OPEN_READONLY, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
+
+var_dump($db->exec('CREATE TABLE test2 (id INT);'));
+?>
+--CLEAN--
+<?php
+$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . "pdo_sqlite_open_flags.db";
+if (file_exists($filename)) {
+ unlink($filename);
+}
+?>
+--EXPECTF--
+int(0)
+
+Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in %s
+Stack trace:
+%s
+#1 {main}
+ thrown in %s
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_transaction.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_transaction.phpt
index 101cc73cb0..8cdaae16e6 100644
--- a/ext/pdo_sqlite/tests/pdo_sqlite_transaction.phpt
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_transaction.phpt
@@ -24,5 +24,5 @@ var_dump($r->rowCount());
$db->query('DROP TABLE foobar');
?>
---EXPECTF--
+--EXPECT--
int(0)