add some casual tests

This commit is contained in:
printempw 2016-07-24 11:13:41 +08:00
parent f2c1c4a851
commit ef227b1045
2 changed files with 55 additions and 1 deletions

View File

@ -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',

53
tests/migration.php Normal file
View File

@ -0,0 +1,53 @@
<?php
/**
* @Author: printempw
* @Date: 2016-07-24 11:11:30
* @Last Modified by: printempw
* @Last Modified time: 2016-07-24 11:11:44
*/
$db = new \Database('users2');
$sql = "SELECT * FROM `users2` ORDER BY `uid` LIMIT 7250, 1000";
$result = $db->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. <br />";
}
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. <br />";
}
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. <br />";
}
}
exit;