From: Raphaël Barrois Date: Fri, 7 May 2010 14:14:36 +0000 (+0200) Subject: Add uts for UFC_Registered X-Git-Tag: xorg/1.0.0~261 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=0d49fd8b92774934368ddc1600ea7bf58da183d1;p=platal.git Add uts for UFC_Registered Signed-off-by: Raphaël Barrois --- diff --git a/ut/userfiltertest.php b/ut/userfiltertest.php index b91cfd6..e953ce5 100644 --- a/ut/userfiltertest.php +++ b/ut/userfiltertest.php @@ -463,20 +463,31 @@ class UserFilterTest extends PlTestCase new UFC_Dead(), -1), array(self::buildProfileQuery('WHERE p.deathdate IS NOT NULL AND p.deathdate > {?}', '2008-01-01'), new UFC_Dead('>', '2008-01-01'), -1), - array(self::buildProfileQuery('WHERE p.deathdate IS NOT NULL AND p.deathdate > {?}', '2008-01-01'), - new UFC_Dead('>', new DateTime('2008-01-01')), -1), - array(self::buildProfileQuery('WHERE p.deathdate IS NOT NULL AND p.deathdate > {?}', '2008-01-01'), - new UFC_Dead('>', strftime('2008-01-01')), -1), array(self::buildProfileQuery('WHERE p.deathdate IS NOT NULL AND p.deathdate < {?}', '1600-01-01'), new UFC_Dead('<', '1600-01-01'), 0), - array(self::buildProfileQuery('WHERE p.deathdate IS NOT NULL AND p.deathdate < {?}', '1600-01-01'), - new UFC_Dead('<', new DateTime('1600-01-01')), 0), array(self::buildProfileQuery('WHERE p.deathdate IS NOT NULL AND p.deathdate > {?}', date('Y-m-d')), new UFC_Dead('>', 'now'), 0), - array(self::buildProfileQuery('WHERE p.deathdate IS NOT NULL AND p.deathdate > {?}', date('Y-m-d')), - new UFC_Dead('>', new DateTime()), 0), - array(self::buildProfileQuery('WHERE p.deathdate IS NOT NULL AND p.deathdate > {?}', date('Y-m-d')), - new UFC_Dead('>', time()), 0), + ); + + /* UFC_Registered + */ + $tests[] = array( + array(self::buildAccountQuery('WHERE a.uid IS NOT NULL AND a.state = \'active\''), + new UFC_Registered(true), -1), + array(self::buildAccountQuery('WHERE a.uid IS NOT NULL AND a.state != \'pending\''), + new UFC_Registered(), -1), + array(self::buildAccountQuery('WHERE a.uid IS NOT NULL AND a.state = \'active\' AND a.registration_date != \'0000-00-00 00:00:00\' AND a.registration_date > {?}', '2008-01-01'), + new UFC_Registered(true, '>', '2008-01-01'), -1), + array(self::buildAccountQuery('WHERE a.uid IS NOT NULL AND a.state != \'pending\' AND a.registration_date != \'0000-00-00 00:00:00\' AND a.registration_date > {?}', '2008-01-01'), + new UFC_Registered(false, '>', '2008-01-01'), -1), + array(self::buildAccountQuery('WHERE a.uid IS NOT NULL AND a.state = \'active\' AND a.registration_date != \'0000-00-00 00:00:00\' AND a.registration_date < {?}', '1700-01-01'), + new UFC_Registered(true, '<', '1700-01-01'), 0), + array(self::buildAccountQuery('WHERE a.uid IS NOT NULL AND a.state != \'pending\' AND a.registration_date != \'0000-00-00 00:00:00\' AND a.registration_date < {?}', '1700-01-01'), + new UFC_Registered(false, '<', '1700-01-01'), 0), + array(self::buildAccountQuery('WHERE a.uid IS NOT NULL AND a.state = \'active\' AND a.registration_date != \'0000-00-00 00:00:00\' AND a.registration_date > {?}', date('Y-m-d')), + new UFC_Registered(true, '>', 'now'), 0), + array(self::buildAccountQuery('WHERE a.uid IS NOT NULL AND a.state != \'pending\' AND a.registration_date != \'0000-00-00 00:00:00\' AND a.registration_date > {?}', date('Y-m-d')), + new UFC_Registered(false, '>', 'now'), 0), ); $testcases = array();