From 0d49fd8b92774934368ddc1600ea7bf58da183d1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Barrois?= Date: Fri, 7 May 2010 16:14:36 +0200 Subject: [PATCH] Add uts for UFC_Registered MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Barrois --- ut/userfiltertest.php | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) 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(); -- 2.1.4