Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ifsnop authored Feb 6, 2018
2 parents 7dcebe1 + f8f609a commit 96adecd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dist: trusty
sudo: required
group: deprecated-2017Q4

language: php

Expand Down Expand Up @@ -37,5 +38,6 @@ before_script:
- tests/create_users.sh

script:
- php -l src/Ifsnop/Mysqldump/Mysqldump.php
- php src/Ifsnop/Mysqldump/Mysqldump.php
- cd tests && ./test.sh
2 changes: 0 additions & 2 deletions src/Ifsnop/Mysqldump/Mysqldump.php
Original file line number Diff line number Diff line change
Expand Up @@ -1845,9 +1845,7 @@ public function parseColumnType($colType)
}
$colInfo['is_numeric'] = in_array($colInfo['type'], $this->mysqlTypes['numerical']);
$colInfo['is_blob'] = in_array($colInfo['type'], $this->mysqlTypes['blob']);
// for virtual 'Extra' -> "STORED GENERATED"
$colInfo['is_virtual'] = strpos($colType['Extra'], "STORED GENERATED") === false ? false : true;

return $colInfo;
}

Expand Down
21 changes: 20 additions & 1 deletion tests/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,23 @@
'where' => ''
);

// do nothing test
print "starting mysql-php_test000.sql" . PHP_EOL;
$dump = new IMysqldump\Mysqldump(
"mysql:host=localhost;dbname=test001",
"travis",
""
);

print "starting mysql-php_test001.sql" . PHP_EOL;
$dump = new IMysqldump\Mysqldump(
"mysql:host=localhost;dbname=test001",
"travis",
"",
$dumpSettings);
$dump->start("mysqldump-php_test001.sql");

print "starting mysql-php_test002.sql" . PHP_EOL;
$dumpSettings['default-character-set'] = IMysqldump\Mysqldump::UTF8MB4;
$dumpSettings['complete-insert'] = true;
$dump = new IMysqldump\Mysqldump(
Expand All @@ -47,6 +57,7 @@
$dumpSettings);
$dump->start("mysqldump-php_test002.sql");

print "starting mysql-php_test005.sql" . PHP_EOL;
$dumpSettings['complete-insert'] = false;
$dump = new IMysqldump\Mysqldump(
"mysql:unix_socket=/var/run/mysqld/mysqld.sock;dbname=test005",
Expand All @@ -55,55 +66,63 @@
$dumpSettings);
$dump->start("mysqldump-php_test005.sql");

print "starting mysql-php_test006.sql" . PHP_EOL;
$dump = new IMysqldump\Mysqldump(
"mysql:unix_socket=/var/run/mysqld/mysqld.sock;dbname=test006a",
"travis",
"",
array("no-data" => true, "add-drop-table" => true));
$dump->start("mysqldump-php_test006.sql");

print "starting mysql-php_test008.sql" . PHP_EOL;
$dump = new IMysqldump\Mysqldump(
"mysql:unix_socket=/var/run/mysqld/mysqld.sock;dbname=test008",
"travis",
"",
array("no-data" => true, "add-drop-table" => true));
$dump->start("mysqldump-php_test008.sql");

print "starting mysql-php_test009.sql" . PHP_EOL;
$dump = new IMysqldump\Mysqldump(
"mysql:unix_socket=/var/run/mysqld/mysqld.sock;dbname=test009",
"travis",
"",
array("no-data" => true, "add-drop-table" => true, "reset-auto-increment" => true, "add-drop-database" => true));
$dump->start("mysqldump-php_test009.sql");

print "starting mysql-php_test010.sql" . PHP_EOL;
$dump = new IMysqldump\Mysqldump(
"mysql:unix_socket=/var/run/mysqld/mysqld.sock;dbname=test010",
"travis",
"",
array("events" => true));
$dump->start("mysqldump-php_test010.sql");

print "starting mysql-php_test011a.sql" . PHP_EOL;
$dump = new IMysqldump\Mysqldump(
"mysql:unix_socket=/var/run/mysqld/mysqld.sock;dbname=test011",
"travis",
"",
array('complete-insert' => false));
$dump->start("mysqldump-php_test011a.sql");

print "starting mysql-php_test011b.sql" . PHP_EOL;
$dump = new IMysqldump\Mysqldump(
"mysql:unix_socket=/var/run/mysqld/mysqld.sock;dbname=test011",
"travis",
"",
array('complete-insert' => true));
$dump->start("mysqldump-php_test011b.sql");

print "starting mysql-php_test012.sql" . PHP_EOL;
$dump = new IMysqldump\Mysqldump(
"mysql:unix_socket=/var/run/mysqld/mysqld.sock;dbname=test012",
"travis",
"",
array("events" => true));
$dump->start("mysqldump-php_test012.sql");

print "starting mysql-php_test012b_no-definer.sql" . PHP_EOL;
$dump = new IMysqldump\Mysqldump(
"mysql:unix_socket=/var/run/mysqld/mysqld.sock;dbname=test012",
"travis",
Expand All @@ -114,4 +133,4 @@
));
$dump->start("mysqldump-php_test012_no-definer.sql");

exit;
exit(0);
4 changes: 2 additions & 2 deletions tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ mysqldump -utravis test012 \
> mysqldump_test012.sql
ret[((index++))]=$?

php test.php
php test.php || { echo "ERROR running test.php" && exit -1; }
ret[((index++))]=$?

mysql -utravis test001 < mysqldump-php_test001.sql
Expand Down Expand Up @@ -147,7 +147,7 @@ ret[((index++))]=$?
diff mysqldump_test012.filtered.sql mysqldump-php_test012.filtered.sql
ret[((index++))]=$?

# Make sure we do not fine a DEFINER
# Make sure we do not find a DEFINER
! grep 'DEFINER' mysqldump-php_test012_no-definer.sql
ret[((index++))]=$?

Expand Down

0 comments on commit 96adecd

Please sign in to comment.