From ef227b10454c3462a84e3eb0c02e80f80a4eb648 Mon Sep 17 00:00:00 2001 From: printempw Date: Sun, 24 Jul 2016 11:13:41 +0800 Subject: [PATCH] add some casual tests --- gulpfile.js | 3 ++- tests/migration.php | 53 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 tests/migration.php diff --git a/gulpfile.js b/gulpfile.js index 010611a5..ff55f8a3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2,7 +2,7 @@ * @Author: prpr * @Date: 2016-07-21 13:38:26 * @Last Modified by: printempw -* @Last Modified time: 2016-07-23 16:22:46 +* @Last Modified time: 2016-07-24 11:13:23 */ var gulp = require('gulp'), @@ -159,6 +159,7 @@ gulp.task('zip', function() { return gulp.src([ '**/*.*', + '!tests/**/*.*', '!node_modules/**/*.*', '!textures/**/*.*', '!.env', diff --git a/tests/migration.php b/tests/migration.php new file mode 100644 index 00000000..0c417320 --- /dev/null +++ b/tests/migration.php @@ -0,0 +1,53 @@ +query($sql); +while ($row = $result->fetch_array()) { + if ($row['hash_steve'] != "") { + $t = new Models\Texture(); + $t->name = $row['username']."-steve"; + $t->type = "steve"; + $t->hash = $row['hash_steve']; + $t->size = 0; + $t->uploader = 0; + $t->public = "1"; + $t->upload_at = \Utils::getTimeFormatted(); + $t->save(); + echo $row['hash_steve']." saved.
"; + } + + if ($row['hash_alex'] != "") { + $t = new Models\Texture(); + $t->name = $row['username']."-alex"; + $t->type = "alex"; + $t->hash = $row['hash_alex']; + $t->size = 0; + $t->uploader = 0; + $t->public = "1"; + $t->upload_at = \Utils::getTimeFormatted(); + $t->save(); + echo $row['hash_alex']." saved.
"; + } + + if ($row['hash_cape'] != "") { + $t = new Models\Texture(); + $t->name = $row['username']."-cape"; + $t->type = "cape"; + $t->hash = $row['hash_cape']; + $t->size = 0; + $t->uploader = 0; + $t->public = "1"; + $t->upload_at = \Utils::getTimeFormatted(); + $t->save(); + echo $row['hash_cape']." saved.
"; + } +} + +exit;