<?php
require_once ('unit_tester.php');
require_once ('reporter.php');
require_once ('../config.php');
require_once ('../source\modules\user\user_api.func.php');
require_once ('../source/base_model.class.php');
Class registertest extends UnitTestCase{
public function testAssertEqual(){
$base = new base_model();
$_ENV['base'] = $base;
$base->db->query("delete from uc_members where uid is not null");
$base->db->query("alter table uc_members AUTO_INCREMENT=1");
//testcase1
$this->assertEqual(1,$num=api_user_register("123","12","1234@12.cn"),"register success so ,expect result 1,reality:".$num.",line 15");
//testcase1
//testcase2
$this->assertEqual(-1,$num=api_user_register("12","321","1234@12.cn"),"register failed because of length of username fewer than 3 ,expect result -1,reality:".$num.",line 18");
//testcase2
//testcase3
$base->db->query("delete from uc_badwords");
$base->db->query("insert into uc_badwords(find,findpattern) values('²Ý','/²Ý/is')");
$this->assertEqual(-2,$num=api_user_register("3²Ýf","232s","sdasx@fs.com"),"api_user_register(3²Ýf,232s,sdasx@fs.com) ,register failed because of content bad words in it ,expect result -2,reality:".$num.",line 23");
//testcase3
//testcase4
$this->assertEqual(-1,$num=api_user_register("#@","dsx","sdxzc@fs.com"),"register failed because of unexpect symbols in username ,expect result -1,reality:".$num.",line 26");
//testcase4
//testcase5
$this->assertEqual(-1,$num=api_user_register(" Guest","098","sd78a@dscx.net"),"register failed becase of username content unexpected words as Guest ,expect result -1,reality:".$num.",line 28");
//testcase5
//testcase6
$this->assertEqual(-1,$num=api_user_register("sdads78778z23ws1","9890s","sd xa@83.com"),"register failed because of length of username more than 15 ,expect result -1,reality:".$num.",line 31");
//testcase6
//testcase7
$num=$base->db->result_first("select max(uid) from uc_members");
Ç¿´ó¶øÇÒÃâ·ÑµÄ zend studio Ê×µ±Æä³å£¬¿Éϧ±¾ÈË»úÆ÷ÅäÖò»¸ß£¬ÔËÐÐÆðÀ´Ê®·Ö³ÔÁ¦£¬ÓÃûÁ½´ÎÌ«ÊÜ×ï¾Í·ÅÆúÁË¡£
PHPEdit£¬¶ÌС¾«º·£¬¿ÉÏÞʱÊÔÓ㬸оõÒ»°ã¡£
PHPDesigner ÕýÔÚÓ㬻¹ÊÇ¿ÉÒÔÒ»ÊÔ£¬ÍøÉϵÄ×¢²á»ú³öµÄÒ²Ï൱¼°Ê±¡£ 0.0
´¿Îı¾±à¼ Editplus »¹Êdz£±¸¹¤¾ß¡£ ......
¡¡¡¡Ã¿´ÎÎÒÃÇ·ÃÎÊ PHP ½Å±¾µÄʱºò£¬¶¼Êǵ±ËùÓеÄPHP½Å±¾Ö´ÐÐÍê³Éºó£¬ÎÒÃDzŵõ½·µ»Ø½á¹û¡£Èç¹ûÎÒÃÇÐèÒªÒ»¸ö½Å±¾³ÖÐøµÄÔËÐУ¬ÄÇôÎÒÃǾÍҪͨ¹ý PHP ³¤Á¬½ÓµÄ·½Ê½£¬À´´ïµ½ÔËÐÐÄ¿µÄ¡£
¡¡¡¡Ã¿¸ö PHP ½Å±¾¶¼ÏÞÖÆÁËÖ´ÐÐʱ¼ä£¬ËùÒÔÎÒÃÇÐèҪͨ¹ý set_time_limit À´ÉèÖÃÒ»¸ö½Å±¾µÄÖ´ÐÐʱ¼äΪÎÞÏÞ³¤£»È»ºóʹÓà flush() ºÍ ob_flush() ......