Skip to content

Add clean to MySQL tests #6756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions ext/mysqli/tests/bug66124.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
$table_drop = "DROP TABLE IF EXISTS `bug66124`";
$table_create = "CREATE TABLE `bug66124` (
$table_drop = "DROP TABLE IF EXISTS `test`";
$table_create = "CREATE TABLE `test` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8";

$table_insert = "INSERT INTO `bug66124` SET `id`=?";
$table_select = "SELECT * FROM `bug66124`";
$table_delete = "DELETE FROM `bug66124`";
$table_insert = "INSERT INTO `test` SET `id`=?";
$table_select = "SELECT * FROM `test`";
$table_delete = "DELETE FROM `test`";
$id = '1311200011005001566';


Expand Down Expand Up @@ -91,6 +91,10 @@ if ($result){
$link->close();
?>
done
--CLEAN--
<?php
require_once "clean_table.inc";
?>
--EXPECT--
Using 'i':
insert id:1311200011005001566=>1311200011005001566
Expand Down
6 changes: 5 additions & 1 deletion ext/mysqli/tests/bug75018.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require_once("connect.inc");

$mysqli = new mysqli("$host:$port", $user, $passwd, $db);

$tbl = "test_bug75018";
$tbl = "test";
$sql = "DROP TABLE IF EXISTS $tbl";
$mysqli->query($sql);

Expand All @@ -30,6 +30,10 @@ while ($row = $result->fetch_assoc()) {
var_dump($row['bit_column_1']);
}

?>
--CLEAN--
<?php
require_once "clean_table.inc";
?>
--EXPECT--
string(1) "0"
Expand Down
12 changes: 8 additions & 4 deletions ext/mysqli/tests/bug77597.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ if (!defined('MYSQLI_STORE_RESULT_COPY_DATA')) die('skip requires mysqlnd');
require_once("connect.inc");
$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);

$mysqli->query('DROP TABLE IF EXISTS a');
$mysqli->query('CREATE TABLE a (b int)');
$mysqli->query('INSERT INTO a VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9)');
$mysqli->query('DROP TABLE IF EXISTS test');
$mysqli->query('CREATE TABLE test (b int)');
$mysqli->query('INSERT INTO test VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9)');

$mysqli->real_query("SELECT * FROM a");
$mysqli->real_query("SELECT * FROM test");

$result = $mysqli->store_result(MYSQLI_STORE_RESULT_COPY_DATA);

$field = $result->fetch_field();
var_dump($field->name);

?>
--CLEAN--
<?php
require_once "clean_table.inc";
?>
--EXPECT--
string(1) "b"
7 changes: 7 additions & 0 deletions ext/mysqli/tests/bug77935.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ while ($row = $result->fetch_assoc()) {
var_dump($row);
}

