From: Raphaël Barrois Date: Fri, 7 May 2010 11:33:50 +0000 (+0200) Subject: Add UTs for UFC_Death X-Git-Tag: xorg/1.0.0~266 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=842c2042d0c045320e1103a46f6af1f446049651;p=platal.git Add UTs for UFC_Death Signed-off-by: Raphaël Barrois --- diff --git a/ut/userfiltertest.php b/ut/userfiltertest.php index efd42bb..b91cfd6 100644 --- a/ut/userfiltertest.php +++ b/ut/userfiltertest.php @@ -456,6 +456,28 @@ class UserFilterTest extends PlTestCase new UFC_Nationality('__'), 0), ); + /* UFC_Dead + */ + $tests[] = array( + array(self::buildProfileQuery('WHERE p.deathdate IS NOT NULL'), + 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), + ); $testcases = array(); foreach ($tests as $t) {