1--TEST-- 2PDO_mysql getWarningCount 3--EXTENSIONS-- 4pdo_mysql 5--SKIPIF-- 6<?php 7require_once __DIR__ . '/inc/mysql_pdo_test.inc'; 8MySQLPDOTest::skip(); 9?> 10--FILE-- 11<?php 12 13require_once __DIR__ . '/inc/mysql_pdo_test.inc'; 14 15$db = Pdo::connect(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_USER, PDO_MYSQL_TEST_PASS); 16if (!$db instanceof Pdo\Mysql) { 17 echo "Wrong class type. Should be Pdo\Mysql but is " . get_class($db) . "\n"; 18} 19 20$assertWarnings = function ($db, $q, $count) { 21 $db->query($q); 22 printf("Query %s produced %d warnings\n", $q, $db->getWarningCount()); 23}; 24$assertWarnings($db, 'SELECT 1 = 1', 0); 25$assertWarnings($db, 'SELECT 1 = "A"', 1); 26 27--EXPECT-- 28Query SELECT 1 = 1 produced 0 warnings 29Query SELECT 1 = "A" produced 1 warnings 30