From 01df65b50f91040bab6387a7e06ce8b9420f19c8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Barrois?= Date: Wed, 28 Apr 2010 20:52:43 +0200 Subject: [PATCH] Add tests for UFC_EducationField MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Todo: update database so that this tests have a meaning... fields are empty for all but 28 profiles ! Signed-off-by: Raphaël Barrois --- ut/userfiltertest.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ut/userfiltertest.php b/ut/userfiltertest.php index bf15f30..7142fc5 100644 --- a/ut/userfiltertest.php +++ b/ut/userfiltertest.php @@ -276,6 +276,29 @@ class UserFilterTest extends PlTestCase WHERE pede.abbreviation IN {?}', array('Ing.', 'PhD')), new UFC_EducationDegree(array($id_DegreeIng, $id_DegreePhd)), -1), ); + /* UFC_EducationField + */ + $id_FieldInfo = XDB::fetchOneCell('SELECT id + FROM profile_education_field_enum + WHERE field = {?}', 'Informatique'); + $id_FieldDroit = XDB::fetchOneCell('SELECT id + FROM profile_education_field_enum + WHERE field = {?}', 'Droit'); + // FIXME: Replaces 0 by -1 in following queries when profile_education will be filled with fieldids + $tests[] = array( + array(XDB::format('SELECT DISTINCT ap.uid + FROM account_profiles AS ap + INNER JOIN profile_education AS pe ON (pe.pid = ap.pid AND FIND_IN_SET(\'owner\', ap.perms)) + LEFT JOIN profile_education_field_enum AS pefe ON (pe.fieldid = pefe.id) + WHERE pefe.field = {?}', 'Informatique'), + new UFC_EducationField($id_FieldInfo), 0), // FIXME: should be -1 + array(XDB::format('SELECT DISTINCT ap.uid + FROM account_profiles AS ap + INNER JOIN profile_education AS pe ON (pe.pid = ap.pid AND FIND_IN_SET(\'owner\', ap.perms)) + LEFT JOIN profile_education_field_enum AS pefe ON (pe.fieldid = pefe.id) + WHERE pefe.field IN {?}', array('Informatique', 'Droit')), + new UFC_EducationField(array($id_FieldInfo, $id_FieldDroit)), 0), // FIXME: should be -1 + ); $testcases = array(); foreach ($tests as $t) { -- 2.1.4