com php-src: Fixed a few PDO tests to conform to PDO Common standards: ext/pdo/tests/bug47769.phpt ext/pdo/tests/bug61292.phpt
ext/pdo/tests/bug65946.phpt ext/pdo/tests/bug_44159 .phpt ext/pdo/tests/bug_47769.phpt ext/pdo/ tests/bug_61292.phpt ext/pdo/tests/bug_65 946.phpt

From: Date: Mon, 04 Apr 2016 21:43:17 +0000
Subject: com php-src: Fixed a few PDO tests to conform to PDO Common standards: ext/pdo/tests/bug47769.phpt ext/pdo/tests/bug61292.phpt
ext/pdo/tests/bug65946.phpt ext/pdo/tests/bug_44159 .phpt ext/pdo/tests/bug_47769.phpt ext/pdo/ tests/bug_61292.phpt ext/pdo/tests/bug_65 946.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-91599@lists.php.net to get a copy of this message
Commit: 9a87108eca5eb7e95b3f59808fe2234edbd17fa1 Author: Matteo Beccati <mbeccati@php.net> Mon, 4 Apr 2016 23:42:52 +0200 Parents: cd038cc5eb7103b5ad48cebda7f9a7944f1f48ed Branches: PHP-5.6 PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9a87108eca5eb7e95b3f59808fe2234edbd17fa1 Log: Fixed a few PDO tests to conform to PDO Common standards Changed paths: D ext/pdo/tests/bug47769.phpt D ext/pdo/tests/bug61292.phpt D ext/pdo/tests/bug65946.phpt M ext/pdo/tests/bug_44159.phpt A ext/pdo/tests/bug_47769.phpt A ext/pdo/tests/bug_61292.phpt A ext/pdo/tests/bug_65946.phpt Diff: diff --git a/ext/pdo/tests/bug47769.phpt b/ext/pdo/tests/bug47769.phpt deleted file mode 100644 index 3b2f1e8..0000000 --- a/ext/pdo/tests/bug47769.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -Bug #47769 (Strange extends PDO) ---SKIPIF-- -<?php -if (!extension_loaded("pdo_sqlite")) - die("skip: PDO_SQLite not available"); -?> ---FILE-- -<?php - -class test extends PDO -{ - protected function isProtected() { - echo "this is a protected method.\n"; - } - private function isPrivate() { - echo "this is a private method.\n"; - } - - public function quote($str, $paramtype = NULL) { - $this->isProtected(); - $this->isPrivate(); - print $str ."\n"; - } -} - -$test = new test('sqlite::memory:'); -$test->quote('foo'); -$test->isProtected(); - -?> ---EXPECTF-- -this is a protected method. -this is a private method. -foo - -Fatal error: Call to protected method test::isProtected() from context '' in %s on line %d diff --git a/ext/pdo/tests/bug61292.phpt b/ext/pdo/tests/bug61292.phpt deleted file mode 100644 index 05b2e9c..0000000 --- a/ext/pdo/tests/bug61292.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -Bug #61292 (Segfault while calling a method on an overloaded PDO object) ---SKIPIF-- -<?php -if (!extension_loaded('pdo')) die('skip'); -$dir = getenv('REDIR_TEST_DIR'); -if (false == $dir) die('skip no driver'); -require_once $dir . 'pdo_test.inc'; -PDOTest::skip(); -?> ---FILE-- -<?php -if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/'); -require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; - -class Database_SQL extends PDO -{ - function __construct() - { - $dsn = getenv('PDOTEST_DSN'); - $user = getenv('PDOTEST_USER'); - $pass = getenv('PDOTEST_PASS'); - - if ($user === false) $user = NULL; - if ($pass === false) $pass = NULL; - $options = array(PDO::ATTR_PERSISTENT => TRUE); - - parent::__construct($dsn, $user, $pass, $options); - } - - var $bar = array(); - - public function foo() - { - var_dump($this->bar); - } -} - -(new Database_SQL)->foo(); -?> ---EXPECTF-- -array(0) { -} diff --git a/ext/pdo/tests/bug65946.phpt b/ext/pdo/tests/bug65946.phpt deleted file mode 100644 index 1c4bd8d..0000000 --- a/ext/pdo/tests/bug65946.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -Bug #65946 (pdo_sql_parser.c permanently converts values bound to strings) ---SKIPIF-- -<?php -if (!extension_loaded('pdo')) die('skip'); -$dir = getenv('REDIR_TEST_DIR'); -if (false == $dir) die('skip no driver'); -require_once $dir . 'pdo_test.inc'; -PDOTest::skip(); -?> ---FILE-- -<?php -if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/'); -require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; -$db = PDOTest::factory(); -$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); -$db->exec('CREATE TABLE test(id int)'); -$db->exec('INSERT INTO test VALUES(1)'); -$stmt = $db->prepare('SELECT * FROM test LIMIT :limit'); -$stmt->bindValue('limit', 1, PDO::PARAM_INT); -if(!($res = $stmt->execute())) var_dump($stmt->errorInfo()); -if(!($res = $stmt->execute())) var_dump($stmt->errorInfo()); -var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); -?> ---EXPECTF-- -array(1) { - [0]=> - array(1) { - ["id"]=> - string(1) "1" - } -} diff --git a/ext/pdo/tests/bug_44159.phpt b/ext/pdo/tests/bug_44159..phpt index 9f1961c..4382fbd 100644 --- a/ext/pdo/tests/bug_44159.phpt +++ b/ext/pdo/tests/bug_44159.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #44159 (Crash: $pdo->setAttribute(PDO::STATEMENT_ATTR_CLASS, NULL)) +PDO Common: Bug #44159 (Crash: $pdo->setAttribute(PDO::STATEMENT_ATTR_CLASS, NULL)) --SKIPIF-- <?php # vim:ft=php if (!extension_loaded('pdo')) die('skip PDO not available'); diff --git a/ext/pdo/tests/bug_47769.phpt b/ext/pdo/tests/bug_47769.phpt new file mode 100644 index 0000000..482f060 --- /dev/null +++ b/ext/pdo/tests/bug_47769.phpt @@ -0,0 +1,37 @@ +--TEST-- +PDO Common: Bug #47769 (Strange extends PDO) +--SKIPIF-- +<?php +if (!extension_loaded("pdo_sqlite")) + die("skip: PDO_SQLite not available"); +?> +--FILE-- +<?php + +class test extends PDO +{ + protected function isProtected() { + echo "this is a protected method.\n"; + } + private function isPrivate() { + echo "this is a private method.\n"; + } + + public function quote($str, $paramtype = NULL) { + $this->isProtected(); + $this->isPrivate(); + print $str ."\n"; + } +} + +$test = new test('sqlite::memory:'); +$test->quote('foo'); +$test->isProtected(); + +?> +--EXPECTF-- +this is a protected method. +this is a private method. +foo + +Fatal error: Call to protected method test::isProtected() from context '' in %s on line %d diff --git a/ext/pdo/tests/bug_61292.phpt b/ext/pdo/tests/bug_61292.phpt new file mode 100644 index 0000000..0e41be3 --- /dev/null +++ b/ext/pdo/tests/bug_61292.phpt @@ -0,0 +1,43 @@ +--TEST-- +PDO Common: Bug #61292 (Segfault while calling a method on an overloaded PDO object) +--SKIPIF-- +<?php +if (!extension_loaded('pdo')) die('skip'); +$dir = getenv('REDIR_TEST_DIR'); +if (false == $dir) die('skip no driver'); +require_once $dir . 'pdo_test.inc'; +PDOTest::skip(); +?> +--FILE-- +<?php +if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/'); +require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; + +class Database_SQL extends PDO +{ + function __construct() + { + $dsn = getenv('PDOTEST_DSN'); + $user = getenv('PDOTEST_USER'); + $pass = getenv('PDOTEST_PASS'); + + if ($user === false) $user = NULL; + if ($pass === false) $pass = NULL; + $options = array(PDO::ATTR_PERSISTENT => TRUE); + + parent::__construct($dsn, $user, $pass, $options); + } + + var $bar = array(); + + public function foo() + { + var_dump($this->bar); + } +} + +(new Database_SQL)->foo(); +?> +--EXPECTF-- +array(0) { +} diff --git a/ext/pdo/tests/bug_65946.phpt b/ext/pdo/tests/bug_65946.phpt new file mode 100644 index 0000000..d538218 --- /dev/null +++ b/ext/pdo/tests/bug_65946.phpt @@ -0,0 +1,32 @@ +--TEST-- +PDO Common: Bug #65946 (pdo_sql_parser.c permanently converts values bound to strings) +--SKIPIF-- +<?php +if (!extension_loaded('pdo')) die('skip'); +$dir = getenv('REDIR_TEST_DIR'); +if (false == $dir) die('skip no driver'); +require_once $dir . 'pdo_test.inc'; +PDOTest::skip(); +?> +--FILE-- +<?php +if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../.../pdo/tests/'); +require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; +$db = PDOTest::factory(); +$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); +$db->exec('CREATE TABLE test(id int)'); +$db->exec('INSERT INTO test VALUES(1)'); +$stmt = $db->prepare('SELECT * FROM test LIMIT :limit'); +$stmt->bindValue('limit', 1, PDO::PARAM_INT); +if(!($res = $stmt->execute())) var_dump($stmt->errorInfo()); +if(!($res = $stmt->execute())) var_dump($stmt->errorInfo()); +var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); +?> +--EXPECTF-- +array(1) { + [0]=> + array(1) { + ["id"]=> + string(1) "1" + } +}

« previous php.cvs (#91599) next »