From 842c2042d0c045320e1103a46f6af1f446049651 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Barrois?= Date: Fri, 7 May 2010 13:33:50 +0200 Subject: [PATCH] Add UTs for UFC_Death MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Barrois --- ut/userfiltertest.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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) { -- 2.1.4