?>
--CLEAN--
<?php
require_once 'connect.inc';
$link = new mysqli($host, $user, $passwd, $db, $port, $socket);
$link->query('DROP PROCEDURE IF EXISTS testSp');
$link->close();
?>
--EXPECT--
array(1) {
Expand Down
4 changes: 2 additions & 2 deletions ext/mysqli/tests/connect.inc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
if (!function_exists('my_mysqli_connect')) {

/**
* Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
* Whenever possible, please use this wrapper to make testing of MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
*
* @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS)?
*/
Expand All @@ -71,7 +71,7 @@
}

/**
* Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
* Whenever possible, please use this wrapper to make testing of MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
*
* @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS)
*/
Expand Down
7 changes: 7 additions & 0 deletions ext/mysqli/tests/mysqli_insert_packet_overflow.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,12 @@ memory_limit=256M

print "done!";
?>
--CLEAN--
<?php
require_once 'connect.inc';
$link = new mysqli($host, $user, $passwd, $db, $port, $socket);
$link->query('DROP TABLE test__mysqli_insert_packet_overflow');
$link->close();
?>
--EXPECT--
done!
8 changes: 8 additions & 0 deletions ext/mysqli/tests/mysqli_query_unicode.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ mysqli_close($link);

print "done!";
?>
--CLEAN--
<?php
require_once 'connect.inc';
$link = new mysqli($host, $user, $passwd, $db, $port, $socket);
$link->query('DROP PROCEDURE IF EXISTS процедурка');
$link->query('DROP FUNCTION IF EXISTS функцийка');
$link->close();
?>
--EXPECTF--
array(1) {
["правилен"]=>
Expand Down
8 changes: 4 additions & 4 deletions ext/mysqli/tests/mysqli_stmt_multires.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ require_once('skipifconnectfailure.inc');
?>
--CLEAN--
<?php
require_once("connect.inc");
if (!$link->query('DROP PROCEDURE IF EXISTS p123')) {
printf("[001] [%d] %s\n", $link->error, $link->errno);
}
require_once 'connect.inc';
$link = new mysqli($host, $user, $passwd, $db, $port, $socket);
$link->query('DROP PROCEDURE IF EXISTS p123');
$link->close();
?>
--EXPECT--
string(4) "pre:"
Expand Down
7 changes: 7 additions & 0 deletions ext/mysqli/tests/ps_cursor_multiple_result_sets.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ while ($row = $result->fetch_assoc()) {
}
$stmt->next_result();

?>
--CLEAN--
<?php
require_once 'connect.inc';
$link = new mysqli($host, $user, $passwd, $db, $port, $socket);
$link->query('DROP PROCEDURE IF EXISTS testPs');
$link->close();
?>
--EXPECT--
use_result:
Expand Down
6 changes: 6 additions & 0 deletions ext/pdo_mysql/tests/bug63185.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ try {
}
var_dump($st->fetchAll());

?>
--CLEAN--
<?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc';
$pdo = MySQLPDOTest::factory();
$pdo->query('DROP PROCEDURE IF EXISTS test_procedure_error_at_second');
?>
--EXPECTF--
array(1) {
Expand Down
7 changes: 6 additions & 1 deletion ext/pdo_mysql/tests/bug75177.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if (!MySQLPDOTest::isPDOMySQLnd()) die('skip only for mysqlnd');
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
$pdo = MySQLPDOTest::factory();

$tbl = "tbl_bug75177";
$tbl = "test";
$pdo->query("DROP TABLE IF EXISTS $tbl");
$pdo->query("CREATE TABLE $tbl (`bit` bit(8)) ENGINE=InnoDB");
$pdo->query("INSERT INTO $tbl (`bit`) VALUES (1)");
Expand All @@ -31,6 +31,11 @@ foreach ($ret as $i) {
var_dump($i["bit"]);
}

?>
--CLEAN--
<?php
require dirname(__FILE__) . '/mysql_pdo_test.inc';
MySQLPDOTest::dropTestTable();
?>
--EXPECT--
int(1)
Expand Down
7 changes: 7 additions & 0 deletions ext/pdo_mysql/tests/bug76815.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ try {
unset($st);
echo "Ok.\n";

?>
--CLEAN--
<?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc';
$pdo = MySQLPDOTest::factory();
$pdo->query('DROP FUNCTION IF EXISTS tst');
$pdo->query('DROP PROCEDURE IF EXISTS tst2');
?>
--EXPECT--
SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'tst()' at row 1
Expand Down
6 changes: 6 additions & 0 deletions ext/pdo_mysql/tests/bug_41997.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
var_dump($stmt->errorInfo());
print "done!";
?>
--CLEAN--
<?php
require_once __DIR__ . '/mysql_pdo_test.inc';
$db = MySQLPDOTest::factory();
$db->exec("DROP PROCEDURE IF EXISTS p");
?>
--EXPECT--
array(1) {
[0]=>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,11 @@ if ($version < 50000)

print "done!";
?>
--CLEAN--
<?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc';
$pdo = MySQLPDOTest::factory();
$pdo->query('DROP PROCEDURE IF EXISTS p');
?>
--EXPECT--
done!