From 395401590f8360d14266b98980deaee6938b791c Mon Sep 17 00:00:00 2001 From: Ana Rute Mendes Date: Tue, 10 Aug 2021 11:23:25 -0300 Subject: [PATCH 1/7] Remove test folder and create tests Tests is more used and intuitive since it stores all the tests not just one. Also the existing test files weren't working and only had tests for getters and setters (probably auto generated tests). --- .../ExtraHoursReportActionLargeTest.php | 42 - .../ExtraHoursReportActionMediumTest.php | 42 - .../ExtraHoursReportActionSmallTest.php | 35 - .../ExtraHoursReportActionTest.php | 87 -- .../ExtraHoursReportActionVerySmallTest.php | 35 - test/FacadeTests/oldExtraHours.php | 146 --- test/PHPReportExtraHoursReportActionSuite.php | 44 - test/PHPReportGeneralSuite.php | 40 - test/PHPReportPostgreDAOBasicSuite.php | 78 -- test/PHPReportPostgreDAOMultipleSuite.php | 46 - test/PHPReportPostgreSuite.php | 40 - test/PHPReportVOSuite.php | 90 -- .../PostgreSQLAreaDAOBasicTests.php | 186 --- .../PostgreSQLAreaHistoryDAOBasicTests.php | 507 -------- .../PostgreSQLCityDAOBasicTests.php | 186 --- .../PostgreSQLCityHistoryDAOBasicTests.php | 506 -------- .../PostgreSQLCommonEventDAOBasicTests.php | 245 ---- .../PostgreSQLConfigDAOBasicTests.php | 40 - .../PostgreSQLCustomEventDAOBasicTests.php | 256 ---- .../PostgreSQLCustomerDAOBasicTests.php | 249 ---- .../PostgreSQLExtraHourDAOBasicTests.php | 277 ----- ...PostgreSQLHourCostHistoryDAOBasicTests.php | 429 ------- .../PostgreSQLIterationDAOBasicTests.php | 249 ---- .../PostgreSQLJourneyHistoryDAOBasicTests.php | 429 ------- .../PostgreSQLModuleDAOBasicTests.php | 249 ---- .../PostgreSQLProjectDAOBasicTests.php | 279 ----- .../PostgreSQLSectionDAOBasicTests.php | 277 ----- .../PostgreSQLSectorDAOBasicTests.php | 186 --- .../PostgreSQLStoryDAOBasicTests.php | 276 ----- .../PostgreSQLTaskDAOBasicTests.php | 1096 ----------------- .../PostgreSQLTaskSectionDAOBasicTests.php | 335 ----- .../PostgreSQLTaskStoryDAOBasicTests.php | 504 -------- .../PostgreSQLUserDAOBasicTests.php | 241 ---- .../PostgreSQLUserGroupDAOBasicTests.php | 197 --- ...greSQLBelongsRelationshipMultipleTests.php | 302 ----- ...tgreSQLProjectScheduleDAOMultipleTests.php | 322 ----- ...QLProjectUserRelationshipMultipleTests.php | 246 ---- ...stgreSQLWorksRelationshipMultipleTests.php | 246 ---- test/VOTests/AreaHistoryVOTests.php | 109 -- test/VOTests/AreaVOTests.php | 70 -- test/VOTests/CityHistoryVOTests.php | 109 -- test/VOTests/CityVOTests.php | 70 -- test/VOTests/CommonEventVOTests.php | 83 -- test/VOTests/CustomEventVOTests.php | 109 -- test/VOTests/CustomProjectVOTests.php | 274 ----- test/VOTests/CustomSectionVOTests.php | 219 ---- test/VOTests/CustomStoryVOTests.php | 219 ---- test/VOTests/CustomTaskSectionVOTests.php | 172 --- test/VOTests/CustomTaskStoryVOTests.php | 230 ---- test/VOTests/CustomerVOTests.php | 109 -- test/VOTests/ExtraHourVOTests.php | 96 -- test/VOTests/HourCostHistoryVOTests.php | 109 -- test/VOTests/IterationVOTests.php | 122 -- test/VOTests/JourneyHistoryVOTests.php | 109 -- test/VOTests/ModuleVOTests.php | 122 -- test/VOTests/ProjectScheduleVOTests.php | 148 --- test/VOTests/ProjectVOTests.php | 187 --- test/VOTests/SectionVOTests.php | 122 -- test/VOTests/SectorVOTests.php | 70 -- test/VOTests/StoryVOTests.php | 122 -- test/VOTests/TaskSectionVOTests.php | 122 -- test/VOTests/TaskStoryVOTests.php | 187 --- test/VOTests/TaskVOTests.php | 187 --- test/VOTests/UserGroupVOTests.php | 70 -- test/VOTests/UserVOTests.php | 100 -- 65 files changed, 12686 deletions(-) delete mode 100644 test/FacadeTests/ExtraHoursReportActionLargeTest.php delete mode 100644 test/FacadeTests/ExtraHoursReportActionMediumTest.php delete mode 100644 test/FacadeTests/ExtraHoursReportActionSmallTest.php delete mode 100644 test/FacadeTests/ExtraHoursReportActionTest.php delete mode 100644 test/FacadeTests/ExtraHoursReportActionVerySmallTest.php delete mode 100644 test/FacadeTests/oldExtraHours.php delete mode 100644 test/PHPReportExtraHoursReportActionSuite.php delete mode 100644 test/PHPReportGeneralSuite.php delete mode 100644 test/PHPReportPostgreDAOBasicSuite.php delete mode 100644 test/PHPReportPostgreDAOMultipleSuite.php delete mode 100644 test/PHPReportPostgreSuite.php delete mode 100644 test/PHPReportVOSuite.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLAreaDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLAreaHistoryDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLCityDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLCityHistoryDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLCommonEventDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLConfigDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLCustomEventDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLCustomerDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLExtraHourDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLHourCostHistoryDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLIterationDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLJourneyHistoryDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLModuleDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLProjectDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLSectionDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLSectorDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLStoryDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLTaskDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLTaskSectionDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLTaskStoryDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLUserDAOBasicTests.php delete mode 100644 test/PostgreDAOBasicTests/PostgreSQLUserGroupDAOBasicTests.php delete mode 100644 test/PostgreDAOMultipleTests/PostgreSQLBelongsRelationshipMultipleTests.php delete mode 100644 test/PostgreDAOMultipleTests/PostgreSQLProjectScheduleDAOMultipleTests.php delete mode 100644 test/PostgreDAOMultipleTests/PostgreSQLProjectUserRelationshipMultipleTests.php delete mode 100644 test/PostgreDAOMultipleTests/PostgreSQLWorksRelationshipMultipleTests.php delete mode 100644 test/VOTests/AreaHistoryVOTests.php delete mode 100644 test/VOTests/AreaVOTests.php delete mode 100644 test/VOTests/CityHistoryVOTests.php delete mode 100644 test/VOTests/CityVOTests.php delete mode 100644 test/VOTests/CommonEventVOTests.php delete mode 100644 test/VOTests/CustomEventVOTests.php delete mode 100644 test/VOTests/CustomProjectVOTests.php delete mode 100644 test/VOTests/CustomSectionVOTests.php delete mode 100644 test/VOTests/CustomStoryVOTests.php delete mode 100644 test/VOTests/CustomTaskSectionVOTests.php delete mode 100644 test/VOTests/CustomTaskStoryVOTests.php delete mode 100644 test/VOTests/CustomerVOTests.php delete mode 100644 test/VOTests/ExtraHourVOTests.php delete mode 100644 test/VOTests/HourCostHistoryVOTests.php delete mode 100644 test/VOTests/IterationVOTests.php delete mode 100644 test/VOTests/JourneyHistoryVOTests.php delete mode 100644 test/VOTests/ModuleVOTests.php delete mode 100644 test/VOTests/ProjectScheduleVOTests.php delete mode 100644 test/VOTests/ProjectVOTests.php delete mode 100644 test/VOTests/SectionVOTests.php delete mode 100644 test/VOTests/SectorVOTests.php delete mode 100644 test/VOTests/StoryVOTests.php delete mode 100644 test/VOTests/TaskSectionVOTests.php delete mode 100644 test/VOTests/TaskStoryVOTests.php delete mode 100644 test/VOTests/TaskVOTests.php delete mode 100644 test/VOTests/UserGroupVOTests.php delete mode 100644 test/VOTests/UserVOTests.php diff --git a/test/FacadeTests/ExtraHoursReportActionLargeTest.php b/test/FacadeTests/ExtraHoursReportActionLargeTest.php deleted file mode 100644 index d8694b7de..000000000 --- a/test/FacadeTests/ExtraHoursReportActionLargeTest.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -require_once(PHPREPORT_ROOT . "/test/FacadeTests/ExtraHoursReportActionTest.php"); - -class ExtraHoursReportActionLargeTest extends ExtraHoursReportActionTest -{ - - public function testExtraHourReport1Year() - { - - $this->loopTest("P1Y"); - - } - - public function testExtraHourReport6Months() - { - - $this->loopTest("P6M"); - - } - -} -?> diff --git a/test/FacadeTests/ExtraHoursReportActionMediumTest.php b/test/FacadeTests/ExtraHoursReportActionMediumTest.php deleted file mode 100644 index 0f3d0c61f..000000000 --- a/test/FacadeTests/ExtraHoursReportActionMediumTest.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -require_once(PHPREPORT_ROOT . "/test/FacadeTests/ExtraHoursReportActionTest.php"); - -class ExtraHoursReportActionMediumTest extends ExtraHoursReportActionTest -{ - - public function testExtraHourReport3Months() - { - - $this->loopTest("P3M"); - - } - - public function testExtraHourReport1Month() - { - - $this->loopTest("P1M"); - - } - -} -?> diff --git a/test/FacadeTests/ExtraHoursReportActionSmallTest.php b/test/FacadeTests/ExtraHoursReportActionSmallTest.php deleted file mode 100644 index 1ec60e7af..000000000 --- a/test/FacadeTests/ExtraHoursReportActionSmallTest.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -require_once(PHPREPORT_ROOT . "/test/FacadeTests/ExtraHoursReportActionTest.php"); - -class ExtraHoursReportActionSmallTest extends ExtraHoursReportActionTest -{ - - public function testExtraHourReport15Days() - { - - $this->loopTest("P15D"); - - } - -} -?> diff --git a/test/FacadeTests/ExtraHoursReportActionTest.php b/test/FacadeTests/ExtraHoursReportActionTest.php deleted file mode 100644 index cfb0a0757..000000000 --- a/test/FacadeTests/ExtraHoursReportActionTest.php +++ /dev/null @@ -1,87 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -require_once(PHPREPORT_ROOT . "/model/facade/action/ExtraHoursReportAction.php"); -require_once(PHPREPORT_ROOT . "/util/oldExtraHours.php"); - -abstract class ExtraHoursReportActionTest extends PHPUnit_Framework_TestCase -{ - protected $init = "2005-01-01"; - - protected $end = NULL ; - - protected function loopTest($addLoop) - { - - $this->init = date_create($this->init); - - if (is_null($this->end)) - $this->end = new DateTime(); - else - $this->end = date_create($this->end); - - while ($this->init <= $this->end) - { - $init = clone ($this->init); - $end = $init->add(new DateInterval($addLoop)); - $this->init = date_create($this->init->format("Y-m-d")); - $end = $end->sub(new DateInterval("P1D")); - if ($end > new DateTime()) - $end = new DateTime(); - $end = date_create($end->format("Y-m-d")); - - $oldUsersResults = oldExtraHours($this->init->format("Y-m-d"), $end->format("Y-m-d")); - - $users = getValidUsers($this->init->format("Y-m-d"), $end->format("Y-m-d")); - - $action= new ExtraHoursReportAction($this->init, $end); - - $newResults = $action->execute(); - $newUsersResults = $newResults[1]; - - foreach($users as $k) - { - /*if (is_null($oldUsersResults[$k]["workable_hours"])) - $oldUsersResults[$k]["workable_hours"] = 0; - $this->assertEquals(number_format($oldUsersResults[$k]["workable_hours"], 5), number_format($newUsersResults[$k]["workable_hours"], 5)); - - if (is_null($oldUsersResults[$k]["extra_hours"])) - $oldUsersResults[$k]["extra_hours"] = 0; - $this->assertEquals(number_format($oldUsersResults[$k]["extra_hours"], 5), number_format($newUsersResults[$k]["extra_hours"], 5));*/ - - if (is_null($oldUsersResults[$k]["total_hours"])) - $oldUsersResults[$k]["total_hours"] = 0; - $this->assertEquals(number_format($oldUsersResults[$k]["total_hours"], 5), number_format($newUsersResults[$k]["total_hours"], 5)); - - if (is_null($oldUsersResults[$k]["total_extra_hours"])) - $oldUsersResults[$k]["total_extra_hours"] = 0; - $this->assertEquals(number_format($oldUsersResults[$k]["total_extra_hours"], 5), number_format($newUsersResults[$k]["total_extra_hours"], 5)); - - } - - $this->init = $this->init->add(new DateInterval($addLoop)); - $this->init = date_create($this->init->format("Y-m-d")); - } - - } - -} -?> diff --git a/test/FacadeTests/ExtraHoursReportActionVerySmallTest.php b/test/FacadeTests/ExtraHoursReportActionVerySmallTest.php deleted file mode 100644 index 72a14b08f..000000000 --- a/test/FacadeTests/ExtraHoursReportActionVerySmallTest.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -require_once(PHPREPORT_ROOT . "/test/FacadeTests/ExtraHoursReportActionTest.php"); - -class ExtraHoursReportActionVerySmallTest extends ExtraHoursReportActionTest -{ - - public function testExtraHourReport1Week() - { - - $this->loopTest("P7D"); - - } - -} -?> diff --git a/test/FacadeTests/oldExtraHours.php b/test/FacadeTests/oldExtraHours.php deleted file mode 100644 index 2c75b7480..000000000 --- a/test/FacadeTests/oldExtraHours.php +++ /dev/null @@ -1,146 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -require_once("include/util.php"); - -function getCnx() { - - $connectionString = "host=localhost port=15435 user=phpreport dbname=phpreport password=phpreport"; - - $cnx = pg_connect($connectionString); - if ($cnx == NULL) throw new DBConnectionErrorException($connectionString); - - return $cnx; - -} - -function getValidUsers($init, $end) { - - $cnx = getCnx(); - - // This SQL Sentence is valid for testing every value returned if we don't care about compensations. See ExtraHoursReportActionTest.php - //$validUsers=@pg_exec($cnx,$query="SELECT uid FROM users WHERE staff='t' AND NOT (uid) IN (SELECT DISTINCT uid FROM compensation) AND NOT (uid) IN (SELECT DISTINCT uid FROM extra_hours WHERE date>='". $init . "' AND date<='". $end . "') ORDER by uid") or die($die); - - // This SQL Sentence is valid for testing compensations migration if we don't care about testing only the total number of extra hours (YOU MUST MAKE A CHOICE!). See ExtraHoursReportActionTest.php - $validUsers=@pg_exec($cnx,$query="SELECT uid FROM users WHERE staff='t' AND NOT (uid) IN (SELECT DISTINCT uid FROM extra_hours WHERE date>='". $init . "' AND date<='". $end . "') AND NOT (uid) IN (SELECT DISTINCT uid FROM compensation WHERE init < '" . $init . "' AND _end >= '" . $init . "' AND _end <= '" . $end ."') ORDER by uid") or die($die); - $validUsersResult=array(); - for ($i=0;$row=@pg_fetch_array($validUsers,$i,PGSQL_ASSOC);$i++) - $validUsersResult[]=$row["uid"]; - - return $validUsersResult; -} - -function oldExtraHours($init, $end) { - - $sheets = 6; - - $cnx = getCnx(); - - $users=@pg_exec($cnx,$query="SELECT uid FROM users WHERE staff='t' ORDER by uid") - or die($die); - $users_consult=array(); - for ($i=0;$row=@pg_fetch_array($users,$i,PGSQL_ASSOC);$i++) - $users_consult[]=$row["uid"]; - - // Select the holiday hours spent in the selected year - $year=substr($init,0,4); - $lowest_date=$year."-01-01"; - $uppest_date=$year."-12-31"; - $holiday_hours=@pg_exec($cnx,$query="SELECT uid, SUM( _end - init ) / 60.0 AS add_hours FROM task WHERE ( _date >= '" - .$lowest_date."'::date AND _date <= '".$uppest_date."'::date ) AND type='vac' " - ."GROUP BY uid ORDER BY uid ASC") - or die($die); - $holiday_hours_consult=array(); - for ($i=0;$row=@pg_fetch_array($holiday_hours,$i,PGSQL_ASSOC);$i++) { - $holiday_hours_consult[$row["uid"]]=$row; - } - @pg_freeresult($holiday_hours); - - $worked_hours_consult=net_extra_hours($cnx,$init,$end); - - // Select most recent overriden extra hours before - // the init date for each user - //Remember $init=$end in this case - $extra_hours=@pg_exec($cnx,$query="SELECT e.uid,e.hours,e.date - FROM extra_hours AS e JOIN ( - SELECT uid,MAX(date) AS date FROM extra_hours - WHERE date<'$init' - GROUP BY uid) AS m ON (e.uid=m.uid AND e.date=m.date) - WHERE e.uid IN (SELECT uid FROM users WHERE staff='t')") - or die($die); - $extra_hours_consult=array(); - for ($i=0;$row=@pg_fetch_array($extra_hours,$i,PGSQL_ASSOC);$i++) { - $extra_hours_consult[$row["uid"]]=$row; - } - @pg_freeresult($extra_hours); - - // Let's compute the accumulated extra hours before the period we're computing now - foreach ($users_consult as $k) { - // $k is the uid - - // If there are forced extra hours defined before init, take them into account - // and only compute hours after the defined ones, but before the init of the - // period we're computing - if (!empty($extra_hours_consult[$k])) { - $previous_init=date_web_to_sql(day_day_moved(date_sql_to_web($extra_hours_consult[$k]["date"]),1)); - $previous_hours=$extra_hours_consult[$k]["hours"]; - } else { - $previous_init="1900-01-01"; - $previous_hours=0; - } - - $h=net_extra_hours($cnx,$previous_init, - date_web_to_sql(day_yesterday(date_sql_to_web($init))),$k); - if (!empty($h[$k]["extra_hours"])) $previous_hours+=$h[$k]["extra_hours"]; - - // Put them all - $worked_hours_consult[$k]["total_extra_hours"]=$worked_hours_consult[$k]["extra_hours"] - +$previous_hours; - $worked_hours_consult[$k]["pending_holiday_hours_year"]=YEARLY_HOLIDAY_HOURS-$holiday_hours_consult[$k]["add_hours"]; - } - - return $worked_hours_consult; - } - -/*//Uncomment these lines in order to do a simple test of the functions - -$init = "2007-01-01"; -$end = "2007-12-31"; - -$oldUsersResults = oldExtraHours($init, $end); - -$users = array("chema"); - -$users = getValidUsers($init, $end); - -$init = date_create($init); -$end = date_create($end); - - -foreach($users as $k) -{ - print "\nUser: " . $k . "\n"; - print "Worked: " . $oldUsersResults[$k]["total_hours"] . "\n"; - print "Workable hours: " . $oldUsersResults[$k]["workable_hours"] . "\n"; - print "Extra hours: " . $oldUsersResults[$k]["extra_hours"] . "\n"; - print "Total extra hours: " . $oldUsersResults[$k]["total_extra_hours"] . "\n"; - -}*/ diff --git a/test/PHPReportExtraHoursReportActionSuite.php b/test/PHPReportExtraHoursReportActionSuite.php deleted file mode 100644 index 6cc0e84da..000000000 --- a/test/PHPReportExtraHoursReportActionSuite.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -define('PHPREPORT_ROOT', __DIR__ . '/../'); -require_once PHPREPORT_ROOT . '/test/FacadeTests/ExtraHoursReportActionLargeTest.php'; -require_once PHPREPORT_ROOT . '/test/FacadeTests/ExtraHoursReportActionMediumTest.php'; -require_once PHPREPORT_ROOT . '/test/FacadeTests/ExtraHoursReportActionSmallTest.php'; -require_once PHPREPORT_ROOT . '/test/FacadeTests/ExtraHoursReportActionVerySmallTest.php'; - -class PHPReportExtraHoursReportActionSuite extends PHPUnit_Framework_TestSuite -{ - - public static function suite() - { - $suite = new PHPReportExtraHoursReportActionSuite(); - - $suite->addTestSuite('ExtraHoursReportActionLargeTest'); - $suite->addTestSuite('ExtraHoursReportActionMediumTest'); - $suite->addTestSuite('ExtraHoursReportActionSmallTest'); - $suite->addTestSuite('ExtraHoursReportActionVerySmallTest'); - - return $suite; - } - -} -?> diff --git a/test/PHPReportGeneralSuite.php b/test/PHPReportGeneralSuite.php deleted file mode 100644 index 273bd5f45..000000000 --- a/test/PHPReportGeneralSuite.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -define('PHPREPORT_ROOT', __DIR__ . '/../'); -require_once PHPREPORT_ROOT . '/test/PHPReportVOSuite.php'; -require_once PHPREPORT_ROOT . '/test/PHPReportPostgreSuite.php'; - -class PHPReportGeneralSuite extends PHPUnit_Framework_TestSuite -{ - - public static function suite() - { - $suite = new PHPReportGeneralSuite(); - - $suite->addTestSuite('PHPReportVOSuite'); - $suite->addTestSuite('PHPReportPostgreSuite'); - - return $suite; - } - -} -?> diff --git a/test/PHPReportPostgreDAOBasicSuite.php b/test/PHPReportPostgreDAOBasicSuite.php deleted file mode 100644 index 48c54b3fb..000000000 --- a/test/PHPReportPostgreDAOBasicSuite.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -define('PHPREPORT_ROOT', __DIR__ . '/../'); -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLUserDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLAreaDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLCityDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLSectorDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLUserGroupDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLExtraHourDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLCustomEventDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLCommonEventDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLCustomerDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLTaskDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLJourneyHistoryDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLAreaHistoryDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLCityHistoryDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLHourCostHistoryDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLProjectDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLIterationDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLModuleDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLStoryDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLSectionDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLTaskStoryDAOBasicTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOBasicTests/PostgreSQLTaskSectionDAOBasicTests.php'; - -class PHPReportPostgreDAOBasicSuite extends PHPUnit_Framework_TestSuite -{ - - public static function suite() - { - $suite = new PHPReportPostgreDAOBasicSuite(); - - $suite->addTestSuite('PostgreSQLUserDAOBasicTests'); - $suite->addTestSuite('PostgreSQLAreaDAOBasicTests'); - $suite->addTestSuite('PostgreSQLCityDAOBasicTests'); - $suite->addTestSuite('PostgreSQLSectorDAOBasicTests'); - $suite->addTestSuite('PostgreSQLUserGroupDAOBasicTests'); - $suite->addTestSuite('PostgreSQLExtraHourDAOBasicTests'); - $suite->addTestSuite('PostgreSQLCustomEventDAOBasicTests'); - $suite->addTestSuite('PostgreSQLCommonEventDAOBasicTests'); - $suite->addTestSuite('PostgreSQLCustomerDAOBasicTests'); - $suite->addTestSuite('PostgreSQLTaskDAOBasicTests'); - $suite->addTestSuite('PostgreSQLJourneyHistoryDAOBasicTests'); - $suite->addTestSuite('PostgreSQLAreaHistoryDAOBasicTests'); - $suite->addTestSuite('PostgreSQLCityHistoryDAOBasicTests'); - $suite->addTestSuite('PostgreSQLHourCostHistoryDAOBasicTests'); - $suite->addTestSuite('PostgreSQLProjectDAOBasicTests'); - $suite->addTestSuite('PostgreSQLModuleDAOBasicTests'); - $suite->addTestSuite('PostgreSQLIterationDAOBasicTests'); - $suite->addTestSuite('PostgreSQLSectionDAOBasicTests'); - $suite->addTestSuite('PostgreSQLStoryDAOBasicTests'); - $suite->addTestSuite('PostgreSQLTaskSectionDAOBasicTests'); - $suite->addTestSuite('PostgreSQLTaskStoryDAOBasicTests'); - - return $suite; - } - -} -?> diff --git a/test/PHPReportPostgreDAOMultipleSuite.php b/test/PHPReportPostgreDAOMultipleSuite.php deleted file mode 100644 index 9fb913082..000000000 --- a/test/PHPReportPostgreDAOMultipleSuite.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -define('PHPREPORT_ROOT', __DIR__ . '/../'); -require_once PHPREPORT_ROOT . '/test/PostgreDAOMultipleTests/PostgreSQLBelongsRelationshipMultipleTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOMultipleTests/PostgreSQLRequestsRelationshipMultipleTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOMultipleTests/PostgreSQLWorksRelationshipMultipleTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOMultipleTests/PostgreSQLProjectUserRelationshipMultipleTests.php'; -require_once PHPREPORT_ROOT . '/test/PostgreDAOMultipleTests/PostgreSQLProjectScheduleDAOMultipleTests.php'; - -class PHPReportPostgreDAOMultipleSuite extends PHPUnit_Framework_TestSuite -{ - - public static function suite() - { - $suite = new PHPReportPostgreDAOMultipleSuite(); - - $suite->addTestSuite('PostgreSQLBelongsRelationshipMultipleTests'); - $suite->addTestSuite('PostgreSQLRequestsRelationshipMultipleTests'); - $suite->addTestSuite('PostgreSQLWorksRelationshipMultipleTests'); - $suite->addTestSuite('PostgreSQLProjectUserRelationshipMultipleTests'); - $suite->addTestSuite('PostgreSQLProjectScheduleDAOMultipleTests'); - - return $suite; - } - -} -?> diff --git a/test/PHPReportPostgreSuite.php b/test/PHPReportPostgreSuite.php deleted file mode 100644 index 02fcc18e9..000000000 --- a/test/PHPReportPostgreSuite.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -define('PHPREPORT_ROOT', __DIR__ . '/../'); -require_once PHPREPORT_ROOT . '/test/PHPReportPostgreDAOBasicSuite.php'; -require_once PHPREPORT_ROOT . '/test/PHPReportPostgreDAOMultipleSuite.php'; - -class PHPReportPostgreSuite extends PHPUnit_Framework_TestSuite -{ - - public static function suite() - { - $suite = new PHPReportPostgreSuite(); - - $suite->addTestSuite('PHPReportPostgreDAOBasicSuite'); - $suite->addTestSuite('PHPReportPostgreDAOMultipleSuite'); - - return $suite; - } - -} -?> diff --git a/test/PHPReportVOSuite.php b/test/PHPReportVOSuite.php deleted file mode 100644 index 3159e3aee..000000000 --- a/test/PHPReportVOSuite.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -define('PHPREPORT_ROOT', __DIR__ . '/../'); -require_once PHPREPORT_ROOT . '/test/VOTests/UserVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/AreaVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/UserGroupVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/ExtraHourVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/TaskVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/CustomerVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/SectorVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/CustomEventVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/ProjectScheduleVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/CityVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/CommonEventVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/JourneyHistoryVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/HourCostHistoryVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/AreaHistoryVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/CityHistoryVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/ProjectVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/IterationVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/ModuleVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/StoryVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/SectionVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/TaskStoryVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/TaskSectionVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/CustomTaskSectionVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/CustomSectionVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/CustomTaskStoryVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/CustomStoryVOTests.php'; -require_once PHPREPORT_ROOT . '/test/VOTests/CustomProjectVOTests.php'; - -class PHPReportVOSuite extends PHPUnit_Framework_TestSuite -{ - - public static function suite() - { - $suite = new PHPReportVOSuite(); - - $suite->addTestSuite('UserVOTests'); - $suite->addTestSuite('AreaVOTests'); - $suite->addTestSuite('UserGroupVOTests'); - $suite->addTestSuite('ExtraHourVOTests'); - $suite->addTestSuite('TaskVOTests'); - $suite->addTestSuite('CustomerVOTests'); - $suite->addTestSuite('SectorVOTests'); - $suite->addTestSuite('CustomEventVOTests'); - $suite->addTestSuite('ProjectScheduleVOTests'); - $suite->addTestSuite('CityVOTests'); - $suite->addTestSuite('CommonEventVOTests'); - $suite->addTestSuite('JourneyHistoryVOTests'); - $suite->addTestSuite('HourCostHistoryVOTests'); - $suite->addTestSuite('AreaHistoryVOTests'); - $suite->addTestSuite('CityHistoryVOTests'); - $suite->addTestSuite('ProjectVOTests'); - $suite->addTestSuite('IterationVOTests'); - $suite->addTestSuite('ModuleVOTests'); - $suite->addTestSuite('StoryVOTests'); - $suite->addTestSuite('SectionVOTests'); - $suite->addTestSuite('TaskSectionVOTests'); - $suite->addTestSuite('TaskStoryVOTests'); - $suite->addTestSuite('CustomTaskSectionVOTests'); - $suite->addTestSuite('CustomTaskStoryVOTests'); - $suite->addTestSuite('CustomSectionVOTests'); - $suite->addTestSuite('CustomStoryVOTests'); - $suite->addTestSuite('CustomProjectVOTests'); - - return $suite; - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLAreaDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLAreaDAOBasicTests.php deleted file mode 100644 index 12771254c..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLAreaDAOBasicTests.php +++ /dev/null @@ -1,186 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/AreaVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/AreaDAO/PostgreSQLAreaDAO.php'); - -class PostgreSQLAreaDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - - protected function setUp() - { - - $this->dao = new PostgreSQLAreaDAO(); - - $this->testObjects[0] = new AreaVO(); - $this->testObjects[0]->setName("Planet Express"); - $this->testObjects[0]->setId(-1); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setName("The Box Network"); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setName("The Box Network"); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setName("Zapp and Kiff"); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setName("MomCorp"); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setName("MomCorp"); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLAreaHistoryDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLAreaHistoryDAOBasicTests.php deleted file mode 100644 index c4fee3fc9..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLAreaHistoryDAOBasicTests.php +++ /dev/null @@ -1,507 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/AreaHistoryVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/AreaHistoryDAO/PostgreSQLAreaHistoryDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/UserDAO/PostgreSQLUserDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/AreaVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/AreaDAO/PostgreSQLAreaDAO.php'); - -class PostgreSQLAreaHistoryDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - protected $auxDao; - protected $auxObject; - protected $auxDao2; - protected $auxObject2; - - protected function setUp() - { - - $this->auxDao = new PostgreSQLUserDAO(); - - $this->auxObject = new UserVO(); - $this->auxObject->setLogin("bender"); - $this->auxObject->setPassword("kiss my metal shiny ass"); - - $this->auxDao->create($this->auxObject); - - $this->auxDao2 = new PostgreSQLAreaDAO(); - - $this->auxObject2 = new AreaVO(); - $this->auxObject2->setName("Deliverers"); - - $this->auxDao2->create($this->auxObject2); - - - $this->dao = new PostgreSQLAreaHistoryDAO(); - - $this->testObjects[0] = new AreaHistoryVO(); - $this->testObjects[0]->setId(-1); - $this->testObjects[0]->setInitDate(date_create("1999-12-31")); - $this->testObjects[0]->setEndDate(date_create("2999-12-31")); - $this->testObjects[0]->setUserId($this->auxObject->getId()); - $this->testObjects[0]->setAreaId($this->auxObject2->getId()); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - $this->auxDao->delete($this->auxObject); - - $this->auxDao2->delete($this->auxObject2); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testGetByUserId() - { - - $this->testObjects[1] = new AreaHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setAreaId($this->auxObject2->getId()); - - $this->testObjects[2] = new AreaHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setAreaId($this->auxObject2->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByUserId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByUserIdVoid() - { - - $read = $this->dao->getByUserId($this->auxObject->getId()); - - $this->assertEquals(sizeof($read), 0); - - } - - public function testGetCurrentByUserId() - { - - $this->testObjects[1] = new AreaHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setAreaId($this->auxObject2->getId()); - - $this->testObjects[2] = new AreaHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setAreaId($this->auxObject2->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getCurrentByUserId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects[1]); - - } - - public function testGetByIntervals1() - { - - $this->testObjects[1] = new AreaHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setAreaId($this->auxObject2->getId()); - - $this->testObjects[2] = new AreaHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setAreaId($this->auxObject2->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByIntervals(date_create("1999-11-31"), date_create("3000-12-31")); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByIntervals2() - { - - $this->testObjects[1] = new AreaHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-30")); - $this->testObjects[1]->setEndDate(date_create("2199-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setAreaId($this->auxObject2->getId()); - - $auxObject = new UserVO(); - $auxObject->setLogin("flexo"); - $auxObject->setPassword("kiss my metal shiny ass"); - - $this->auxDao->create($auxObject); - - $testObject = new AreaHistoryVO(); - $testObject->setId(-1); - $testObject->setInitDate(date_create("2949-12-31")); - $testObject->setEndDate(date_create("2999-12-31")); - $testObject->setUserId($auxObject->getId()); - $testObject->setAreaId($this->auxObject2->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($testObject); - - $read = $this->dao->getByIntervals(date_create("2000-11-31"), date_create("2900-12-31")); - - $this->assertEquals($read, $this->testObjects); - - $this->dao->delete($testObject); - - $this->auxDao->delete($auxObject); - - } - - public function testGetByIntervals3() - { - - $this->testObjects[1] = new AreaHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setAreaId($this->auxObject2->getId()); - - $this->testObjects[2] = new AreaHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("3000-12-31")); - $this->testObjects[2]->setEndDate(date_create("3999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setAreaId($this->auxObject2->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByIntervals(date_create("2999-12-31"), date_create("3000-12-31")); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByIntervalsUserId() - { - - $this->testObjects[1] = new AreaHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2199-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setAreaId($this->auxObject2->getId()); - - $auxObject = new UserVO(); - $auxObject->setLogin("flexo"); - $auxObject->setPassword("kiss my metal shiny ass"); - - $this->auxDao->create($auxObject); - - $testObject = new AreaHistoryVO(); - $testObject->setId(-1); - $testObject->setInitDate(date_create("2949-12-31")); - $testObject->setEndDate(date_create("2999-12-31")); - $testObject->setUserId($auxObject->getId()); - $testObject->setAreaId($this->auxObject2->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($testObject); - - $read = $this->dao->getByIntervals(date_create("2000-11-31"), date_create("3000-12-31"), $this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - $this->dao->delete($testObject); - - $this->auxDao->delete($auxObject); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIntervalsUserIdInvalid() - { - - $this->dao->getByIntervals(date_create("2000-11-31"), date_create("3000-12-31"), "zoidberg"); - - } - - public function testGetByAreaId() - { - - $this->testObjects[1] = new AreaHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setAreaId($this->auxObject2->getId()); - - $this->testObjects[2] = new AreaHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setAreaId($this->auxObject2->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByAreaId($this->auxObject2->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByAreaIdVoid() - { - - $read = $this->dao->getByAreaId($this->auxObject2->getId()); - - $this->assertEquals(sizeof($read), 0); - - } - - public function testGetByUserIdFromUser() - { - - $this->testObjects[1] = new AreaHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setAreaId($this->auxObject2->getId()); - - $this->testObjects[2] = new AreaHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setAreaId($this->auxObject2->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->auxDao->getAreaHistory($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByAreaIdFromArea() - { - - $this->testObjects[1] = new AreaHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setAreaId($this->auxObject2->getId()); - - $this->testObjects[2] = new AreaHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setAreaId($this->auxObject2->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->auxDao2->getAreaHistories($this->auxObject2->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setEndDate(NULL); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setEndDate(NULL); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLCityDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLCityDAOBasicTests.php deleted file mode 100644 index 18901714b..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLCityDAOBasicTests.php +++ /dev/null @@ -1,186 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/CityVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/CityDAO/PostgreSQLCityDAO.php'); - -class PostgreSQLCityDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - - protected function setUp() - { - - $this->dao = new PostgreSQLCityDAO(); - - $this->testObjects[0] = new CityVO(); - $this->testObjects[0]->setName("New New York"); - $this->testObjects[0]->setId(-1); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setName("Old New York"); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setName("Old New York"); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setName("The Wong Place"); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setName("Old New York"); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setName("Old New York"); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLCityHistoryDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLCityHistoryDAOBasicTests.php deleted file mode 100644 index 1f69337c9..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLCityHistoryDAOBasicTests.php +++ /dev/null @@ -1,506 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/CityHistoryVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/CityHistoryDAO/PostgreSQLCityHistoryDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/UserDAO/PostgreSQLUserDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/CityVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/CityDAO/PostgreSQLCityDAO.php'); - -class PostgreSQLCityHistoryDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - protected $auxDao; - protected $auxObject; - protected $auxDao2; - protected $auxObject2; - - protected function setUp() - { - - $this->auxDao = new PostgreSQLUserDAO(); - - $this->auxObject = new UserVO(); - $this->auxObject->setLogin("bender"); - $this->auxObject->setPassword("kiss my metal shiny ass"); - - $this->auxDao->create($this->auxObject); - - $this->auxDao2 = new PostgreSQLCityDAO(); - - $this->auxObject2 = new CityVO(); - $this->auxObject2->setName("New New York"); - - $this->auxDao2->create($this->auxObject2); - - - $this->dao = new PostgreSQLCityHistoryDAO(); - - $this->testObjects[0] = new CityHistoryVO(); - $this->testObjects[0]->setId(-1); - $this->testObjects[0]->setInitDate(date_create("1999-12-31")); - $this->testObjects[0]->setEndDate(date_create("2999-12-31")); - $this->testObjects[0]->setUserId($this->auxObject->getId()); - $this->testObjects[0]->setCityId($this->auxObject2->getId()); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - $this->auxDao->delete($this->auxObject); - - $this->auxDao2->delete($this->auxObject2); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testGetByUserId() - { - - $this->testObjects[1] = new CityHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setCityId($this->auxObject2->getId()); - - $this->testObjects[2] = new CityHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setCityId($this->auxObject2->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByUserId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByUserIdVoid() - { - - $read = $this->dao->getByUserId($this->auxObject->getId()); - - $this->assertEquals(sizeof($read), 0); - - } - - public function testGetCurrentByUserId() - { - - $this->testObjects[1] = new CityHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setCityId($this->auxObject2->getId()); - - $this->testObjects[2] = new CityHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setCityId($this->auxObject2->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getCurrentByUserId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects[1]); - - } - - public function testGetByIntervals1() - { - - $this->testObjects[1] = new CityHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setCityId($this->auxObject2->getId()); - - $this->testObjects[2] = new CityHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setCityId($this->auxObject2->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByIntervals(date_create("1999-11-31"), date_create("3000-12-31")); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByIntervals2() - { - - $this->testObjects[1] = new CityHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2199-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setCityId($this->auxObject2->getId()); - - $auxObject = new UserVO(); - $auxObject->setLogin("flexo"); - $auxObject->setPassword("kiss my metal shiny ass"); - - $this->auxDao->create($auxObject); - - $testObject = new CityHistoryVO(); - $testObject->setId(-1); - $testObject->setInitDate(date_create("2949-12-31")); - $testObject->setEndDate(date_create("2999-12-31")); - $testObject->setUserId($auxObject->getId()); - $testObject->setCityId($this->auxObject2->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($testObject); - - $read = $this->dao->getByIntervals(date_create("2000-11-31"), date_create("2900-12-31")); - - $this->assertEquals($read, $this->testObjects); - - $this->dao->delete($testObject); - - $this->auxDao->delete($auxObject); - - } - - public function testGetByIntervals3() - { - - $this->testObjects[1] = new CityHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setCityId($this->auxObject2->getId()); - - $this->testObjects[2] = new CityHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("3000-12-31")); - $this->testObjects[2]->setEndDate(date_create("3999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setCityId($this->auxObject2->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByIntervals(date_create("2999-12-31"), date_create("3000-12-31")); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByIntervalsUserId() - { - - $this->testObjects[1] = new CityHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2199-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setCityId($this->auxObject2->getId()); - - $auxObject = new UserVO(); - $auxObject->setLogin("flexo"); - $auxObject->setPassword("kiss my metal shiny ass"); - - $this->auxDao->create($auxObject); - - $testObject = new CityHistoryVO(); - $testObject->setId(-1); - $testObject->setInitDate(date_create("2949-12-31")); - $testObject->setEndDate(date_create("2999-12-31")); - $testObject->setUserId($auxObject->getId()); - $testObject->setCityId($this->auxObject2->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($testObject); - - $read = $this->dao->getByIntervals(date_create("2000-11-31"), date_create("3000-12-31"), $this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - $this->dao->delete($testObject); - - $this->auxDao->delete($auxObject); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIntervalsUserIdInvalid() - { - - $this->dao->getByIntervals(date_create("2000-11-31"), date_create("3000-12-31"), "zoidberg"); - - } - - public function testGetByCityId() - { - - $this->testObjects[1] = new CityHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setCityId($this->auxObject2->getId()); - - $this->testObjects[2] = new CityHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setCityId($this->auxObject2->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByCityId($this->auxObject2->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByCityIdVoid() - { - - $read = $this->dao->getByCityId($this->auxObject2->getId()); - - $this->assertEquals(sizeof($read), 0); - - } - - public function testGetByUserIdFromUser() - { - - $this->testObjects[1] = new CityHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setCityId($this->auxObject2->getId()); - - $this->testObjects[2] = new CityHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setCityId($this->auxObject2->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->auxDao->getCityHistory($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByCityIdFromCity() - { - - $this->testObjects[1] = new CityHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setCityId($this->auxObject2->getId()); - - $this->testObjects[2] = new CityHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setCityId($this->auxObject2->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->auxDao2->getCityHistories($this->auxObject2->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setEndDate(NULL); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setEndDate(NULL); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLCommonEventDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLCommonEventDAOBasicTests.php deleted file mode 100644 index 9ac91b577..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLCommonEventDAOBasicTests.php +++ /dev/null @@ -1,245 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/CommonEventVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/CommonEventDAO/PostgreSQLCommonEventDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/CityVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/CityDAO/PostgreSQLCityDAO.php'); - -class PostgreSQLCommonEventDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - protected $auxDao; - protected $auxObject; - - protected function setUp() - { - - $this->auxDao = new PostgreSQLCityDAO(); - - $this->auxObject = new CityVO(); - $this->auxObject->setName("New New York"); - - $this->auxDao->create($this->auxObject); - - $this->dao = new PostgreSQLCommonEventDAO(); - - $this->testObjects[0] = new CommonEventVO(); - $this->testObjects[0]->setCityId($this->auxObject->getId()); - $this->testObjects[0]->setDate(date_create("1999-12-31")); - $this->testObjects[0]->setId(-1); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - $this->auxDao->delete($this->auxObject); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setDate(date_create("2000-12-31")); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setDate(date_create("2000-12-31")); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setDate(date_create("2001-12-31")); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testGetByCityId() - { - - $this->testObjects[1] = new CommonEventVO(); - $this->testObjects[1]->setCityId($this->auxObject->getId()); - $this->testObjects[1]->setDate(date_create("2000-12-31")); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new CommonEventVO(); - $this->testObjects[2]->setCityId($this->auxObject->getId()); - $this->testObjects[2]->setDate(date_create("2001-12-31")); - $this->testObjects[2]->setId(-1); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByCityId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByCityIdFromCity() - { - - $this->testObjects[1] = new CommonEventVO(); - $this->testObjects[1]->setCityId($this->auxObject->getId()); - $this->testObjects[1]->setDate(date_create("2000-12-31")); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new CommonEventVO(); - $this->testObjects[2]->setCityId($this->auxObject->getId()); - $this->testObjects[2]->setDate(date_create("2001-12-31")); - $this->testObjects[2]->setId(-1); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->auxDao->getCommonEvents($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setDate(date_create("2999-12-31")); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setDate(date_create("2999-12-31")); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLConfigDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLConfigDAOBasicTests.php deleted file mode 100644 index 78d1ef95b..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLConfigDAOBasicTests.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - -/** This file contains some simple tests for PostgreSQLConfigDAO, - * not PhpUnit-ized. - * - * @filesource - * @package PhpReport - * @subpackage test - * @author Jacobo Aragunde Pérez - */ - -define('PHPREPORT_ROOT', __DIR__ . '/../../'); - -include_once(PHPREPORT_ROOT . '/model/dao/DAOFactory.php'); - -$dao = DAOFactory::getConfigDAO(); -var_dump($dao->getVersionNumber()); -var_dump($dao->setTaskBlockConfiguration(true, 1)); -var_dump($dao->isWriteAllowedForDate(new DateTime())); //true -var_dump($dao->isWriteAllowedForDate(new DateTime('2000-01-01'))); //false -var_dump($dao->setTaskBlockConfiguration(false, null)); -var_dump($dao->isWriteAllowedForDate(new DateTime('2000-01-01'))); //true diff --git a/test/PostgreDAOBasicTests/PostgreSQLCustomEventDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLCustomEventDAOBasicTests.php deleted file mode 100644 index 2531e15fb..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLCustomEventDAOBasicTests.php +++ /dev/null @@ -1,256 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/CustomEventVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/CustomEventDAO/PostgreSQLCustomEventDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/UserDAO/PostgreSQLUserDAO.php'); - -class PostgreSQLCustomEventDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - protected $auxDao; - protected $auxObject; - - protected function setUp() - { - - $this->auxDao = new PostgreSQLUserDAO(); - - $this->auxObject = new UserVO(); - $this->auxObject->setLogin("bender"); - $this->auxObject->setPassword("kiss my metal shiny ass"); - - $this->auxDao->create($this->auxObject); - - $this->dao = new PostgreSQLCustomEventDAO(); - - $this->testObjects[0] = new CustomEventVO(); - $this->testObjects[0]->setUserId($this->auxObject->getId()); - $this->testObjects[0]->setHours(2.45); - $this->testObjects[0]->setDate(date_create("1999-12-31")); - $this->testObjects[0]->setType("Hailing Zoidberg!"); - $this->testObjects[0]->setId(-1); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - $this->auxDao->delete($this->auxObject); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setDate(date_create("2000-12-31")); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setDate(date_create("2000-12-31")); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setDate(date_create("2001-12-31")); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testGetByUserId() - { - - $this->testObjects[1] = new CustomEventVO(); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setHours(2.45); - $this->testObjects[1]->setDate(date_create("2000-12-31")); - $this->testObjects[1]->setType("Hailing Zoidberg!"); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new CustomEventVO(); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setHours(2.45); - $this->testObjects[2]->setDate(date_create("2001-12-31")); - $this->testObjects[2]->setType("Hailing Zoidberg!"); - $this->testObjects[2]->setId(-1); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByUserId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByUserIdFromUser() - { - - $this->testObjects[1] = new CustomEventVO(); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setHours(2.45); - $this->testObjects[1]->setDate(date_create("2000-12-31")); - $this->testObjects[1]->setType("Hailing Zoidberg!"); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new CustomEventVO(); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setHours(2.45); - $this->testObjects[2]->setDate(date_create("2001-12-31")); - $this->testObjects[2]->setType("Hailing Zoidberg!"); - $this->testObjects[2]->setId(-1); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->auxDao->getCustomEvents($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setDate(date_create("2999-12-31")); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setDate(date_create("2999-12-31")); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLCustomerDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLCustomerDAOBasicTests.php deleted file mode 100644 index 47fc79066..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLCustomerDAOBasicTests.php +++ /dev/null @@ -1,249 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/CustomerVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/CustomerDAO/PostgreSQLCustomerDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/SectorVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/SectorDAO/PostgreSQLSectorDAO.php'); - -class PostgreSQLCustomerDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - protected $auxDao; - protected $auxObject; - - protected function setUp() - { - - $this->auxDao = new PostgreSQLSectorDAO(); - - $this->auxObject = new SectorVO(); - $this->auxObject->setName("Industry"); - - $this->auxDao->create($this->auxObject); - - $this->dao = new PostgreSQLCustomerDAO(); - - $this->testObjects[0] = new CustomerVO(); - $this->testObjects[0]->setSectorId($this->auxObject->getId()); - $this->testObjects[0]->setName("Mommy"); - $this->testObjects[0]->setType("Biggest industry on Earth"); - $this->testObjects[0]->setURL("www.mommyindustries.com"); - $this->testObjects[0]->setId(-1); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - $this->auxDao->delete($this->auxObject); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testGetBySectorId() - { - - $this->testObjects[1] = new CustomerVO(); - $this->testObjects[1]->setSectorId($this->auxObject->getId()); - $this->testObjects[1]->setName("Mommy"); - $this->testObjects[1]->setType("Biggest industry on Earth"); - $this->testObjects[1]->setURL("www.mommyindustries.com"); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new CustomerVO(); - $this->testObjects[2]->setSectorId($this->auxObject->getId()); - $this->testObjects[2]->setName("Mommy"); - $this->testObjects[2]->setType("Biggest industry on Earth"); - $this->testObjects[2]->setURL("www.mommyindustries.com"); - $this->testObjects[2]->setId(-1); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getBySectorId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetBySectorIdFromSector() - { - - $this->testObjects[1] = new CustomerVO(); - $this->testObjects[1]->setSectorId($this->auxObject->getId()); - $this->testObjects[1]->setName("Mommy"); - $this->testObjects[1]->setType("Biggest industry on Earth"); - $this->testObjects[1]->setURL("www.mommyindustries.com"); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new CustomerVO(); - $this->testObjects[2]->setSectorId($this->auxObject->getId()); - $this->testObjects[2]->setName("Mommy"); - $this->testObjects[2]->setType("Biggest industry on Earth"); - $this->testObjects[2]->setURL("www.mommyindustries.com"); - $this->testObjects[2]->setId(-1); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->auxDao->getCustomers($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setURL(NULL); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setURL(NULL); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLExtraHourDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLExtraHourDAOBasicTests.php deleted file mode 100644 index da0508477..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLExtraHourDAOBasicTests.php +++ /dev/null @@ -1,277 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/ExtraHourVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/ExtraHourDAO/PostgreSQLExtraHourDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/UserDAO/PostgreSQLUserDAO.php'); - -class PostgreSQLExtraHourDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - protected $auxDao; - protected $auxObject; - - protected function setUp() - { - - $this->auxDao = new PostgreSQLUserDAO(); - - $this->auxObject = new UserVO(); - $this->auxObject->setLogin("bender"); - $this->auxObject->setPassword("kiss my metal shiny ass"); - $this->auxObject->setId(-1); - - $this->auxDao->create($this->auxObject); - - $this->dao = new PostgreSQLExtraHourDAO(); - - $this->testObjects[0] = new ExtraHourVO(); - $this->testObjects[0]->setUserId($this->auxObject->getId()); - $this->testObjects[0]->setHours(2.45); - $this->testObjects[0]->setDate(date_create("1999-12-31")); - $this->testObjects[0]->setId(-1); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - $this->auxDao->delete($this->auxObject); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setDate(date_create("2000-12-31")); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setDate(date_create("2000-12-31")); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setDate(date_create("2001-12-31")); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testGetByUserId() - { - - $this->testObjects[1] = new ExtraHourVO(); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setHours(2.45); - $this->testObjects[1]->setDate(date_create("2000-12-31")); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new ExtraHourVO(); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setHours(2.45); - $this->testObjects[2]->setDate(date_create("2001-12-31")); - $this->testObjects[2]->setId(-1); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByUserId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetLastByUserId() - { - - $this->testObjects[1] = new ExtraHourVO(); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setHours(2.45); - $this->testObjects[1]->setDate(date_create("2001-12-31")); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new ExtraHourVO(); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setHours(2.45); - $this->testObjects[2]->setDate(date_create("2000-12-31")); - $this->testObjects[2]->setId(-1); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getLastByUserId($this->auxObject->getId(), new DateTime()); - - $this->assertEquals($read, $this->testObjects[1]); - - } - - public function testGetByUserIdFromUser() - { - - $this->testObjects[1] = new ExtraHourVO(); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setHours(2.45); - $this->testObjects[1]->setDate(date_create("2000-12-31")); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new ExtraHourVO(); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setHours(2.45); - $this->testObjects[2]->setDate(date_create("2001-12-31")); - $this->testObjects[2]->setId(-1); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->auxDao->getExtraHours($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setDate(date_create("2999-12-31")); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setDate(date_create("2999-12-31")); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLHourCostHistoryDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLHourCostHistoryDAOBasicTests.php deleted file mode 100644 index e5a911e89..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLHourCostHistoryDAOBasicTests.php +++ /dev/null @@ -1,429 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/HourCostHistoryVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/HourCostHistoryDAO/PostgreSQLHourCostHistoryDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/UserDAO/PostgreSQLUserDAO.php'); - -class PostgreSQLHourCostHistoryDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - protected $auxDao; - protected $auxObject; - - protected function setUp() - { - - $this->auxDao = new PostgreSQLUserDAO(); - - $this->auxObject = new UserVO(); - $this->auxObject->setLogin("bender"); - $this->auxObject->setPassword("kiss my metal shiny ass"); - - $this->auxDao->create($this->auxObject); - - $this->dao = new PostgreSQLHourCostHistoryDAO(); - - $this->testObjects[0] = new HourCostHistoryVO(); - $this->testObjects[0]->setId(-1); - $this->testObjects[0]->setInitDate(date_create("1999-12-31")); - $this->testObjects[0]->setEndDate(date_create("2999-12-31")); - $this->testObjects[0]->setUserId($this->auxObject->getId()); - $this->testObjects[0]->setHourCost(2); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - $this->auxDao->delete($this->auxObject); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testGetByUserId() - { - - $this->testObjects[1] = new HourCostHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setHourCost(3); - - $this->testObjects[2] = new HourCostHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setHourCost(5); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByUserId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByUserIdVoid() - { - - $read = $this->dao->getByUserId($this->auxObject->getId()); - - $this->assertEquals(sizeof($read), 0); - - } - - public function testGetCurrentByUserId() - { - - $this->testObjects[1] = new HourCostHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setHourCost(3); - - $this->testObjects[2] = new HourCostHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setHourCost(5); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getCurrentByUserId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects[1]); - - } - - public function testGetByIntervals1() - { - - $this->testObjects[1] = new HourCostHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setHourCost(3); - - $this->testObjects[2] = new HourCostHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setHourCost(3); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByIntervals(date_create("1999-11-31"), date_create("3000-12-31")); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByIntervals2() - { - - $this->testObjects[1] = new HourCostHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2199-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setHourCost(3); - - $auxObject = new UserVO(); - $auxObject->setLogin("flexo"); - $auxObject->setPassword("kiss my metal shiny ass"); - - $this->auxDao->create($auxObject); - - $testObject = new HourCostHistoryVO(); - $testObject->setId(-1); - $testObject->setInitDate(date_create("2949-12-31")); - $testObject->setEndDate(date_create("2999-12-31")); - $testObject->setUserId($auxObject->getId()); - $testObject->setHourCost(3); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($testObject); - - $read = $this->dao->getByIntervals(date_create("2000-11-31"), date_create("2900-12-31")); - - $this->assertEquals($read, $this->testObjects); - - $this->dao->delete($testObject); - - $this->auxDao->delete($auxObject); - - } - - public function testGetByIntervals3() - { - - $this->testObjects[1] = new HourCostHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setHourCost(3); - - $this->testObjects[2] = new HourCostHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("3000-12-31")); - $this->testObjects[2]->setEndDate(date_create("3999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setHourCost(3); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByIntervals(date_create("2999-12-31"), date_create("3000-12-31")); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByIntervalsUserId() - { - - $this->testObjects[1] = new HourCostHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2199-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setHourCost(3); - - $auxObject = new UserVO(); - $auxObject->setLogin("flexo"); - $auxObject->setPassword("kiss my metal shiny ass"); - - $this->auxDao->create($auxObject); - - $testObject = new HourCostHistoryVO(); - $testObject->setId(-1); - $testObject->setInitDate(date_create("2949-12-31")); - $testObject->setEndDate(date_create("2999-12-31")); - $testObject->setUserId($auxObject->getId()); - $testObject->setHourCost(3); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($testObject); - - $read = $this->dao->getByIntervals(date_create("2000-11-31"), date_create("3000-12-31"), $this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - $this->dao->delete($testObject); - - $this->auxDao->delete($auxObject); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIntervalsUserIdInvalid() - { - - $this->dao->getByIntervals(date_create("2000-11-31"), date_create("3000-12-31"), "zoidberg"); - - } - - public function testGetByUserIdFromUser() - { - - $this->testObjects[1] = new HourCostHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setHourCost(3); - - $this->testObjects[2] = new HourCostHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setHourCost(5); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->auxDao->getHourCostHistory($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setEndDate(NULL); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setEndDate(NULL); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLIterationDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLIterationDAOBasicTests.php deleted file mode 100644 index 1eecfcad0..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLIterationDAOBasicTests.php +++ /dev/null @@ -1,249 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/IterationVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/IterationDAO/PostgreSQLIterationDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/ProjectVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/ProjectDAO/PostgreSQLProjectDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/AreaVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/AreaDAO/PostgreSQLAreaDAO.php'); - -class PostgreSQLIterationDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - protected $auxDao; - protected $auxObject; - protected $auxDao2; - protected $auxObject2; - - protected function setUp() - { - - $this->auxDao2 = new PostgreSQLAreaDAO(); - - $this->auxObject2 = new AreaVO(); - $this->auxObject2->setName("Deliverers"); - - $this->auxDao2->create($this->auxObject2); - - $this->auxDao = new PostgreSQLProjectDAO(); - - $this->auxObject = new ProjectVO(); - $this->auxObject->setAreaId($this->auxObject2->getId()); - - $this->auxDao->create($this->auxObject); - - $this->dao = new PostgreSQLIterationDAO(); - - $this->testObjects[0] = new IterationVO(); - $this->testObjects[0]->setProjectId($this->auxObject->getId()); - $this->testObjects[0]->setName("Earth"); - $this->testObjects[0]->setInit(date_create("2100-01-01")); - $this->testObjects[0]->setEnd(date_create("2100-12-31")); - $this->testObjects[0]->setSummary("Deliveries on the Earth"); - $this->testObjects[0]->setId(-1); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - $this->auxDao->delete($this->auxObject); - - $this->auxDao2->delete($this->auxObject2); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testGetByProjectId() - { - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByProjectId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByProjectIdFromProject() - { - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->auxDao->getIterations($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setSummary(NULL); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setSummary(NULL); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLJourneyHistoryDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLJourneyHistoryDAOBasicTests.php deleted file mode 100644 index 4217031ce..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLJourneyHistoryDAOBasicTests.php +++ /dev/null @@ -1,429 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/JourneyHistoryVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/JourneyHistoryDAO/PostgreSQLJourneyHistoryDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/UserDAO/PostgreSQLUserDAO.php'); - -class PostgreSQLJourneyHistoryDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - protected $auxDao; - protected $auxObject; - - protected function setUp() - { - - $this->auxDao = new PostgreSQLUserDAO(); - - $this->auxObject = new UserVO(); - $this->auxObject->setLogin("bender"); - $this->auxObject->setPassword("kiss my metal shiny ass"); - - $this->auxDao->create($this->auxObject); - - $this->dao = new PostgreSQLJourneyHistoryDAO(); - - $this->testObjects[0] = new JourneyHistoryVO(); - $this->testObjects[0]->setId(-1); - $this->testObjects[0]->setInitDate(date_create("1999-12-31")); - $this->testObjects[0]->setEndDate(date_create("2999-12-31")); - $this->testObjects[0]->setUserId($this->auxObject->getId()); - $this->testObjects[0]->setJourney(2); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - $this->auxDao->delete($this->auxObject); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testGetByUserId() - { - - $this->testObjects[1] = new JourneyHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setJourney(3); - - $this->testObjects[2] = new JourneyHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setJourney(5); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByUserId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByUserIdVoid() - { - - $read = $this->dao->getByUserId($this->auxObject->getId()); - - $this->assertEquals(sizeof($read), 0); - - } - - public function testGetCurrentByUserId() - { - - $this->testObjects[1] = new JourneyHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setJourney(3); - - $this->testObjects[2] = new JourneyHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setJourney(5); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getCurrentByUserId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects[1]); - - } - - public function testGetByIntervals1() - { - - $this->testObjects[1] = new JourneyHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setJourney(3); - - $this->testObjects[2] = new JourneyHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setJourney(5); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByIntervals(date_create("1999-11-31"), date_create("3000-12-31")); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByIntervals2() - { - - $this->testObjects[1] = new JourneyHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2199-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setJourney(3); - - $auxObject = new UserVO(); - $auxObject->setLogin("flexo"); - $auxObject->setPassword("kiss my metal shiny ass"); - - $this->auxDao->create($auxObject); - - $testObject = new JourneyHistoryVO(); - $testObject->setId(-1); - $testObject->setInitDate(date_create("2949-12-31")); - $testObject->setEndDate(date_create("2999-12-31")); - $testObject->setUserId($auxObject->getId()); - $testObject->setJourney(5); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($testObject); - - $read = $this->dao->getByIntervals(date_create("2000-11-31"), date_create("2900-12-31")); - - $this->assertEquals($read, $this->testObjects); - - $this->dao->delete($testObject); - - $this->auxDao->delete($auxObject); - - } - - public function testGetByIntervals3() - { - - $this->testObjects[1] = new JourneyHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setJourney(3); - - $this->testObjects[2] = new JourneyHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("3000-12-31")); - $this->testObjects[2]->setEndDate(date_create("3999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setJourney(5); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByIntervals(date_create("2999-12-31"), date_create("3000-12-31")); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByIntervalsUserId() - { - - $this->testObjects[1] = new JourneyHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2199-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setJourney(3); - - $auxObject = new UserVO(); - $auxObject->setLogin("flexo"); - $auxObject->setPassword("kiss my metal shiny ass"); - - $this->auxDao->create($auxObject); - - $testObject = new JourneyHistoryVO(); - $testObject->setId(-1); - $testObject->setInitDate(date_create("2949-12-31")); - $testObject->setEndDate(date_create("2999-12-31")); - $testObject->setUserId($auxObject->getId()); - $testObject->setJourney(5); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($testObject); - - $read = $this->dao->getByIntervals(date_create("2000-11-31"), date_create("3000-12-31"), $this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - $this->dao->delete($testObject); - - $this->auxDao->delete($auxObject); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIntervalsUserIdInvalid() - { - - $this->dao->getByIntervals(date_create("2000-11-31"), date_create("3000-12-31"), "zoidberg"); - - } - - public function testGetByUserIdFromUser() - { - - $this->testObjects[1] = new JourneyHistoryVO(); - $this->testObjects[1]->setId(-1); - $this->testObjects[1]->setInitDate(date_create("2000-12-31")); - $this->testObjects[1]->setEndDate(date_create("2999-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setJourney(3); - - $this->testObjects[2] = new JourneyHistoryVO(); - $this->testObjects[2]->setId(-1); - $this->testObjects[2]->setInitDate(date_create("2001-12-31")); - $this->testObjects[2]->setEndDate(date_create("2999-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setJourney(5); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->auxDao->getJourneyHistory($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setEndDate(NULL); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setEndDate(NULL); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLModuleDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLModuleDAOBasicTests.php deleted file mode 100644 index e00cb5504..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLModuleDAOBasicTests.php +++ /dev/null @@ -1,249 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/ModuleVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/ModuleDAO/PostgreSQLModuleDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/ProjectVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/ProjectDAO/PostgreSQLProjectDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/AreaVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/AreaDAO/PostgreSQLAreaDAO.php'); - -class PostgreSQLModuleDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - protected $auxDao; - protected $auxObject; - protected $auxDao2; - protected $auxObject2; - - protected function setUp() - { - - $this->auxDao2 = new PostgreSQLAreaDAO(); - - $this->auxObject2 = new AreaVO(); - $this->auxObject2->setName("Deliverers"); - - $this->auxDao2->create($this->auxObject2); - - $this->auxDao = new PostgreSQLProjectDAO(); - - $this->auxObject = new ProjectVO(); - $this->auxObject->setAreaId($this->auxObject2->getId()); - - $this->auxDao->create($this->auxObject); - - $this->dao = new PostgreSQLModuleDAO(); - - $this->testObjects[0] = new ModuleVO(); - $this->testObjects[0]->setProjectId($this->auxObject->getId()); - $this->testObjects[0]->setName("Earth"); - $this->testObjects[0]->setInit(date_create("2100-01-01")); - $this->testObjects[0]->setEnd(date_create("2100-12-31")); - $this->testObjects[0]->setSummary("Deliveries on the Earth"); - $this->testObjects[0]->setId(-1); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - $this->auxDao->delete($this->auxObject); - - $this->auxDao2->delete($this->auxObject2); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testGetByProjectId() - { - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByProjectId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByProjectIdFromProject() - { - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->auxDao->getModules($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setSummary(NULL); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setSummary(NULL); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLProjectDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLProjectDAOBasicTests.php deleted file mode 100644 index 05a0eb371..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLProjectDAOBasicTests.php +++ /dev/null @@ -1,279 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/ProjectVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/ProjectDAO/PostgreSQLProjectDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/AreaVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/AreaDAO/PostgreSQLAreaDAO.php'); - -class PostgreSQLProjectDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - protected $auxDao; - protected $auxObject; - - protected function setUp() - { - - $this->auxDao = new PostgreSQLAreaDAO(); - - $this->auxObject = new AreaVO(); - $this->auxObject->setName("Deliverers"); - - $this->auxDao->create($this->auxObject); - - $this->dao = new PostgreSQLProjectDAO(); - - $this->testObjects[0] = new ProjectVO(); - $this->testObjects[0]->setInit(date_create("1999-12-31")); - $this->testObjects[0]->setAreaId($this->auxObject->getId()); - $this->testObjects[0]->setEnd(date_create("2999-12-31")); - $this->testObjects[0]->setDescription("Good news, everyone!"); - $this->testObjects[0]->setActivation(TRUE); - $this->testObjects[0]->setSchedType("Good news, everyone!"); - $this->testObjects[0]->setType("I've taught the toaster to feel love!"); - $this->testObjects[0]->setMovedHours(3.14); - $this->testObjects[0]->setInvoice(5.55); - $this->testObjects[0]->setEstHours(3.25); - $this->testObjects[0]->setId(-1); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - $this->auxDao->delete($this->auxObject); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testGetByAreaId() - { - - $this->testObjects[1] = new ProjectVO(); - $this->testObjects[1]->setInit(date_create("1999-12-31")); - $this->testObjects[1]->setAreaId($this->auxObject->getId()); - $this->testObjects[1]->setEnd(date_create("2999-12-31")); - $this->testObjects[1]->setDescription("Good news, everyone!"); - $this->testObjects[1]->setActivation(TRUE); - $this->testObjects[1]->setSchedType("Good news, everyone!"); - $this->testObjects[1]->setType("I've taught the toaster to feel love!"); - $this->testObjects[1]->setMovedHours(3.14); - $this->testObjects[1]->setInvoice(5.55); - $this->testObjects[1]->setEstHours(3.25); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new ProjectVO(); - $this->testObjects[2]->setInit(date_create("1999-12-31")); - $this->testObjects[2]->setAreaId($this->auxObject->getId()); - $this->testObjects[2]->setEnd(date_create("2999-12-31")); - $this->testObjects[2]->setDescription("Good news, everyone!"); - $this->testObjects[2]->setActivation(TRUE); - $this->testObjects[2]->setSchedType("Good news, everyone!"); - $this->testObjects[2]->setType("I've taught the toaster to feel love!"); - $this->testObjects[2]->setMovedHours(3.14); - $this->testObjects[2]->setInvoice(5.55); - $this->testObjects[2]->setEstHours(3.25); - $this->testObjects[2]->setId(-1); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByAreaId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByAreaIdFromArea() - { - - $this->testObjects[1] = new ProjectVO(); - $this->testObjects[1]->setInit(date_create("1999-12-31")); - $this->testObjects[1]->setAreaId($this->auxObject->getId()); - $this->testObjects[1]->setEnd(date_create("2999-12-31")); - $this->testObjects[1]->setDescription("Good news, everyone!"); - $this->testObjects[1]->setActivation(TRUE); - $this->testObjects[1]->setSchedType("Good news, everyone!"); - $this->testObjects[1]->setType("I've taught the toaster to feel love!"); - $this->testObjects[1]->setMovedHours(3.14); - $this->testObjects[1]->setInvoice(5.55); - $this->testObjects[1]->setEstHours(3.25); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new ProjectVO(); - $this->testObjects[2]->setInit(date_create("1999-12-31")); - $this->testObjects[2]->setAreaId($this->auxObject->getId()); - $this->testObjects[2]->setEnd(date_create("2999-12-31")); - $this->testObjects[2]->setDescription("Good news, everyone!"); - $this->testObjects[2]->setActivation(TRUE); - $this->testObjects[2]->setSchedType("Good news, everyone!"); - $this->testObjects[2]->setType("I've taught the toaster to feel love!"); - $this->testObjects[2]->setMovedHours(3.14); - $this->testObjects[2]->setInvoice(5.55); - $this->testObjects[2]->setEstHours(3.25); - $this->testObjects[2]->setId(-1); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->auxDao->getProjects($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setType(NULL); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setType(NULL); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLSectionDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLSectionDAOBasicTests.php deleted file mode 100644 index 98367e792..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLSectionDAOBasicTests.php +++ /dev/null @@ -1,277 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/SectionVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/SectionDAO/PostgreSQLSectionDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/ProjectVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/ProjectDAO/PostgreSQLProjectDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/AreaVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/AreaDAO/PostgreSQLAreaDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/ModuleVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/ModuleDAO/PostgreSQLModuleDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/UserDAO/PostgreSQLUserDAO.php'); - -class PostgreSQLSectionDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - protected $auxDao; - protected $auxObject; - protected $auxDao2; - protected $auxObject2; - protected $auxDao3; - protected $auxObject3; - protected $auxDao4; - protected $auxObject4; - - protected function setUp() - { - - $this->auxDao4 = new PostgreSQLUserDAO(); - - $this->auxObject4 = new UserVO(); - $this->auxObject4->setLogin("John Zoidberg"); - - $this->auxDao4->create($this->auxObject4); - - $this->auxDao3 = new PostgreSQLAreaDAO(); - - $this->auxObject3 = new AreaVO(); - $this->auxObject3->setName("Deliverers"); - - $this->auxDao3->create($this->auxObject3); - - $this->auxDao2 = new PostgreSQLProjectDAO(); - - $this->auxObject2 = new ProjectVO(); - $this->auxObject2->setAreaId($this->auxObject3->getId()); - - $this->auxDao2->create($this->auxObject2); - - $this->auxDao = new PostgreSQLModuleDAO(); - - $this->auxObject = new ModuleVO(); - $this->auxObject->setProjectId($this->auxObject2->getId()); - $this->auxObject->setName("Earth"); - $this->auxObject->setInit(date_create("2100-01-01")); - - $this->auxDao->create($this->auxObject); - - $this->dao = new PostgreSQLSectionDAO(); - - $this->testObjects[0] = new SectionVO(); - $this->testObjects[0]->setModuleId($this->auxObject->getId()); - $this->testObjects[0]->setName("Earth"); - $this->testObjects[0]->setText("Deliveries on Earth"); - $this->testObjects[0]->setAccepted(TRUE); - $this->testObjects[0]->setUserId($this->auxObject4->getId()); - $this->testObjects[0]->setId(-1); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - $this->auxDao->delete($this->auxObject); - - $this->auxDao2->delete($this->auxObject2); - - $this->auxDao3->delete($this->auxObject3); - - $this->auxDao4->delete($this->auxObject4); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testGetByModuleId() - { - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByModuleId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByModuleIdFromModule() - { - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->auxDao->getSections($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setAccepted(FALSE); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setAccepted(FALSE); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLSectorDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLSectorDAOBasicTests.php deleted file mode 100644 index 9e9a6e085..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLSectorDAOBasicTests.php +++ /dev/null @@ -1,186 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/SectorVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/SectorDAO/PostgreSQLSectorDAO.php'); - -class PostgreSQLSectorDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - - protected function setUp() - { - - $this->dao = new PostgreSQLSectorDAO(); - - $this->testObjects[0] = new SectorVO(); - $this->testObjects[0]->setName("Industry"); - $this->testObjects[0]->setId(-1); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setName("Cleaning"); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setName("Cleaning"); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setName("Teaching"); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setName("University"); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setName("University"); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLStoryDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLStoryDAOBasicTests.php deleted file mode 100644 index 307209c32..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLStoryDAOBasicTests.php +++ /dev/null @@ -1,276 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/StoryVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/StoryDAO/PostgreSQLStoryDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/ProjectVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/ProjectDAO/PostgreSQLProjectDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/AreaVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/AreaDAO/PostgreSQLAreaDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/IterationVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/IterationDAO/PostgreSQLIterationDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/UserDAO/PostgreSQLUserDAO.php'); - -class PostgreSQLStoryDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - protected $auxDao; - protected $auxObject; - protected $auxDao2; - protected $auxObject2; - protected $auxDao3; - protected $auxObject3; - protected $auxDao4; - protected $auxObject4; - - protected function setUp() - { - - $this->auxDao4 = new PostgreSQLUserDAO(); - - $this->auxObject4 = new UserVO(); - $this->auxObject4->setLogin("John Zoidberg"); - - $this->auxDao4->create($this->auxObject4); - - $this->auxDao3 = new PostgreSQLAreaDAO(); - - $this->auxObject3 = new AreaVO(); - $this->auxObject3->setName("Deliverers"); - - $this->auxDao3->create($this->auxObject3); - - $this->auxDao2 = new PostgreSQLProjectDAO(); - - $this->auxObject2 = new ProjectVO(); - $this->auxObject2->setAreaId($this->auxObject3->getId()); - - $this->auxDao2->create($this->auxObject2); - - $this->auxDao = new PostgreSQLIterationDAO(); - - $this->auxObject = new IterationVO(); - $this->auxObject->setProjectId($this->auxObject2->getId()); - $this->auxObject->setName("Earth"); - $this->auxObject->setInit(date_create("2100-01-01")); - - $this->auxDao->create($this->auxObject); - - $this->dao = new PostgreSQLStoryDAO(); - - $this->testObjects[0] = new StoryVO(); - $this->testObjects[0]->setIterationId($this->auxObject->getId()); - $this->testObjects[0]->setName("Earth"); - $this->testObjects[0]->setAccepted(TRUE); - $this->testObjects[0]->setUserId($this->auxObject4->getId()); - $this->testObjects[0]->setId(-1); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - $this->auxDao->delete($this->auxObject); - - $this->auxDao2->delete($this->auxObject2); - - $this->auxDao3->delete($this->auxObject3); - - $this->auxDao4->delete($this->auxObject4); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testGetByIterationId() - { - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByIterationId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByIterationIdFromIteration() - { - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->auxDao->getStories($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setAccepted(FALSE); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setAccepted(FALSE); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLTaskDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLTaskDAOBasicTests.php deleted file mode 100644 index eff40df48..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLTaskDAOBasicTests.php +++ /dev/null @@ -1,1096 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/util/TaskReportInvalidParameterException.php'); -include_once(PHPREPORT_ROOT . '/util/SQLIncorrectTypeException.php'); -include_once(PHPREPORT_ROOT . '/model/vo/TaskVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/TaskDAO/PostgreSQLTaskDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/UserDAO/PostgreSQLUserDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/SectorVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/SectorDAO/PostgreSQLSectorDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/CustomerVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/CustomerDAO/PostgreSQLCustomerDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/AreaVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/AreaDAO/PostgreSQLAreaDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/ProjectVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/ProjectDAO/PostgreSQLProjectDAO.php'); - -class PostgreSQLTaskDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $auxObjects; - protected $auxDao; - protected $auxObject; - - protected function setUp() - { - - $this->auxDao = new PostgreSQLUserDAO(); - - $this->auxObject = new UserVO(); - $this->auxObject->setLogin("bender"); - $this->auxObject->setPassword("kiss my metal shiny ass"); - - $this->auxDao->create($this->auxObject); - - $this->dao = new PostgreSQLTaskDAO(); - - $this->testObjects[0] = new TaskVO(); - $this->testObjects[0]->setDate(date_create("1999-12-31")); - $this->testObjects[0]->setUserId($this->auxObject->getId()); - $this->testObjects[0]->setInit(2); - $this->testObjects[0]->setEnd(3); - $this->testObjects[0]->setStory("Good news, everyone!"); - $this->testObjects[0]->setTelework(TRUE); - $this->testObjects[0]->setText("Good news, everyone!"); - $this->testObjects[0]->setTtype("I've taught the toaster to feel love!"); - $this->testObjects[0]->setPhase("Scruffy"); - $this->testObjects[0]->setId(-1); - - } - - protected function tearDown() - { - foreach($this->testObjects as $auxObject) - $this->dao->delete($auxObject); - - $this->auxDao->delete($this->auxObject); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setDate(date_create("2000-11-30")); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetTaskReportByUser() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setDate(date_create("2000-11-30")); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setDate(date_create("2001-11-30")); - - $this->dao->create($this->testObjects[2]); - - $add_hours = (($this->testObjects[0]->getEnd()-$this->testObjects[0]->getInit())+($this->testObjects[1]->getEnd()-$this->testObjects[1]->getInit())+($this->testObjects[2]->getEnd()-$this->testObjects[2]->getInit()))/60.00; - - $res = $this->dao->getTaskReport($this->auxObject); - - $this->assertEquals($add_hours, $res[0][add_hours]); - - } - - public function testGetTaskReportByUserDates() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setDate(date_create("2000-11-30")); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setDate(date_create("1999-11-30")); - - $this->dao->create($this->testObjects[2]); - - $add_hours = (($this->testObjects[1]->getEnd()-$this->testObjects[1]->getInit())+($this->testObjects[0]->getEnd()-$this->testObjects[0]->getInit()))/60.00; - - $res = $this->dao->getTaskReport($this->auxObject, date_create("1999-12-31"), date_create("2999-11-30")); - - $this->assertEquals($add_hours, $res[0][add_hours]); - - } - - public function testGetTaskReportByUserDatesGroupByType() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setDate(date_create("2000-11-30")); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setDate(date_create("2001-11-30")); - - $this->testObjects[2]->setTtype("My name's Scruffy"); - - $this->dao->create($this->testObjects[2]); - - $add_hours1 = (($this->testObjects[1]->getEnd()-$this->testObjects[1]->getInit())+($this->testObjects[0]->getEnd()-$this->testObjects[0]->getInit()))/60.00; - - $add_hours2 = ($this->testObjects[2]->getEnd()-$this->testObjects[2]->getInit())/60.00; - - $res = $this->dao->getTaskReport($this->auxObject, date_create("1999-12-31"), date_create("2999-11-30"), "TTYPE"); - - $this->assertEquals($add_hours1, $res[0][add_hours]); - $this->assertEquals($add_hours2, $res[1][add_hours]); - - } - - public function testGetTaskReportByCustomer() - { - - $dao2 = new PostgreSQLSectorDAO(); - - $auxObject2 = new SectorVO(); - $auxObject2->setName("Industry"); - - $dao2->create($auxObject2); - - $dao = new PostgreSQLCustomerDAO(); - - $auxObject = new CustomerVO(); - $auxObject->setSectorId($auxObject2->getId()); - $auxObject->setName("Mommy"); - $auxObject->setType("Biggest industry on Earth"); - $auxObject->setURL("www.mommyindustries.com"); - $auxObject->setId(-1); - - $dao->create($auxObject); - - $this->testObjects[0]->setCustomerId($auxObject->getId()); - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setDate(date_create("2000-11-30")); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setDate(date_create("2001-11-30")); - - $this->dao->create($this->testObjects[2]); - - $add_hours = (($this->testObjects[0]->getEnd()-$this->testObjects[0]->getInit())+($this->testObjects[1]->getEnd()-$this->testObjects[1]->getInit())+($this->testObjects[2]->getEnd()-$this->testObjects[2]->getInit()))/60.00; - - $res = $this->dao->getTaskReport($auxObject); - - $this->assertEquals($add_hours, $res[0][add_hours]); - - foreach($this->testObjects as $aux) - $this->dao->delete($aux); - - $dao->delete($auxObject); - - $dao2->delete($auxObject2); - - } - - public function testGetTaskReportByCustomerDates() - { - - $dao2 = new PostgreSQLSectorDAO(); - - $auxObject2 = new SectorVO(); - $auxObject2->setName("Industry"); - - $dao2->create($auxObject2); - - $dao = new PostgreSQLCustomerDAO(); - - $auxObject = new CustomerVO(); - $auxObject->setSectorId($auxObject2->getId()); - $auxObject->setName("Mommy"); - $auxObject->setType("Biggest industry on Earth"); - $auxObject->setURL("www.mommyindustries.com"); - $auxObject->setId(-1); - - $dao->create($auxObject); - - $this->testObjects[0]->setCustomerId($auxObject->getId()); - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setDate(date_create("2000-11-30")); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setDate(date_create("1999-11-30")); - - $this->dao->create($this->testObjects[2]); - - $add_hours = (($this->testObjects[1]->getEnd()-$this->testObjects[1]->getInit())+($this->testObjects[0]->getEnd()-$this->testObjects[0]->getInit()))/60.00; - - $res = $this->dao->getTaskReport($auxObject, date_create("1999-12-31"), date_create("2999-11-30")); - - $this->assertEquals($add_hours, $res[0][add_hours]); - - foreach($this->testObjects as $aux) - $this->dao->delete($aux); - - $dao->delete($auxObject); - - $dao2->delete($auxObject2); - - } - - public function testGetTaskReportByCustomerDatesGroupByType() - { - - $dao2 = new PostgreSQLSectorDAO(); - - $auxObject2 = new SectorVO(); - $auxObject2->setName("Industry"); - - $dao2->create($auxObject2); - - $dao = new PostgreSQLCustomerDAO(); - - $auxObject = new CustomerVO(); - $auxObject->setSectorId($auxObject2->getId()); - $auxObject->setName("Mommy"); - $auxObject->setType("Biggest industry on Earth"); - $auxObject->setURL("www.mommyindustries.com"); - $auxObject->setId(-1); - - $dao->create($auxObject); - - $this->testObjects[0]->setCustomerId($auxObject->getId()); - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setDate(date_create("2000-11-30")); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setDate(date_create("2001-11-30")); - - $this->testObjects[2]->setTtype("My name's Scruffy"); - - $this->dao->create($this->testObjects[2]); - - $add_hours1 = (($this->testObjects[1]->getEnd()-$this->testObjects[1]->getInit())+($this->testObjects[0]->getEnd()-$this->testObjects[0]->getInit()))/60.00; - - $add_hours2 = ($this->testObjects[1]->getEnd()-$this->testObjects[1]->getInit())/60.00; - - $res = $this->dao->getTaskReport($this->auxObject, date_create("1999-12-31"), date_create("2999-11-30"), "TTYPE"); - - $this->assertEquals($add_hours1, $res[0][add_hours]); - $this->assertEquals($add_hours2, $res[1][add_hours]); - - foreach($this->testObjects as $aux) - $this->dao->delete($aux); - - $dao->delete($auxObject); - - $dao2->delete($auxObject2); - - } - - public function testGetTaskReportByProject() - { - - $dao2 = new PostgreSQLAreaDAO(); - - $auxObject2 = new AreaVO(); - $auxObject2->setName("Deliverers"); - - $dao2->create($auxObject2); - - $dao = new PostgreSQLProjectDAO(); - - $auxObject = new ProjectVO(); - $auxObject->setInit(date_create("1999-12-31")); - $auxObject->setAreaId($auxObject2->getId()); - $auxObject->setEnd(date_create("2999-12-31")); - $auxObject->setDescription("Good news, everyone!"); - $auxObject->setActivation(TRUE); - $auxObject->setSchedType("Good news, everyone!"); - $auxObject->setType("I've taught the toaster to feel love!"); - $auxObject->setMovedHours(3.14); - $auxObject->setInvoice(5.55); - $auxObject->setEstHours(3.25); - $auxObject->setId(-1); - - $dao->create($auxObject); - - $this->testObjects[0]->setProjectId($auxObject->getId()); - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setDate(date_create("2000-11-30")); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setDate(date_create("2001-11-30")); - - $this->dao->create($this->testObjects[2]); - - $add_hours = (($this->testObjects[0]->getEnd()-$this->testObjects[0]->getInit())+($this->testObjects[1]->getEnd()-$this->testObjects[1]->getInit())+($this->testObjects[2]->getEnd()-$this->testObjects[2]->getInit()))/60.00; - - $res = $this->dao->getTaskReport($auxObject); - - $this->assertEquals($add_hours, $res[0][add_hours]); - - foreach($this->testObjects as $aux) - $this->dao->delete($aux); - - $dao->delete($auxObject); - - $dao2->delete($auxObject2); - - } - - public function testGetTaskReportByProjectDates() - { - - $dao2 = new PostgreSQLAreaDAO(); - - $auxObject2 = new AreaVO(); - $auxObject2->setName("Deliverers"); - - $dao2->create($auxObject2); - - $dao = new PostgreSQLProjectDAO(); - - $auxObject = new ProjectVO(); - $auxObject->setInit(date_create("1999-12-31")); - $auxObject->setAreaId($auxObject2->getId()); - $auxObject->setEnd(date_create("2999-12-31")); - $auxObject->setDescription("Good news, everyone!"); - $auxObject->setActivation(TRUE); - $auxObject->setSchedType("Good news, everyone!"); - $auxObject->setType("I've taught the toaster to feel love!"); - $auxObject->setMovedHours(3.14); - $auxObject->setInvoice(5.55); - $auxObject->setEstHours(3.25); - $auxObject->setId(-1); - - $dao->create($auxObject); - - $this->testObjects[0]->setProjectId($auxObject->getId()); - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setDate(date_create("2000-11-30")); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setDate(date_create("3999-11-30")); - - $this->dao->create($this->testObjects[2]); - - $add_hours = (($this->testObjects[1]->getEnd()-$this->testObjects[1]->getInit())+($this->testObjects[0]->getEnd()-$this->testObjects[0]->getInit()))/60.00; - - $res = $this->dao->getTaskReport($auxObject, date_create("1999-12-31"), date_create("2999-11-30")); - - $this->assertEquals($add_hours, $res[0][add_hours]); - - foreach($this->testObjects as $aux) - $this->dao->delete($aux); - - $dao->delete($auxObject); - - $dao2->delete($auxObject2); - - } - - public function testGetTaskReportByProjectDatesGroupByType() - { - - $dao2 = new PostgreSQLAreaDAO(); - - $auxObject2 = new AreaVO(); - $auxObject2->setName("Deliverers"); - - $dao2->create($auxObject2); - - $dao = new PostgreSQLProjectDAO(); - - $auxObject = new ProjectVO(); - $auxObject->setInit(date_create("1999-12-31")); - $auxObject->setAreaId($auxObject2->getId()); - $auxObject->setEnd(date_create("2999-12-31")); - $auxObject->setDescription("Good news, everyone!"); - $auxObject->setActivation(TRUE); - $auxObject->setSchedType("Good news, everyone!"); - $auxObject->setType("I've taught the toaster to feel love!"); - $auxObject->setMovedHours(3.14); - $auxObject->setInvoice(5.55); - $auxObject->setEstHours(3.25); - $auxObject->setId(-1); - - $dao->create($auxObject); - - $this->testObjects[0]->setProjectId($auxObject->getId()); - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setDate(date_create("2000-11-30")); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setDate(date_create("2001-11-30")); - - $this->testObjects[2]->setTtype("My name's Scruffy"); - - $this->dao->create($this->testObjects[2]); - - $add_hours1 = (($this->testObjects[1]->getEnd()-$this->testObjects[1]->getInit())+($this->testObjects[0]->getEnd()-$this->testObjects[0]->getInit()))/60.00; - - $add_hours2 = ($this->testObjects[1]->getEnd()-$this->testObjects[1]->getInit())/60.00; - - $res = $this->dao->getTaskReport($this->auxObject, date_create("1999-12-31"), date_create("2999-11-30"), "TTYPE"); - - $this->assertEquals($add_hours1, $res[0][add_hours]); - $this->assertEquals($add_hours2, $res[1][add_hours]); - - foreach($this->testObjects as $aux) - $this->dao->delete($aux); - - $dao->delete($auxObject); - - $dao2->delete($auxObject2); - - } - - public function testGetGlobalTaskReportByProjectDates() - { - $dao3 = new PostgreSQLUserDAO(); - - $auxObject3 = new UserVO(); - $auxObject3->setLogin("fry"); - $auxObject3->setPassword("Pizza delivery for I. C. Weiner"); - - $dao3->create($auxObject3); - - $dao2 = new PostgreSQLAreaDAO(); - - $auxObject2 = new AreaVO(); - $auxObject2->setName("Deliverers"); - - $dao2->create($auxObject2); - - $dao = new PostgreSQLProjectDAO(); - - $auxObject = new ProjectVO(); - $auxObject->setInit(date_create("1999-12-31")); - $auxObject->setAreaId($auxObject2->getId()); - $auxObject->setEnd(date_create("2999-12-31")); - $auxObject->setDescription("Good news, everyone!"); - $auxObject->setActivation(TRUE); - $auxObject->setSchedType("Good news, everyone!"); - $auxObject->setType("I've taught the toaster to feel love!"); - $auxObject->setMovedHours(3.14); - $auxObject->setInvoice(5.55); - $auxObject->setEstHours(3.25); - $auxObject->setId(-1); - - $dao->create($auxObject); - - $this->testObjects[0]->setProjectId($auxObject->getId()); - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setDate(date_create("2000-11-30")); - - $this->testObjects[1]->setUserId($auxObject3->getId()); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setDate(date_create("3999-11-30")); - - $this->dao->create($this->testObjects[2]); - - $add_hours1 = ($this->testObjects[0]->getEnd()-$this->testObjects[0]->getInit())/60.00; - $add_hours2 = ($this->testObjects[1]->getEnd()-$this->testObjects[1]->getInit())/60.00; - - $res = $this->dao->getGlobalTaskReport(date_create("1999-12-31"), date_create("2999-11-30"), 'USER'); - - $this->assertEquals($add_hours1, $res[0][add_hours]); - $this->assertEquals($add_hours2, $res[1][add_hours]); - - foreach($this->testObjects as $aux) - $this->dao->delete($aux); - - $dao->delete($auxObject); - - $dao2->delete($auxObject2); - - $dao3->delete($auxObject3); - - } - - public function testGetVacations() - { - - $dao2 = new PostgreSQLAreaDAO(); - - $auxObject2 = new AreaVO(); - $auxObject2->setName("Deliverers"); - - $dao2->create($auxObject2); - - $dao = new PostgreSQLProjectDAO(); - - $auxObject = new ProjectVO(); - $auxObject->setInit(date_create("1999-12-31")); - $auxObject->setAreaId($auxObject2->getId()); - $auxObject->setEnd(date_create("2999-12-31")); - $auxObject->setDescription("vac"); - $auxObject->setActivation(TRUE); - $auxObject->setSchedType("Good news, everyone!"); - $auxObject->setType("I've taught the toaster to feel love!"); - $auxObject->setMovedHours(3.14); - $auxObject->setInvoice(5.55); - $auxObject->setEstHours(3.25); - $auxObject->setId(-1); - - $auxObject3 = new ProjectVO(); - $auxObject3->setInit(date_create("1999-12-31")); - $auxObject3->setAreaId($auxObject2->getId()); - $auxObject3->setEnd(date_create("2999-12-31")); - $auxObject3->setDescription("Good news, everyone!"); - $auxObject3->setActivation(TRUE); - $auxObject3->setSchedType("Good news, everyone!"); - $auxObject3->setType("I've taught the toaster to feel love!"); - $auxObject3->setMovedHours(3.14); - $auxObject3->setInvoice(5.55); - $auxObject3->setEstHours(3.25); - $auxObject3->setId(-1); - - $dao->create($auxObject); - - $dao->create($auxObject3); - - $this->testObjects[0]->setProjectId($auxObject->getId()); - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setProjectId($auxObject3->getId()); - - $this->testObjects[1]->setDate(date_create("2000-11-30")); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setDate(date_create("3999-11-30")); - - $this->dao->create($this->testObjects[2]); - - $add_hours = ($this->testObjects[0]->getEnd()-$this->testObjects[0]->getInit())/60.00; - - $res = $this->dao->getVacations($this->auxObject, date_create("1999-12-31"), date_create("2999-11-30")); - - $this->assertEquals($add_hours, $res[add_hours]); - - foreach($this->testObjects as $aux) - $this->dao->delete($aux); - - $dao->delete($auxObject); - - $dao->delete($auxObject3); - - $dao2->delete($auxObject2); - - - } - - - /** - * @expectedException TaskReportInvalidParameterException - */ - public function testGetTaskInvalidField1() - { - - $res = $this->dao->getTaskReport($this->auxObject, date_create("1999-12-31"), date_create("2999-11-30"), "ZOIDBERG"); - - } - - - /** - * @expectedException TaskReportInvalidParameterException - */ - public function testGetTaskInvalidField2() - { - - $res = $this->dao->getTaskReport($this->auxObject, date_create("1999-12-31"), date_create("2999-11-30"), "TTYPE", "ZOIDBERG"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setDate(date_create("2000-11-30")); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setDate(date_create("2001-11-30")); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testGetByUserId() - { - - $this->testObjects[1] = new TaskVO(); - $this->testObjects[1]->setDate(date_create("2000-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setInit(2); - $this->testObjects[1]->setEnd(3); - $this->testObjects[1]->setStory("Good news, everyone!"); - $this->testObjects[1]->setTelework(TRUE); - $this->testObjects[1]->setText("Good news, everyone!"); - $this->testObjects[1]->setTtype("I've taught the toaster to feel love!"); - $this->testObjects[1]->setPhase("Scruffy"); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new TaskVO(); - $this->testObjects[2]->setDate(date_create("2001-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setInit(2); - $this->testObjects[2]->setEnd(3); - $this->testObjects[2]->setStory("Good news, everyone!"); - $this->testObjects[2]->setTelework(TRUE); - $this->testObjects[2]->setText("Good news, everyone!"); - $this->testObjects[2]->setTtype("I've taught the toaster to feel love!"); - $this->testObjects[2]->setPhase("Scruffy"); - $this->testObjects[2]->setId(-1); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByUserId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByProjectId() - { - - $auxDao = new PostgreSQLAreaDAO(); - - $auxObject2 = new AreaVO(); - $auxObject2->setName("Deliverers"); - - $auxDao->create($auxObject2); - - $dao = new PostgreSQLProjectDAO(); - - $auxObject = new ProjectVO(); - $auxObject->setInit(date_create("1999-12-31")); - $auxObject->setAreaId($auxObject2->getId()); - $auxObject->setEnd(date_create("2999-12-31")); - $auxObject->setDescription("Good news, everyone!"); - $auxObject->setActivation(TRUE); - $auxObject->setSchedType("Good news, everyone!"); - $auxObject->setType("I've taught the toaster to feel love!"); - $auxObject->setMovedHours(3.14); - $auxObject->setInvoice(5.55); - $auxObject->setEstHours(3.25); - $auxObject->setId(-1); - - $dao->create($auxObject); - - $this->testObjects[1] = new TaskVO(); - $this->testObjects[1]->setDate(date_create("2000-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setInit(2); - $this->testObjects[1]->setEnd(3); - $this->testObjects[1]->setStory("Good news, everyone!"); - $this->testObjects[1]->setTelework(TRUE); - $this->testObjects[1]->setText("Good news, everyone!"); - $this->testObjects[1]->setTtype("I've taught the toaster to feel love!"); - $this->testObjects[1]->setPhase("Scruffy"); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new TaskVO(); - $this->testObjects[2]->setDate(date_create("2001-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setInit(2); - $this->testObjects[2]->setEnd(3); - $this->testObjects[2]->setStory("Good news, everyone!"); - $this->testObjects[2]->setTelework(TRUE); - $this->testObjects[2]->setText("Good news, everyone!"); - $this->testObjects[2]->setTtype("I've taught the toaster to feel love!"); - $this->testObjects[2]->setPhase("Scruffy"); - $this->testObjects[2]->setId(-1); - - $this->testObjects[0]->setProjectId($auxObject->getId()); - $this->testObjects[1]->setProjectId($auxObject->getId()); - $this->testObjects[2]->setProjectId($auxObject->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByProjectId($auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - $this->dao->delete($this->testObjects[0]); - $this->dao->delete($this->testObjects[1]); - $this->dao->delete($this->testObjects[2]); - - $dao->delete($auxObject); - - $auxDao->delete($auxObject2); - - } - - public function testGetByUserIdFromUser() - { - - $this->testObjects[1] = new TaskVO(); - $this->testObjects[1]->setDate(date_create("2000-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setInit(2); - $this->testObjects[1]->setEnd(3); - $this->testObjects[1]->setStory("Good news, everyone!"); - $this->testObjects[1]->setTelework(TRUE); - $this->testObjects[1]->setText("Good news, everyone!"); - $this->testObjects[1]->setTtype("I've taught the toaster to feel love!"); - $this->testObjects[1]->setPhase("Scruffy"); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new TaskVO(); - $this->testObjects[2]->setDate(date_create("2001-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setInit(2); - $this->testObjects[2]->setEnd(3); - $this->testObjects[2]->setStory("Good news, everyone!"); - $this->testObjects[2]->setTelework(TRUE); - $this->testObjects[2]->setText("Good news, everyone!"); - $this->testObjects[2]->setTtype("I've taught the toaster to feel love!"); - $this->testObjects[2]->setPhase("Scruffy"); - $this->testObjects[2]->setId(-1); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->auxDao->getTasks($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByCustomerIdFromCustomer() - { - - $auxDao = new PostgreSQLSectorDAO(); - - $auxObject2 = new SectorVO(); - $auxObject2->setName("Industry"); - - $auxDao->create($auxObject2); - - $dao = new PostgreSQLCustomerDAO(); - - $auxObject = new CustomerVO(); - $auxObject->setSectorId($auxObject2->getId()); - $auxObject->setName("Mommy"); - $auxObject->setType("Biggest industry on Earth"); - $auxObject->setURL("www.mommyindustries.com"); - $auxObject->setId(-1); - - $dao->create($auxObject); - - $this->testObjects[1] = new TaskVO(); - $this->testObjects[1]->setDate(date_create("2000-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setInit(2); - $this->testObjects[1]->setEnd(3); - $this->testObjects[1]->setStory("Good news, everyone!"); - $this->testObjects[1]->setTelework(TRUE); - $this->testObjects[1]->setText("Good news, everyone!"); - $this->testObjects[1]->setTtype("I've taught the toaster to feel love!"); - $this->testObjects[1]->setPhase("Scruffy"); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new TaskVO(); - $this->testObjects[2]->setDate(date_create("2001-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setInit(2); - $this->testObjects[2]->setEnd(3); - $this->testObjects[2]->setStory("Good news, everyone!"); - $this->testObjects[2]->setTelework(TRUE); - $this->testObjects[2]->setText("Good news, everyone!"); - $this->testObjects[2]->setTtype("I've taught the toaster to feel love!"); - $this->testObjects[2]->setPhase("Scruffy"); - $this->testObjects[2]->setId(-1); - - $this->testObjects[0]->setCustomerId($auxObject->getId()); - $this->testObjects[1]->setCustomerId($auxObject->getId()); - $this->testObjects[2]->setCustomerId($auxObject->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $dao->getTasks($auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - $this->dao->delete($this->testObjects[0]); - $this->dao->delete($this->testObjects[1]); - $this->dao->delete($this->testObjects[2]); - - $dao->delete($auxObject); - - $auxDao->delete($auxObject2); - - } - - public function testGetByProjectIdFromProject() - { - - $auxDao = new PostgreSQLAreaDAO(); - - $auxObject2 = new AreaVO(); - $auxObject2->setName("Deliverers"); - - $auxDao->create($auxObject2); - - $dao = new PostgreSQLProjectDAO(); - - $auxObject = new ProjectVO(); - $auxObject->setInit(date_create("1999-12-31")); - $auxObject->setAreaId($auxObject2->getId()); - $auxObject->setEnd(date_create("2999-12-31")); - $auxObject->setDescription("Good news, everyone!"); - $auxObject->setActivation(TRUE); - $auxObject->setSchedType("Good news, everyone!"); - $auxObject->setType("I've taught the toaster to feel love!"); - $auxObject->setMovedHours(3.14); - $auxObject->setInvoice(5.55); - $auxObject->setEstHours(3.25); - $auxObject->setId(-1); - - $dao->create($auxObject); - - $this->testObjects[1] = new TaskVO(); - $this->testObjects[1]->setDate(date_create("2000-12-31")); - $this->testObjects[1]->setUserId($this->auxObject->getId()); - $this->testObjects[1]->setInit(2); - $this->testObjects[1]->setEnd(3); - $this->testObjects[1]->setStory("Good news, everyone!"); - $this->testObjects[1]->setTelework(TRUE); - $this->testObjects[1]->setText("Good news, everyone!"); - $this->testObjects[1]->setTtype("I've taught the toaster to feel love!"); - $this->testObjects[1]->setPhase("Scruffy"); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new TaskVO(); - $this->testObjects[2]->setDate(date_create("2001-12-31")); - $this->testObjects[2]->setUserId($this->auxObject->getId()); - $this->testObjects[2]->setInit(2); - $this->testObjects[2]->setEnd(3); - $this->testObjects[2]->setStory("Good news, everyone!"); - $this->testObjects[2]->setTelework(TRUE); - $this->testObjects[2]->setText("Good news, everyone!"); - $this->testObjects[2]->setTtype("I've taught the toaster to feel love!"); - $this->testObjects[2]->setPhase("Scruffy"); - $this->testObjects[2]->setId(-1); - - $this->testObjects[0]->setProjectId($auxObject->getId()); - $this->testObjects[1]->setProjectId($auxObject->getId()); - $this->testObjects[2]->setProjectId($auxObject->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $dao->getTasks($auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - $this->dao->delete($this->testObjects[0]); - $this->dao->delete($this->testObjects[1]); - $this->dao->delete($this->testObjects[2]); - - $dao->delete($auxObject); - - $auxDao->delete($auxObject2); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setPhase(NULL); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setPhase(NULL); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLTaskSectionDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLTaskSectionDAOBasicTests.php deleted file mode 100644 index ba397e184..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLTaskSectionDAOBasicTests.php +++ /dev/null @@ -1,335 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/TaskSectionVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/TaskSectionDAO/PostgreSQLTaskSectionDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/SectionVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/SectionDAO/PostgreSQLSectionDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/ProjectVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/ProjectDAO/PostgreSQLProjectDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/AreaVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/AreaDAO/PostgreSQLAreaDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/ModuleVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/ModuleDAO/PostgreSQLModuleDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/UserDAO/PostgreSQLUserDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/IterationVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/IterationDAO/PostgreSQLIterationDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/StoryVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/StoryDAO/PostgreSQLStoryDAO.php'); - -class PostgreSQLTaskSectionDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - protected $auxDao; - protected $auxObject; - protected $auxDao2; - protected $auxObject2; - protected $auxDao3; - protected $auxObject3; - protected $auxDao4; - protected $auxObject4; - protected $auxDao5; - protected $auxObject5; - - protected function setUp() - { - - $this->auxDao5 = new PostgreSQLUserDAO(); - - $this->auxObject5 = new UserVO(); - $this->auxObject5->setLogin("John Zoidberg"); - - $this->auxDao5->create($this->auxObject5); - - $this->auxDao4 = new PostgreSQLAreaDAO(); - - $this->auxObject4 = new AreaVO(); - $this->auxObject4->setName("Deliverers"); - - $this->auxDao4->create($this->auxObject4); - - $this->auxDao3 = new PostgreSQLProjectDAO(); - - $this->auxObject3 = new ProjectVO(); - $this->auxObject3->setAreaId($this->auxObject4->getId()); - - $this->auxDao3->create($this->auxObject3); - - $this->auxDao2 = new PostgreSQLModuleDAO(); - - $this->auxObject2 = new ModuleVO(); - $this->auxObject2->setProjectId($this->auxObject3->getId()); - $this->auxObject2->setName("Earth"); - $this->auxObject2->setInit(date_create("2100-01-01")); - - $this->auxDao2->create($this->auxObject2); - - $this->auxDao = new PostgreSQLSectionDAO(); - - $this->auxObject = new SectionVO(); - $this->auxObject->setModuleId($this->auxObject2->getId()); - $this->auxObject->setName("Earth"); - $this->auxObject->setUserId($this->auxObject5->getId()); - - $this->auxDao->create($this->auxObject); - - $this->dao = new PostgreSQLTaskSectionDAO(); - - $this->testObjects[0] = new TaskSectionVO(); - $this->testObjects[0]->setSectionId($this->auxObject->getId()); - $this->testObjects[0]->setName("Earth"); - $this->testObjects[0]->setEstHours(10); - $this->testObjects[0]->setRisk(2); - $this->testObjects[0]->setUserId($this->auxObject5->getId()); - $this->testObjects[0]->setId(-1); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - $this->auxDao->delete($this->auxObject); - - $this->auxDao2->delete($this->auxObject2); - - $this->auxDao3->delete($this->auxObject3); - - $this->auxDao4->delete($this->auxObject4); - - $this->auxDao5->delete($this->auxObject5); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testGetBySectionId() - { - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getBySectionId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetBySectionIdFromSection() - { - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->auxDao->getTaskSections($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - } - - public function testGetByStoryId() - { - $auxDao = new PostgreSQLIterationDAO(); - - $auxObject = new IterationVO(); - $auxObject->setProjectId($this->auxObject3->getId()); - $auxObject->setName("Earth"); - $auxObject->setInit(date_create("2100-01-01")); - - $auxDao->create($auxObject); - - $auxDao2 = new PostgreSQLStoryDAO(); - - $auxObject2 = new StoryVO(); - $auxObject2->setIterationId($auxObject->getId()); - $auxObject2->setName("Earth"); - $auxObject2->setUserId($this->auxObject5->getId()); - - $auxDao2->create($auxObject2); - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByStoryId($auxObject2->getId()); - - $this->assertEquals($read, $this->testObjects); - - $auxDao2->delete($auxObject2); - $auxDao->delete($auxObject); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setRisk(0); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setRisk(0); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLTaskStoryDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLTaskStoryDAOBasicTests.php deleted file mode 100644 index 64a9c02fb..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLTaskStoryDAOBasicTests.php +++ /dev/null @@ -1,504 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/TaskStoryVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/TaskStoryDAO/PostgreSQLTaskStoryDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/StoryVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/StoryDAO/PostgreSQLStoryDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/ProjectVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/ProjectDAO/PostgreSQLProjectDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/AreaVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/AreaDAO/PostgreSQLAreaDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/IterationVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/IterationDAO/PostgreSQLIterationDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/UserDAO/PostgreSQLUserDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/ModuleVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/ModuleDAO/PostgreSQLModuleDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/TaskSectionVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/TaskSectionDAO/PostgreSQLTaskSectionDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/SectionVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/SectionDAO/PostgreSQLSectionDAO.php'); - -class PostgreSQLTaskStoryDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - protected $auxDao; - protected $auxObject; - protected $auxDao2; - protected $auxObject2; - protected $auxDao3; - protected $auxObject3; - protected $auxDao4; - protected $auxObject4; - protected $auxDao5; - protected $auxObject5; - - protected function setUp() - { - - $this->auxDao5 = new PostgreSQLUserDAO(); - - $this->auxObject5 = new UserVO(); - $this->auxObject5->setLogin("John Zoidberg"); - - $this->auxDao5->create($this->auxObject5); - - $this->auxDao4 = new PostgreSQLAreaDAO(); - - $this->auxObject4 = new AreaVO(); - $this->auxObject4->setName("Deliverers"); - - $this->auxDao4->create($this->auxObject4); - - $this->auxDao3 = new PostgreSQLProjectDAO(); - - $this->auxObject3 = new ProjectVO(); - $this->auxObject3->setAreaId($this->auxObject4->getId()); - - $this->auxDao3->create($this->auxObject3); - - $this->auxDao2 = new PostgreSQLIterationDAO(); - - $this->auxObject2 = new IterationVO(); - $this->auxObject2->setProjectId($this->auxObject3->getId()); - $this->auxObject2->setName("Earth"); - $this->auxObject2->setInit(date_create("2100-01-01")); - - $this->auxDao2->create($this->auxObject2); - - $this->auxDao = new PostgreSQLStoryDAO(); - - $this->auxObject = new StoryVO(); - $this->auxObject->setIterationId($this->auxObject2->getId()); - $this->auxObject->setName("Earth"); - $this->auxObject->setUserId($this->auxObject5->getId()); - - $this->auxDao->create($this->auxObject); - - $this->dao = new PostgreSQLTaskStoryDAO(); - - $this->testObjects[0] = new TaskStoryVO(); - $this->testObjects[0]->setStoryId($this->auxObject->getId()); - $this->testObjects[0]->setName("Earth"); - $this->testObjects[0]->setEstHours(10); - $this->testObjects[0]->setRisk(2); - $this->testObjects[0]->setInit(date_create("2100-01-01")); - $this->testObjects[0]->setEstEnd(date_create("2200-01-01")); - $this->testObjects[0]->setUserId($this->auxObject5->getId()); - $this->testObjects[0]->setId(-1); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - $this->auxDao->delete($this->auxObject); - - $this->auxDao2->delete($this->auxObject2); - - $this->auxDao3->delete($this->auxObject3); - - $this->auxDao4->delete($this->auxObject4); - - $this->auxDao5->delete($this->auxObject5); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testGetBySectionId() - { - $auxDao = new PostgreSQLModuleDAO(); - - $auxObject = new ModuleVO(); - $auxObject->setProjectId($this->auxObject3->getId()); - $auxObject->setName("Earth"); - $auxObject->setInit(date_create("2100-01-01")); - - $auxDao->create($auxObject); - - $auxDao2 = new PostgreSQLSectionDAO(); - - $auxObject2 = new SectionVO(); - $auxObject2->setModuleId($auxObject->getId()); - $auxObject2->setName("Earth"); - $auxObject2->setUserId($this->auxObject5->getId()); - - $auxObject3 = new SectionVO(); - $auxObject3->setModuleId($auxObject->getId()); - $auxObject3->setName("Mars"); - $auxObject3->setUserId($this->auxObject5->getId()); - - $auxDao2->create($auxObject2); - $auxDao2->create($auxObject3); - - $auxDao3 = new PostgreSQLTaskSectionDAO(); - - $auxObject4 = new TaskSectionVO(); - $auxObject4->setSectionId($auxObject2->getId()); - $auxObject4->setName("Earth"); - $auxObject4->setEstHours(10); - $auxObject4->setRisk(2); - $auxObject4->setUserId($this->auxObject5->getId()); - $auxObject4->setId(-1); - - $auxObject5 = new TaskSectionVO(); - $auxObject5->setSectionId($auxObject3->getId()); - $auxObject5->setName("Earth"); - $auxObject5->setEstHours(10); - $auxObject5->setRisk(2); - $auxObject5->setUserId($this->auxObject5->getId()); - $auxObject5->setId(-1); - - $auxDao3->create($auxObject4); - $auxDao3->create($auxObject5); - - $this->testObjects[0]->setTaskSectionId($auxObject4->getId()); - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - $this->testObjects[1]->setTaskSectionId($auxObject5->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - - $read = $this->dao->getBySectionId($auxObject2->getId()); - - $this->assertEquals(sizeof($read), 1); - $this->assertEquals($read[0], $this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - $this->dao->delete($this->testObjects[1]); - - $auxDao3->delete($auxObject5); - $auxDao3->delete($auxObject4); - $auxDao2->delete($auxObject3); - $auxDao2->delete($auxObject2); - $auxDao->delete($auxObject); - - } - - public function testGetByTaskSectionId() - { - $auxDao = new PostgreSQLModuleDAO(); - - $auxObject = new ModuleVO(); - $auxObject->setProjectId($this->auxObject3->getId()); - $auxObject->setName("Earth"); - $auxObject->setInit(date_create("2100-01-01")); - - $auxDao->create($auxObject); - - $auxDao2 = new PostgreSQLSectionDAO(); - - $auxObject2 = new SectionVO(); - $auxObject2->setModuleId($auxObject->getId()); - $auxObject2->setName("Earth"); - $auxObject2->setUserId($this->auxObject5->getId()); - - $auxObject3 = new SectionVO(); - $auxObject3->setModuleId($auxObject->getId()); - $auxObject3->setName("Mars"); - $auxObject3->setUserId($this->auxObject5->getId()); - - $auxDao2->create($auxObject2); - $auxDao2->create($auxObject3); - - $auxDao3 = new PostgreSQLTaskSectionDAO(); - - $auxObject4 = new TaskSectionVO(); - $auxObject4->setSectionId($auxObject2->getId()); - $auxObject4->setName("Earth"); - $auxObject4->setEstHours(10); - $auxObject4->setRisk(2); - $auxObject4->setUserId($this->auxObject5->getId()); - $auxObject4->setId(-1); - - $auxObject5 = new TaskSectionVO(); - $auxObject5->setSectionId($auxObject3->getId()); - $auxObject5->setName("Earth"); - $auxObject5->setEstHours(10); - $auxObject5->setRisk(2); - $auxObject5->setUserId($this->auxObject5->getId()); - $auxObject5->setId(-1); - - $auxDao3->create($auxObject4); - $auxDao3->create($auxObject5); - - $this->testObjects[0]->setTaskSectionId($auxObject4->getId()); - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - $this->testObjects[1]->setTaskSectionId($auxObject5->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - - $read = $this->dao->getByTaskSectionId($auxObject4->getId()); - - $this->assertEquals(sizeof($read), 1); - $this->assertEquals($read[0], $this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - $this->dao->delete($this->testObjects[1]); - - $auxDao3->delete($auxObject5); - $auxDao3->delete($auxObject4); - $auxDao2->delete($auxObject3); - $auxDao2->delete($auxObject2); - $auxDao->delete($auxObject); - - } - - public function testGetByStoryId() - { - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByStoryId($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByStoryIdFromStory() - { - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->auxDao->getTaskStories($this->auxObject->getId()); - - $this->assertEquals($read, $this->testObjects); - } - - public function testGetOpen() - { - - $auxObject = new UserVO(); - $auxObject->setLogin("Zapp Brannigan"); - - $this->auxDao5->create($auxObject); - - $auxObject2 = new ProjectVO(); - $auxObject2->setAreaId($this->auxObject4->getId()); - - $this->auxDao3->create($auxObject2); - - $auxObject3 = new IterationVO(); - $auxObject3->setProjectId($auxObject2->getId()); - $auxObject3->setName("Mars"); - $auxObject3->setInit(date_create("2100-01-01")); - - $this->auxDao2->create($auxObject3); - - $auxObject4 = new StoryVO(); - $auxObject4->setIterationId($auxObject3->getId()); - $auxObject4->setName("Mars"); - $auxObject4->setUserId($this->auxObject5->getId()); - - $this->auxDao->create($auxObject4); - - $this->testObjects[1] = clone $this->testObjects[0]; - $this->testObjects[1]->setName("Mars"); - $this->testObjects[1]->setEnd(date_create("2100-01-01")); - - $this->testObjects[2] = clone $this->testObjects[0]; - $this->testObjects[2]->setName("Omicron Persei"); - $this->testObjects[2]->setUserId($auxObject->getId()); - - $this->testObjects[3] = clone $this->testObjects[0]; - $this->testObjects[3]->setName("Globetrotter Planet"); - $this->testObjects[3]->setStoryId($auxObject4->getId()); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - $this->dao->create($this->testObjects[3]); - - $read = $this->dao->getOpen($this->auxObject5->getId(), $this->auxObject3->getId()); - - $this->assertEquals(sizeof($read), 1); - $this->assertEquals($read[0], $this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - $this->dao->delete($this->testObjects[1]); - $this->dao->delete($this->testObjects[2]); - $this->dao->delete($this->testObjects[3]); - - $this->auxDao->delete($auxObject4); - $this->auxDao2->delete($auxObject3); - $this->auxDao3->delete($auxObject2); - $this->auxDao5->delete($auxObject); - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setRisk(0); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setRisk(0); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLUserDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLUserDAOBasicTests.php deleted file mode 100644 index 7b6178e15..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLUserDAOBasicTests.php +++ /dev/null @@ -1,241 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/UserDAO/PostgreSQLUserDAO.php'); - -class PostgreSQLUserDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - - protected function setUp() - { - - $this->dao = new PostgreSQLUserDAO(); - - $this->testObjects[0] = new UserVO(); - $this->testObjects[0]->setLogin("bender"); - $this->testObjects[0]->setId(-1); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setLogin("flexo"); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testLogin() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->login($this->testObjects[0]->getLogin(), NULL); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - /** - * @expectedException IncorrectLoginException - */ - public function testIncorrectLogin() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->login($this->testObjects[0]->getLogin(), 'zoidberg'); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setLogin("flexo"); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setLogin("roberto"); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testGetByLoginAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getByUserLogin($this->testObjects[0]->getLogin()); - - $this->assertNull($read); - - } - - public function testGetByUserLogin() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getByUserLogin($this->testObjects[0]->getLogin()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByUserLoginNonExistent() - { - - $read = $this->dao->getByUserLogin('qwertyuiopasdfghjkl'); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setPassword(NULL); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setPassword(NULL); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOBasicTests/PostgreSQLUserGroupDAOBasicTests.php b/test/PostgreDAOBasicTests/PostgreSQLUserGroupDAOBasicTests.php deleted file mode 100644 index f6c3b2bc9..000000000 --- a/test/PostgreDAOBasicTests/PostgreSQLUserGroupDAOBasicTests.php +++ /dev/null @@ -1,197 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/UserGroupVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/UserGroupDAO/PostgreSQLUserGroupDAO.php'); - -class PostgreSQLUserGroupDAOBasicTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $testObjects; - - protected function setUp() - { - - $this->dao = new PostgreSQLUserGroupDAO(); - - $this->testObjects[0] = new UserGroupVO(); - $this->testObjects[0]->setName("Deliverers"); - $this->testObjects[0]->setId(-1); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setName("Cleaning"); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetAll() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setName("Cleaning"); - - $this->dao->create($this->testObjects[1]); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setName("Burocrats"); - - $this->dao->create($this->testObjects[2]); - - $this->assertEquals($this->testObjects, $this->dao->getAll()); - - } - - public function testGetByUserGroupName() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getByUserGroupName($this->testObjects[0]->getName()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertNull($read); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setName("Lazybones"); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setName("Lazybones"); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - -} -?> diff --git a/test/PostgreDAOMultipleTests/PostgreSQLBelongsRelationshipMultipleTests.php b/test/PostgreDAOMultipleTests/PostgreSQLBelongsRelationshipMultipleTests.php deleted file mode 100644 index 22848eca8..000000000 --- a/test/PostgreDAOMultipleTests/PostgreSQLBelongsRelationshipMultipleTests.php +++ /dev/null @@ -1,302 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/UserGroupVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/UserGroupDAO/PostgreSQLUserGroupDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/UserDAO/PostgreSQLUserDAO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/BelongsDAO/PostgreSQLBelongsDAO.php'); - -class PostgreSQLBelongsRelationshipMultipleTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $auxDao; - protected $testObjects; - protected $auxDao2; - protected $testObjects2; - - protected function setUp() - { - - $this->auxDao = new PostgreSQLUserDAO(); - - $this->testObjects[0] = new UserVO(); - $this->testObjects[0]->setLogin("bender"); - $this->testObjects[0]->setId(-1); - - $this->testObjects[1] = new UserVO(); - $this->testObjects[1]->setLogin("flexo"); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new UserVO(); - $this->testObjects[2]->setLogin("roberto"); - $this->testObjects[2]->setId(-1); - - $this->auxDao->create($this->testObjects[0]); - - $this->auxDao2 = new PostgreSQLUserGroupDAO(); - - $this->testObjects2[0] = new UserGroupVO(); - $this->testObjects2[0]->setName("Deliverers"); - $this->testObjects2[0]->setId(-1); - - $this->testObjects2[1] = new UserGroupVO(); - $this->testObjects2[1]->setName("Cleaning"); - $this->testObjects2[1]->setId(-1); - - $this->testObjects2[2] = new UserGroupVO(); - $this->testObjects2[2]->setName("Burocrats"); - $this->testObjects2[2]->setId(-1); - - $this->auxDao2->create($this->testObjects2[0]); - - $this->dao = new PostgreSQLBelongsDAO(); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject1) - foreach($this->testObjects2 as $testObject2) - $this->dao->delete($testObject1->getId(), $testObject2->getId()); - - foreach($this->testObjects as $testObject) - $this->auxDao->delete($testObject); - - foreach($this->testObjects2 as $testObject) - $this->auxDao2->delete($testObject); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()), 1); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testCreateId1Invalid() - { - - $this->dao->create("*", $this->testObjects2[0]->getId()); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testCreateId2Invalid() - { - - $this->dao->create($this->testObjects[0]->getId(), "*"); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()); - - $this->assertEquals($this->dao->delete($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()), 1); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testDeleteId1Invalid() - { - - $this->dao->delete("*", $this->testObjects2[0]->getId()); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testDeleteId2Invalid() - { - - $this->dao->delete($this->testObjects[0]->getId(), "*"); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()), 0); - - } - - public function testGetByUserId() - { - - $this->auxDao2->create($this->testObjects2[1]); - $this->auxDao2->create($this->testObjects2[2]); - - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()); - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[1]->getId()); - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[2]->getId()); - - $read = $this->dao->getByUserId($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects2); - - } - - public function testGetByUserLogin() - { - - $this->auxDao2->create($this->testObjects2[1]); - $this->auxDao2->create($this->testObjects2[2]); - - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()); - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[1]->getId()); - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[2]->getId()); - - $read = $this->dao->getByUserLogin($this->testObjects[0]->getLogin()); - - $this->assertEquals($read, $this->testObjects2); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByInvalidUserId() - { - - $this->dao->getByUserId("*"); - - } - - public function testGetByUserIdFromUserDAO() - { - - $this->auxDao2->create($this->testObjects2[1]); - $this->auxDao2->create($this->testObjects2[2]); - - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()); - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[1]->getId()); - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[2]->getId()); - - $read = $this->auxDao->getGroups($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects2); - - } - - public function testGetByUserLoginFromUserDAO() - { - - $this->auxDao2->create($this->testObjects2[1]); - $this->auxDao2->create($this->testObjects2[2]); - - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()); - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[1]->getId()); - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[2]->getId()); - - $read = $this->auxDao->getGroupsByLogin($this->testObjects[0]->getLogin()); - - $this->assertEquals($read, $this->testObjects2); - - } - - public function testGetByUserGroupId() - { - - $this->auxDao->create($this->testObjects[1]); - $this->auxDao->create($this->testObjects[2]); - - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()); - $this->dao->create($this->testObjects[1]->getId(), $this->testObjects2[0]->getId()); - $this->dao->create($this->testObjects[2]->getId(), $this->testObjects2[0]->getId()); - - $read = $this->dao->getByUserGroupId($this->testObjects2[0]->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByUserGroupName() - { - - $this->auxDao->create($this->testObjects[1]); - $this->auxDao->create($this->testObjects[2]); - - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()); - $this->dao->create($this->testObjects[1]->getId(), $this->testObjects2[0]->getId()); - $this->dao->create($this->testObjects[2]->getId(), $this->testObjects2[0]->getId()); - - $read = $this->dao->getByUserGroupName($this->testObjects2[0]->getName()); - - $this->assertEquals($read, $this->testObjects); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByInvalidUserGroupId() - { - - $this->dao->getByUserGroupId("*"); - - } - - public function testGetByUserGroupIdFromUserGroupDAO() - { - - $this->auxDao->create($this->testObjects[1]); - $this->auxDao->create($this->testObjects[2]); - - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()); - $this->dao->create($this->testObjects[1]->getId(), $this->testObjects2[0]->getId()); - $this->dao->create($this->testObjects[2]->getId(), $this->testObjects2[0]->getId()); - - $read = $this->auxDao2->getUsers($this->testObjects2[0]->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - public function testGetByUserGroupNameFromUserGroupDAO() - { - - $this->auxDao->create($this->testObjects[1]); - $this->auxDao->create($this->testObjects[2]); - - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()); - $this->dao->create($this->testObjects[1]->getId(), $this->testObjects2[0]->getId()); - $this->dao->create($this->testObjects[2]->getId(), $this->testObjects2[0]->getId()); - - $read = $this->auxDao2->getUsersByUserGroupName($this->testObjects2[0]->getName()); - - $this->assertEquals($read, $this->testObjects); - - } - -} -?> diff --git a/test/PostgreDAOMultipleTests/PostgreSQLProjectScheduleDAOMultipleTests.php b/test/PostgreDAOMultipleTests/PostgreSQLProjectScheduleDAOMultipleTests.php deleted file mode 100644 index 16f41992f..000000000 --- a/test/PostgreDAOMultipleTests/PostgreSQLProjectScheduleDAOMultipleTests.php +++ /dev/null @@ -1,322 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/ProjectScheduleVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/ProjectScheduleDAO/PostgreSQLProjectScheduleDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/ProjectVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/ProjectDAO/PostgreSQLProjectDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/UserDAO/PostgreSQLUserDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/AreaVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/AreaDAO/PostgreSQLAreaDAO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/WorksDAO/PostgreSQLWorksDAO.php'); - -class PostgreSQLProjectScheduleDAOMultipleTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $dao2; - protected $testObjects; - protected $auxDao; - protected $auxObjects; - protected $auxDao2; - protected $auxObjects2; - protected $auxDao3; - protected $auxObject; - - protected function setUp() - { - - $this->auxDao = new PostgreSQLUserDAO(); - - $this->auxObjects[0] = new UserVO(); - $this->auxObjects[0]->setLogin("bender"); - $this->auxObjects[0]->setPassword("kiss my metal shiny ass"); - $this->auxObjects[0]->setId(-1); - - $this->auxObjects[1] = new UserVO(); - $this->auxObjects[1]->setLogin("flexo"); - $this->auxObjects[1]->setPassword("kiss my metal shiny ass"); - $this->auxObjects[1]->setId(-1); - - $this->auxObjects[2] = new UserVO(); - $this->auxObjects[2]->setLogin("roberto"); - $this->auxObjects[2]->setPassword("kiss my metal shiny ass"); - $this->auxObjects[2]->setId(-1); - - $this->auxDao->create($this->auxObjects[0]); - - $this->auxDao3 = new PostgreSQLAreaDAO(); - - $this->auxObject = new AreaVO(); - $this->auxObject->setName("Deliverers"); - - $this->auxDao3->create($this->auxObject); - - $this->auxDao2 = new PostgreSQLProjectDAO(); - - $this->auxObjects2[0] = new ProjectVO(); - $this->auxObjects2[0]->setInit(date_create("1999-12-31")); - $this->auxObjects2[0]->setAreaId($this->auxObject->getId()); - $this->auxObjects2[0]->setEnd(date_create("2999-12-31")); - $this->auxObjects2[0]->setDescription("Good news, everyone!"); - $this->auxObjects2[0]->setActivation(TRUE); - $this->auxObjects2[0]->setSchedType("Good news, everyone!"); - $this->auxObjects2[0]->setType("I've taught the toaster to feel love!"); - $this->auxObjects2[0]->setMovedHours(3.14); - $this->auxObjects2[0]->setInvoice(5.55); - $this->auxObjects2[0]->setEstHours(3.25); - $this->auxObjects2[0]->setId(-1); - - $this->auxObjects2[1] = new ProjectVO(); - $this->auxObjects2[1]->setInit(date_create("2000-12-31")); - $this->auxObjects2[1]->setAreaId($this->auxObject->getId()); - $this->auxObjects2[1]->setEnd(date_create("2999-12-31")); - $this->auxObjects2[1]->setDescription("Good news, everyone!"); - $this->auxObjects2[1]->setActivation(TRUE); - $this->auxObjects2[1]->setSchedType("Good news, everyone!"); - $this->auxObjects2[1]->setType("I've taught the toaster to feel love!"); - $this->auxObjects2[1]->setMovedHours(3.14); - $this->auxObjects2[1]->setInvoice(5.55); - $this->auxObjects2[1]->setEstHours(3.25); - $this->auxObjects2[1]->setId(-1); - - $this->auxObjects2[2] = new ProjectVO(); - $this->auxObjects2[2]->setInit(date_create("2001-12-31")); - $this->auxObjects2[2]->setAreaId($this->auxObject->getId()); - $this->auxObjects2[2]->setEnd(date_create("2999-12-31")); - $this->auxObjects2[2]->setDescription("Good news, everyone!"); - $this->auxObjects2[2]->setActivation(TRUE); - $this->auxObjects2[2]->setSchedType("Good news, everyone!"); - $this->auxObjects2[2]->setType("I've taught the toaster to feel love!"); - $this->auxObjects2[2]->setMovedHours(3.14); - $this->auxObjects2[2]->setInvoice(5.55); - $this->auxObjects2[2]->setEstHours(3.25); - $this->auxObjects2[2]->setId(-1); - - $this->auxDao2->create($this->auxObjects2[0]); - - $this->testObjects[0] = new ProjectScheduleVO(); - - $this->testObjects[0]->setWeeklyLoad(25.5); - $this->testObjects[0]->setInitWeek(12); - $this->testObjects[0]->setInitYear(2005); - $this->testObjects[0]->setEndWeek(9); - $this->testObjects[0]->setEndYear(2006); - $this->testObjects[0]->setUserId($this->auxObjects[0]->getId()); - $this->testObjects[0]->setProjectId($this->auxObjects2[0]->getId()); - $this->testObjects[0]->setId(-1); - - $this->dao = new PostgreSQLProjectScheduleDAO(); - - $this->dao2 = new PostgreSQLWorksDAO(); - - $this->dao2->create($this->testObjects[0]->getUserId(), $this->testObjects[0]->getProjectId()); - - } - - protected function tearDown() - { - - foreach($this->testObjects as $testObject) - $this->dao->delete($testObject); - - foreach($this->testObjects as $testObject) - $this->dao2->delete($testObject->getUserId(), $testObject->getProjectId()); - - foreach($this->auxObjects as $testObject) - $this->auxDao->delete($testObject); - - foreach($this->auxObjects2 as $testObject) - $this->auxDao2->delete($testObject); - - $this->auxDao3->delete($this->auxObject); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]), 1); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 1); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]), 0); - - } - - public function testIdCreate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setInitWeek(13); - - $this->dao->create($this->testObjects[1]); - - $this->assertGreaterThan($this->testObjects[0]->getId(), $this->testObjects[1]->getId()); - - } - - public function testGetById() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testGetByIdNonExistent() - { - - $read = $this->dao->getById(0); - - $this->assertNull($read); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByIdInvalid() - { - - $read = $this->dao->getById("zoidberg"); - - } - - public function testGetByIdAfterDelete() - { - - $this->dao->create($this->testObjects[0]); - - $this->dao->delete($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, NULL); - - } - - public function testUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setWeeklyLoad(90); - - $this->assertEquals($this->dao->update($this->testObjects[0]), 1); - - } - - public function testGetByIdAfterUpdate() - { - - $this->dao->create($this->testObjects[0]); - - $this->testObjects[0]->setWeeklyLoad(90); - - $this->dao->update($this->testObjects[0]); - - $read = $this->dao->getById($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - public function testUpdateNonExistent() - { - - $this->assertEquals($this->dao->update($this->testObjects[0]), 0); - - } - - public function testGetByUserProjectIds() - { - - $this->testObjects[1] = clone $this->testObjects[0]; - - $this->testObjects[1]->setInitWeek(13); - - $this->testObjects[2] = clone $this->testObjects[0]; - - $this->testObjects[2]->setInitWeek(14); - - $this->dao->create($this->testObjects[0]); - $this->dao->create($this->testObjects[1]); - $this->dao->create($this->testObjects[2]); - - $read = $this->dao->getByUserProjectIds($this->testObjects[0]->getUserId(), $this->testObjects[0]->getProjectId()); - - $this->assertEquals($read, $this->testObjects); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByInvalidUserProjectIds() - { - - $this->dao->getByUserProjectIds("*", "*"); - - } - - public function testGetByUserProjectIdsDate() - { - - $this->dao->create($this->testObjects[0]); - - $read = $this->dao->getByUserProjectIdsDate($this->testObjects[0]->getUserId(), $this->testObjects[0]->getProjectId(), $this->testObjects[0]->getInitWeek(), $this->testObjects[0]->getInitYear()); - - $this->assertEquals($read, $this->testObjects[0]); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByInvalidUserProjectIdsDate() - { - - $this->dao->getByUserProjectIds("*", "*", $this->testObjects[0]->getInitWeek(), $this->testObjects[0]->getInitYear()); - - } - -} -?> diff --git a/test/PostgreDAOMultipleTests/PostgreSQLProjectUserRelationshipMultipleTests.php b/test/PostgreDAOMultipleTests/PostgreSQLProjectUserRelationshipMultipleTests.php deleted file mode 100644 index 51d8872d7..000000000 --- a/test/PostgreDAOMultipleTests/PostgreSQLProjectUserRelationshipMultipleTests.php +++ /dev/null @@ -1,246 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/ProjectVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/ProjectDAO/PostgreSQLProjectDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/UserDAO/PostgreSQLUserDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/AreaVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/AreaDAO/PostgreSQLAreaDAO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/ProjectUserDAO/PostgreSQLProjectUserDAO.php'); - -class PostgreSQLProjectUserRelationshipMultipleTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $auxDao; - protected $testObjects; - protected $auxDao2; - protected $testObjects2; - protected $auxDao3; - protected $auxObject; - - protected function setUp() - { - - $this->auxDao = new PostgreSQLUserDAO(); - - $this->testObjects[0] = new UserVO(); - $this->testObjects[0]->setLogin("bender"); - $this->testObjects[0]->setId(-1); - - $this->testObjects[1] = new UserVO(); - $this->testObjects[1]->setLogin("flexo"); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new UserVO(); - $this->testObjects[2]->setLogin("roberto"); - $this->testObjects[2]->setId(-1); - - $this->auxDao->create($this->testObjects[0]); - - $this->auxDao3 = new PostgreSQLAreaDAO(); - - $this->auxObject = new AreaVO(); - $this->auxObject->setName("Deliverers"); - - $this->auxDao3->create($this->auxObject); - - $this->auxDao2 = new PostgreSQLProjectDAO(); - - $this->testObjects2[0] = new ProjectVO(); - $this->testObjects2[0]->setInit(date_create("1999-12-31")); - $this->testObjects2[0]->setAreaId($this->auxObject->getId()); - $this->testObjects2[0]->setEnd(date_create("2999-12-31")); - $this->testObjects2[0]->setDescription("Good news, everyone!"); - $this->testObjects2[0]->setActivation(TRUE); - $this->testObjects2[0]->setSchedType("Good news, everyone!"); - $this->testObjects2[0]->setType("I've taught the toaster to feel love!"); - $this->testObjects2[0]->setMovedHours(3.14); - $this->testObjects2[0]->setInvoice(5.55); - $this->testObjects2[0]->setEstHours(3.25); - $this->testObjects2[0]->setId(-1); - - $this->testObjects2[1] = new ProjectVO(); - $this->testObjects2[1]->setInit(date_create("1999-12-31")); - $this->testObjects2[1]->setAreaId($this->auxObject->getId()); - $this->testObjects2[1]->setEnd(date_create("2999-12-31")); - $this->testObjects2[1]->setDescription("Good news, everyone!"); - $this->testObjects2[1]->setActivation(TRUE); - $this->testObjects2[1]->setSchedType("Good news, everyone!"); - $this->testObjects2[1]->setType("I've taught the toaster to feel love!"); - $this->testObjects2[1]->setMovedHours(3.14); - $this->testObjects2[1]->setInvoice(5.55); - $this->testObjects2[1]->setEstHours(3.25); - $this->testObjects2[1]->setId(-1); - - $this->testObjects2[2] = new ProjectVO(); - $this->testObjects2[2]->setInit(date_create("1999-12-31")); - $this->testObjects2[2]->setAreaId($this->auxObject->getId()); - $this->testObjects2[2]->setEnd(date_create("2999-12-31")); - $this->testObjects2[2]->setDescription("Good news, everyone!"); - $this->testObjects2[2]->setActivation(TRUE); - $this->testObjects2[2]->setSchedType("Good news, everyone!"); - $this->testObjects2[2]->setType("I've taught the toaster to feel love!"); - $this->testObjects2[2]->setMovedHours(3.14); - $this->testObjects2[2]->setInvoice(5.55); - $this->testObjects2[2]->setEstHours(3.25); - $this->testObjects2[2]->setId(-1); - - $this->auxDao2->create($this->testObjects2[0]); - - $this->dao = new PostgreSQLProjectUserDAO(); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject1) - foreach($this->testObjects2 as $testObject2) - $this->dao->delete($testObject1->getId(), $testObject2->getId()); - - foreach($this->testObjects as $testObject) - $this->auxDao->delete($testObject); - - foreach($this->testObjects2 as $testObject) - $this->auxDao2->delete($testObject); - - $this->auxDao3->delete($this->auxObject); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()), 1); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testCreateId1Invalid() - { - - $this->dao->create("*", $this->testObjects2[0]->getId()); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testCreateId2Invalid() - { - - $this->dao->create($this->testObjects[0]->getId(), "*"); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()); - - $this->assertEquals($this->dao->delete($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()), 1); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testDeleteId1Invalid() - { - - $this->dao->delete("*", $this->testObjects2[0]->getId()); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testDeleteId2Invalid() - { - - $this->dao->delete($this->testObjects[0]->getId(), "*"); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()), 0); - - } - - public function testGetByUserId() - { - - $this->auxDao2->create($this->testObjects2[1]); - $this->auxDao2->create($this->testObjects2[2]); - - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()); - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[1]->getId()); - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[2]->getId()); - - $read = $this->dao->getByUserId($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects2); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByInvalidUserId() - { - - $this->dao->getByUserId("*"); - - } - - public function testGetByProjectId() - { - - $this->auxDao->create($this->testObjects[1]); - $this->auxDao->create($this->testObjects[2]); - - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()); - $this->dao->create($this->testObjects[1]->getId(), $this->testObjects2[0]->getId()); - $this->dao->create($this->testObjects[2]->getId(), $this->testObjects2[0]->getId()); - - $read = $this->dao->getByProjectId($this->testObjects2[0]->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByInvalidProjectId() - { - - $this->dao->getByProjectId("*"); - - } - -} -?> diff --git a/test/PostgreDAOMultipleTests/PostgreSQLWorksRelationshipMultipleTests.php b/test/PostgreDAOMultipleTests/PostgreSQLWorksRelationshipMultipleTests.php deleted file mode 100644 index c5d0e1674..000000000 --- a/test/PostgreDAOMultipleTests/PostgreSQLWorksRelationshipMultipleTests.php +++ /dev/null @@ -1,246 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/ProjectVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/ProjectDAO/PostgreSQLProjectDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/UserDAO/PostgreSQLUserDAO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/AreaVO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/AreaDAO/PostgreSQLAreaDAO.php'); -include_once(PHPREPORT_ROOT . '/model/dao/WorksDAO/PostgreSQLWorksDAO.php'); - -class PostgreSQLWorksRelationshipMultipleTests extends PHPUnit_Framework_TestCase -{ - - protected $dao; - protected $auxDao; - protected $testObjects; - protected $auxDao2; - protected $testObjects2; - protected $auxDao3; - protected $auxObject; - - protected function setUp() - { - - $this->auxDao = new PostgreSQLUserDAO(); - - $this->testObjects[0] = new UserVO(); - $this->testObjects[0]->setLogin("bender"); - $this->testObjects[0]->setId(-1); - - $this->testObjects[1] = new UserVO(); - $this->testObjects[1]->setLogin("flexo"); - $this->testObjects[1]->setId(-1); - - $this->testObjects[2] = new UserVO(); - $this->testObjects[2]->setLogin("roberto"); - $this->testObjects[2]->setId(-1); - - $this->auxDao->create($this->testObjects[0]); - - $this->auxDao3 = new PostgreSQLAreaDAO(); - - $this->auxObject = new AreaVO(); - $this->auxObject->setName("Deliverers"); - - $this->auxDao3->create($this->auxObject); - - $this->auxDao2 = new PostgreSQLProjectDAO(); - - $this->testObjects2[0] = new ProjectVO(); - $this->testObjects2[0]->setInit(date_create("1999-12-31")); - $this->testObjects2[0]->setAreaId($this->auxObject->getId()); - $this->testObjects2[0]->setEnd(date_create("2999-12-31")); - $this->testObjects2[0]->setDescription("Good news, everyone!"); - $this->testObjects2[0]->setActivation(TRUE); - $this->testObjects2[0]->setSchedType("Good news, everyone!"); - $this->testObjects2[0]->setType("I've taught the toaster to feel love!"); - $this->testObjects2[0]->setMovedHours(3.14); - $this->testObjects2[0]->setInvoice(5.55); - $this->testObjects2[0]->setEstHours(3.25); - $this->testObjects2[0]->setId(-1); - - $this->testObjects2[1] = new ProjectVO(); - $this->testObjects2[1]->setInit(date_create("1999-12-31")); - $this->testObjects2[1]->setAreaId($this->auxObject->getId()); - $this->testObjects2[1]->setEnd(date_create("2999-12-31")); - $this->testObjects2[1]->setDescription("Good news, everyone!"); - $this->testObjects2[1]->setActivation(TRUE); - $this->testObjects2[1]->setSchedType("Good news, everyone!"); - $this->testObjects2[1]->setType("I've taught the toaster to feel love!"); - $this->testObjects2[1]->setMovedHours(3.14); - $this->testObjects2[1]->setInvoice(5.55); - $this->testObjects2[1]->setEstHours(3.25); - $this->testObjects2[1]->setId(-1); - - $this->testObjects2[2] = new ProjectVO(); - $this->testObjects2[2]->setInit(date_create("1999-12-31")); - $this->testObjects2[2]->setAreaId($this->auxObject->getId()); - $this->testObjects2[2]->setEnd(date_create("2999-12-31")); - $this->testObjects2[2]->setDescription("Good news, everyone!"); - $this->testObjects2[2]->setActivation(TRUE); - $this->testObjects2[2]->setSchedType("Good news, everyone!"); - $this->testObjects2[2]->setType("I've taught the toaster to feel love!"); - $this->testObjects2[2]->setMovedHours(3.14); - $this->testObjects2[2]->setInvoice(5.55); - $this->testObjects2[2]->setEstHours(3.25); - $this->testObjects2[2]->setId(-1); - - $this->auxDao2->create($this->testObjects2[0]); - - $this->dao = new PostgreSQLWorksDAO(); - - } - - protected function tearDown() - { - foreach($this->testObjects as $testObject1) - foreach($this->testObjects2 as $testObject2) - $this->dao->delete($testObject1->getId(), $testObject2->getId()); - - foreach($this->testObjects as $testObject) - $this->auxDao->delete($testObject); - - foreach($this->testObjects2 as $testObject) - $this->auxDao2->delete($testObject); - - $this->auxDao3->delete($this->auxObject); - - } - - public function testCreate() - { - - $this->assertEquals($this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()), 1); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testCreateId1Invalid() - { - - $this->dao->create("*", $this->testObjects2[0]->getId()); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testCreateId2Invalid() - { - - $this->dao->create($this->testObjects[0]->getId(), "*"); - - } - - public function testDelete() - { - - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()); - - $this->assertEquals($this->dao->delete($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()), 1); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testDeleteId1Invalid() - { - - $this->dao->delete("*", $this->testObjects2[0]->getId()); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testDeleteId2Invalid() - { - - $this->dao->delete($this->testObjects[0]->getId(), "*"); - - } - - public function testDeleteNonExistent() - { - - $this->assertEquals($this->dao->delete($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()), 0); - - } - - public function testGetByUserId() - { - - $this->auxDao2->create($this->testObjects2[1]); - $this->auxDao2->create($this->testObjects2[2]); - - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()); - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[1]->getId()); - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[2]->getId()); - - $read = $this->dao->getByUserId($this->testObjects[0]->getId()); - - $this->assertEquals($read, $this->testObjects2); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByInvalidUserId() - { - - $this->dao->getByUserId("*"); - - } - - public function testGetByProjectId() - { - - $this->auxDao->create($this->testObjects[1]); - $this->auxDao->create($this->testObjects[2]); - - $this->dao->create($this->testObjects[0]->getId(), $this->testObjects2[0]->getId()); - $this->dao->create($this->testObjects[1]->getId(), $this->testObjects2[0]->getId()); - $this->dao->create($this->testObjects[2]->getId(), $this->testObjects2[0]->getId()); - - $read = $this->dao->getByProjectId($this->testObjects2[0]->getId()); - - $this->assertEquals($read, $this->testObjects); - - } - - /** - * @expectedException SQLIncorrectTypeException - */ - public function testGetByInvalidProjectId() - { - - $this->dao->getByProjectId("*"); - - } - -} -?> diff --git a/test/VOTests/AreaHistoryVOTests.php b/test/VOTests/AreaHistoryVOTests.php deleted file mode 100644 index 118813157..000000000 --- a/test/VOTests/AreaHistoryVOTests.php +++ /dev/null @@ -1,109 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/AreaHistoryVO.php'); - -class AreaHistoryVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new AreaHistoryVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testAreaIdField() - { - - $this->VO->setAreaId(2); - - $this->assertEquals($this->VO->getAreaId(), 2); - - $this->VO->setAreaId(4); - - $this->assertEquals($this->VO->getAreaId(), 4); - - } - - public function testInitDateField() - { - - $this->VO->setInitDate(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getInitDate(), date_create('1999-12-31')); - - $this->VO->setInitDate(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getInitDate(), date_create('2999-12-31')); - - } - - public function testEndDateField() - { - - $this->VO->setEndDate(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getEndDate(), date_create('1999-12-31')); - - $this->VO->setEndDate(NULL); - - $this->assertEquals($this->VO->getEndDate(), NULL); - - } - - public function testUserIdField() - { - - $this->VO->setUserId(2); - - $this->assertEquals($this->VO->getUserId(), 2); - - $this->VO->setUserId(45); - - $this->assertEquals($this->VO->getUserId(), 45); - - } - -} -?> diff --git a/test/VOTests/AreaVOTests.php b/test/VOTests/AreaVOTests.php deleted file mode 100644 index 6a93723cf..000000000 --- a/test/VOTests/AreaVOTests.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/AreaVO.php'); - -class AreaVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new AreaVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testNameField() - { - - $this->VO->setName("PlanetExpress"); - - $this->assertEquals($this->VO->getName(), "PlanetExpress"); - - $this->VO->setName("Mommy industries"); - - $this->assertEquals($this->VO->getName(), "Mommy industries"); - - } - -} -?> diff --git a/test/VOTests/CityHistoryVOTests.php b/test/VOTests/CityHistoryVOTests.php deleted file mode 100644 index 959360c4a..000000000 --- a/test/VOTests/CityHistoryVOTests.php +++ /dev/null @@ -1,109 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/CityHistoryVO.php'); - -class CityHistoryVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new CityHistoryVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testCityIdField() - { - - $this->VO->setCityId(2); - - $this->assertEquals($this->VO->getCityId(), 2); - - $this->VO->setCityId(4); - - $this->assertEquals($this->VO->getCityId(), 4); - - } - - public function testInitDateField() - { - - $this->VO->setInitDate(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getInitDate(), date_create('1999-12-31')); - - $this->VO->setInitDate(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getInitDate(), date_create('2999-12-31')); - - } - - public function testEndDateField() - { - - $this->VO->setEndDate(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getEndDate(), date_create('1999-12-31')); - - $this->VO->setEndDate(NULL); - - $this->assertEquals($this->VO->getEndDate(), NULL); - - } - - public function testUserIdField() - { - - $this->VO->setUserId(2); - - $this->assertEquals($this->VO->getUserId(), 2); - - $this->VO->setUserId(45); - - $this->assertEquals($this->VO->getUserId(), 45); - - } - -} -?> diff --git a/test/VOTests/CityVOTests.php b/test/VOTests/CityVOTests.php deleted file mode 100644 index 751574192..000000000 --- a/test/VOTests/CityVOTests.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/CityVO.php'); - -class CityVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new CityVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testNameField() - { - - $this->VO->setName("PlanetExpress"); - - $this->assertEquals($this->VO->getName(), "PlanetExpress"); - - $this->VO->setName("Mommy industries"); - - $this->assertEquals($this->VO->getName(), "Mommy industries"); - - } - -} -?> diff --git a/test/VOTests/CommonEventVOTests.php b/test/VOTests/CommonEventVOTests.php deleted file mode 100644 index 90b660352..000000000 --- a/test/VOTests/CommonEventVOTests.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/CommonEventVO.php'); - -class CommonEventVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new CommonEventVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testDateField() - { - - $this->VO->setDate(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getDate(), date_create('1999-12-31')); - - $this->VO->setDate(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getDate(), date_create('2999-12-31')); - - } - - public function testCityIdField() - { - - $this->VO->setCityId(2); - - $this->assertEquals($this->VO->getCityId(), 2); - - $this->VO->setCityId(45); - - $this->assertEquals($this->VO->getCityId(), 45); - - } - -} -?> diff --git a/test/VOTests/CustomEventVOTests.php b/test/VOTests/CustomEventVOTests.php deleted file mode 100644 index ba41fcafa..000000000 --- a/test/VOTests/CustomEventVOTests.php +++ /dev/null @@ -1,109 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/CustomEventVO.php'); - -class CustomEventVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new CustomEventVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testHoursField() - { - - $this->VO->setHours(2.5); - - $this->assertEquals($this->VO->getHours(), 2.5); - - $this->VO->setHours(4.5); - - $this->assertEquals($this->VO->getHours(), 4.5); - - } - - public function testDateField() - { - - $this->VO->setDate(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getDate(), date_create('1999-12-31')); - - $this->VO->setDate(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getDate(), date_create('2999-12-31')); - - } - - public function testUserIdField() - { - - $this->VO->setUserId(2); - - $this->assertEquals($this->VO->getUserId(), 2); - - $this->VO->setUserId(45); - - $this->assertEquals($this->VO->getUserId(), 45); - - } - - public function testTypeField() - { - - $this->VO->setType("Feeding Nibbles"); - - $this->assertEquals($this->VO->getType(), "Feeding Nibbles"); - - $this->VO->setType("Hailing Zoidberg!"); - - $this->assertEquals($this->VO->getType(), "Hailing Zoidberg!"); - - } - -} -?> diff --git a/test/VOTests/CustomProjectVOTests.php b/test/VOTests/CustomProjectVOTests.php deleted file mode 100644 index d1c9a858f..000000000 --- a/test/VOTests/CustomProjectVOTests.php +++ /dev/null @@ -1,274 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/CustomProjectVO.php'); - -class CustomProjectVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new CustomProjectVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testInitField() - { - - $this->VO->setInit(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getInit(), date_create('1999-12-31')); - - $this->VO->setInit(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getInit(), date_create('2999-12-31')); - - } - - public function testEndField() - { - - $this->VO->setEnd(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getEnd(), date_create('1999-12-31')); - - $this->VO->setEnd(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getEnd(), date_create('2999-12-31')); - - } - - public function testInvoiceField() - { - - $this->VO->setInvoice(2.54); - - $this->assertEquals($this->VO->getInvoice(), 2.54); - - $this->VO->setInvoice(4.54); - - $this->assertEquals($this->VO->getInvoice(), 4.54); - - } - - public function testEstHoursField() - { - - $this->VO->setEstHours(2.54); - - $this->assertEquals($this->VO->getEstHours(), 2.54); - - $this->VO->setEstHours(4.54); - - $this->assertEquals($this->VO->getEstHours(), 4.54); - - } - - public function testMovedHoursField() - { - - $this->VO->setMovedHours(2.54); - - $this->assertEquals($this->VO->getMovedHours(), 2.54); - - $this->VO->setMovedHours(4.54); - - $this->assertEquals($this->VO->getMovedHours(), 4.54); - - } - - public function testWorkedHoursField() - { - - $this->VO->setWorkedHours(2.54); - - $this->assertEquals($this->VO->getWorkedHours(), 2.54); - - $this->VO->setWorkedHours(4.54); - - $this->assertEquals($this->VO->getWorkedHours(), 4.54); - - } - - public function testTotalCostField() - { - - $this->VO->setTotalCost(2.54); - - $this->assertEquals($this->VO->getTotalCost(), 2.54); - - $this->VO->setTotalCost(4.54); - - $this->assertEquals($this->VO->getTotalCost(), 4.54); - - } - - public function testGetPercDev() - { - - $this->VO->setWorkedHours(50); - $this->VO->setEstHours(100); - - $this->assertEquals($this->VO->getPercDev(), -50); - - } - - public function testGetAbsDev() - { - - $this->VO->setWorkedHours(50); - $this->VO->setEstHours(100); - - $this->assertEquals($this->VO->getAbsDev(), -50); - - } - - public function testGetEstHourInvoice() - { - - $this->VO->setInvoice(1000); - $this->VO->setEstHours(20); - - $this->assertEquals($this->VO->getEstHourInvoice(), 50); - - } - - public function testGetTotalProfit() - { - - $this->VO->setInvoice(10000); - $this->VO->setTotalCost(6000); - - $this->assertEquals($this->VO->getTotalProfit(), 4000); - - } - - public function testGetHourProfit() - { - - $this->VO->setInvoice(10000); - $this->VO->setTotalCost(6000); - $this->VO->setWorkedHours(100); - - $this->assertEquals($this->VO->getHourProfit(), 40); - - } - - public function testGetWorkedHourInvoice() - { - - $this->VO->setInvoice(10000); - $this->VO->setWorkedHours(100); - - $this->assertEquals($this->VO->getWorkedHourInvoice(), 100); - - } - - public function testDescriptionField() - { - - $this->VO->setDescription("Good news, everyone!"); - - $this->assertEquals($this->VO->getDescription(), "Good news, everyone!"); - - $this->VO->setDescription("I've taught the toaster to feel love!"); - - $this->assertEquals($this->VO->getDescription(), "I've taught the toaster to feel love!"); - - } - - public function testActivationField() - { - - $this->VO->setActivation(TRUE); - - $this->assertEquals($this->VO->getActivation(), TRUE); - - $this->VO->setActivation(FALSE); - - $this->assertEquals($this->VO->getActivation(), FALSE); - - } - - public function testTypeField() - { - - $this->VO->setType("Good news, everyone!"); - - $this->assertEquals($this->VO->getType(), "Good news, everyone!"); - - $this->VO->setType("I've taught the toaster to feel love!"); - - $this->assertEquals($this->VO->getType(), "I've taught the toaster to feel love!"); - - } - - public function testSchedTypeField() - { - - $this->VO->setSchedType("Good news, everyone!"); - - $this->assertEquals($this->VO->getSchedType(), "Good news, everyone!"); - - $this->VO->setSchedType("I've taught the toaster to feel love!"); - - $this->assertEquals($this->VO->getSchedType(), "I've taught the toaster to feel love!"); - - } - - public function testAreaIdField() - { - - $this->VO->setAreaId(2); - - $this->assertEquals($this->VO->getAreaId(), 2); - - $this->VO->setAreaId(45); - - $this->assertEquals($this->VO->getAreaId(), 45); - - } - -} -?> diff --git a/test/VOTests/CustomSectionVOTests.php b/test/VOTests/CustomSectionVOTests.php deleted file mode 100644 index 42323d676..000000000 --- a/test/VOTests/CustomSectionVOTests.php +++ /dev/null @@ -1,219 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/CustomSectionVO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); - -class CustomSectionVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new CustomSectionVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testNameField() - { - - $this->VO->setName('Mars'); - - $this->assertEquals($this->VO->getName(), 'Mars'); - - $this->VO->setName('Omicron Persei'); - - $this->assertEquals($this->VO->getName(), 'Omicron Persei'); - - } - - public function testReviewerField() - { - - $user = new UserVO(); - $user->setLogin('Hermes'); - - $this->VO->setReviewer($user); - - $this->assertEquals($this->VO->getReviewer(), $user); - - $user->setLogin('Leela'); - - $this->VO->setReviewer($user); - - $this->assertEquals($this->VO->getReviewer(), $user); - - } - - public function testDevelopersField() - { - - $user1 = new UserVO(); - $user1->setLogin('Hermes'); - - $user2 = new UserVO(); - $user2->setLogin('Scruffy'); - - $user3 = new UserVO(); - $user3->setLogin('Leela'); - - $users = array($user1, $user2, $user3); - - $this->VO->setDevelopers($users); - - $this->assertEquals($this->VO->getDevelopers(), $users); - - $users = array($user2, $user1); - - $this->VO->setDevelopers($users); - - $this->assertEquals($this->VO->getDevelopers(), $users); - - } - - public function testToDoField() - { - - $this->VO->setToDo(25.5); - - $this->assertEquals($this->VO->getToDo(), 25.5); - - $this->VO->setToDo(5); - - $this->assertEquals($this->VO->getToDo(), 5); - - } - - public function testOverrunField() - { - - $this->VO->setOverrun(15.5); - - $this->assertEquals($this->VO->getOverrun(), 15.5); - - $this->VO->setOverrun(2); - - $this->assertEquals($this->VO->getOverrun(), 2); - - } - - public function testDoneField() - { - - $this->VO->setDone(15.5); - - $this->assertEquals($this->VO->getDone(), 15.5); - - $this->VO->setDone(2); - - $this->assertEquals($this->VO->getDone(), 2); - - } - - public function testSpentField() - { - - $this->VO->setSpent(15.5); - - $this->assertEquals($this->VO->getSpent(), 15.5); - - $this->VO->setSpent(2); - - $this->assertEquals($this->VO->getSpent(), 2); - - } - - public function testEstHoursField() - { - - $this->VO->setEstHours(15.5); - - $this->assertEquals($this->VO->getEstHours(), 15.5); - - $this->VO->setEstHours(2); - - $this->assertEquals($this->VO->getEstHours(), 2); - - } - - public function testAcceptedField() - { - - $this->VO->setAccepted(TRUE); - - $this->assertTrue($this->VO->getAccepted()); - - $this->VO->setAccepted(FALSE); - - $this->assertFalse($this->VO->getAccepted()); - - } - - public function testModuleIdField() - { - - $this->VO->setModuleId(2); - - $this->assertEquals($this->VO->getModuleId(), 2); - - $this->VO->setModuleId(45); - - $this->assertEquals($this->VO->getModuleId(), 45); - - } - - public function testTextField() - { - - $this->VO->setName('Mars'); - - $this->assertEquals($this->VO->getName(), 'Mars'); - - $this->VO->setName('Omicron Persei'); - - $this->assertEquals($this->VO->getName(), 'Omicron Persei'); - - } - -} -?> diff --git a/test/VOTests/CustomStoryVOTests.php b/test/VOTests/CustomStoryVOTests.php deleted file mode 100644 index 5c5b812d6..000000000 --- a/test/VOTests/CustomStoryVOTests.php +++ /dev/null @@ -1,219 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/CustomStoryVO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); - -class CustomStoryVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new CustomStoryVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testNameField() - { - - $this->VO->setName('Mars'); - - $this->assertEquals($this->VO->getName(), 'Mars'); - - $this->VO->setName('Omicron Persei'); - - $this->assertEquals($this->VO->getName(), 'Omicron Persei'); - - } - - public function testReviewerField() - { - - $user = new UserVO(); - $user->setLogin('Hermes'); - - $this->VO->setReviewer($user); - - $this->assertEquals($this->VO->getReviewer(), $user); - - $user->setLogin('Leela'); - - $this->VO->setReviewer($user); - - $this->assertEquals($this->VO->getReviewer(), $user); - - } - - public function testDevelopersField() - { - - $user1 = new UserVO(); - $user1->setLogin('Hermes'); - - $user2 = new UserVO(); - $user2->setLogin('Scruffy'); - - $user3 = new UserVO(); - $user3->setLogin('Leela'); - - $users = array($user1, $user2, $user3); - - $this->VO->setDevelopers($users); - - $this->assertEquals($this->VO->getDevelopers(), $users); - - $users = array($user2, $user1); - - $this->VO->setDevelopers($users); - - $this->assertEquals($this->VO->getDevelopers(), $users); - - } - - public function testToDoField() - { - - $this->VO->setToDo(25.5); - - $this->assertEquals($this->VO->getToDo(), 25.5); - - $this->VO->setToDo(5); - - $this->assertEquals($this->VO->getToDo(), 5); - - } - - public function testOverrunField() - { - - $this->VO->setOverrun(15.5); - - $this->assertEquals($this->VO->getOverrun(), 15.5); - - $this->VO->setOverrun(2); - - $this->assertEquals($this->VO->getOverrun(), 2); - - } - - public function testDoneField() - { - - $this->VO->setDone(15.5); - - $this->assertEquals($this->VO->getDone(), 15.5); - - $this->VO->setDone(2); - - $this->assertEquals($this->VO->getDone(), 2); - - } - - public function testSpentField() - { - - $this->VO->setSpent(15.5); - - $this->assertEquals($this->VO->getSpent(), 15.5); - - $this->VO->setSpent(2); - - $this->assertEquals($this->VO->getSpent(), 2); - - } - - public function testEstHoursField() - { - - $this->VO->setEstHours(15.5); - - $this->assertEquals($this->VO->getEstHours(), 15.5); - - $this->VO->setEstHours(2); - - $this->assertEquals($this->VO->getEstHours(), 2); - - } - - public function testAcceptedField() - { - - $this->VO->setAccepted(TRUE); - - $this->assertTrue($this->VO->getAccepted()); - - $this->VO->setAccepted(FALSE); - - $this->assertFalse($this->VO->getAccepted()); - - } - - public function testIterationIdField() - { - - $this->VO->setIterationId(2); - - $this->assertEquals($this->VO->getIterationId(), 2); - - $this->VO->setIterationId(45); - - $this->assertEquals($this->VO->getIterationId(), 45); - - } - - public function testStoryIdField() - { - - $this->VO->setStoryId(2); - - $this->assertEquals($this->VO->getStoryId(), 2); - - $this->VO->setStoryId(45); - - $this->assertEquals($this->VO->getStoryId(), 45); - - } - -} -?> diff --git a/test/VOTests/CustomTaskSectionVOTests.php b/test/VOTests/CustomTaskSectionVOTests.php deleted file mode 100644 index f0ffed0f9..000000000 --- a/test/VOTests/CustomTaskSectionVOTests.php +++ /dev/null @@ -1,172 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/CustomTaskSectionVO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); - -class CustomTaskSectionVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new CustomTaskSectionVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testNameField() - { - - $this->VO->setName('Mars'); - - $this->assertEquals($this->VO->getName(), 'Mars'); - - $this->VO->setName('Omicron Persei'); - - $this->assertEquals($this->VO->getName(), 'Omicron Persei'); - - } - - public function testEstHoursField() - { - - $this->VO->setEstHours(15.75); - - $this->assertEquals($this->VO->getEstHours(), 15.75); - - $this->VO->setEstHours(7.66); - - $this->assertEquals($this->VO->getEstHours(), 7.66); - - } - - public function testRiskField() - { - - $this->VO->setRisk(1); - - $this->assertEquals($this->VO->getRisk(), 1); - - $this->VO->setRisk(3); - - $this->assertEquals($this->VO->getRisk(), 3); - - } - - public function testSectionIdField() - { - - $this->VO->setSectionId(2); - - $this->assertEquals($this->VO->getSectionId(), 2); - - $this->VO->setSectionId(45); - - $this->assertEquals($this->VO->getSectionId(), 45); - - } - - public function testReviewerField() - { - - $user = new UserVO(); - $user->setLogin('Hermes'); - - $this->VO->setReviewer($user); - - $this->assertEquals($this->VO->getReviewer(), $user); - - $user->setLogin('Leela'); - - $this->VO->setReviewer($user); - - $this->assertEquals($this->VO->getReviewer(), $user); - - } - - public function testDeveloperField() - { - - $user = new UserVO(); - $user->setLogin('Hermes'); - - $this->VO->setDeveloper($user); - - $this->assertEquals($this->VO->getDeveloper(), $user); - - $user->setLogin('Leela'); - - $this->VO->setDeveloper($user); - - $this->assertEquals($this->VO->getDeveloper(), $user); - - } - - public function testToDoField() - { - - $this->VO->setToDo(25.5); - - $this->assertEquals($this->VO->getToDo(), 25.5); - - $this->VO->setToDo(5); - - $this->assertEquals($this->VO->getToDo(), 5); - - } - - public function testSpentField() - { - - $this->VO->setSpent(15.5); - - $this->assertEquals($this->VO->getSpent(), 15.5); - - $this->VO->setSpent(2); - - $this->assertEquals($this->VO->getSpent(), 2); - - } - -} -?> diff --git a/test/VOTests/CustomTaskStoryVOTests.php b/test/VOTests/CustomTaskStoryVOTests.php deleted file mode 100644 index a73ca8bee..000000000 --- a/test/VOTests/CustomTaskStoryVOTests.php +++ /dev/null @@ -1,230 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/CustomTaskStoryVO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/TaskSectionVO.php'); -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); - -class CustomTaskStoryVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new CustomTaskStoryVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testNameField() - { - - $this->VO->setName('Mars'); - - $this->assertEquals($this->VO->getName(), 'Mars'); - - $this->VO->setName('Omicron Persei'); - - $this->assertEquals($this->VO->getName(), 'Omicron Persei'); - - } - - public function testEstHoursField() - { - - $this->VO->setEstHours(15.75); - - $this->assertEquals($this->VO->getEstHours(), 15.75); - - $this->VO->setEstHours(7.66); - - $this->assertEquals($this->VO->getEstHours(), 7.66); - - } - - public function testToDoField() - { - - $this->VO->setToDo(15.75); - - $this->assertEquals($this->VO->getToDo(), 15.75); - - $this->VO->setToDo(7.66); - - $this->assertEquals($this->VO->getToDo(), 7.66); - - } - - public function testInitField() - { - - $this->VO->setInit(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getInit(), date_create('1999-12-31')); - - $this->VO->setInit(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getInit(), date_create('2999-12-31')); - - } - - public function testEndField() - { - - $this->VO->setEnd(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getEnd(), date_create('1999-12-31')); - - $this->VO->setEnd(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getEnd(), date_create('2999-12-31')); - - } - - public function testEstEndField() - { - - $this->VO->setEstEnd(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getEstEnd(), date_create('1999-12-31')); - - $this->VO->setEstEnd(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getEstEnd(), date_create('2999-12-31')); - - } - - public function testRiskField() - { - - $this->VO->setRisk(1); - - $this->assertEquals($this->VO->getRisk(), 1); - - $this->VO->setRisk(3); - - $this->assertEquals($this->VO->getRisk(), 3); - - } - - public function testStoryIdField() - { - - $this->VO->setStoryId(2); - - $this->assertEquals($this->VO->getStoryId(), 2); - - $this->VO->setStoryId(45); - - $this->assertEquals($this->VO->getStoryId(), 45); - - } - - public function testReviewerField() - { - - $user = new UserVO(); - $user->setLogin('Hermes'); - - $this->VO->setReviewer($user); - - $this->assertEquals($this->VO->getReviewer(), $user); - - $user->setLogin('Leela'); - - $this->VO->setReviewer($user); - - $this->assertEquals($this->VO->getReviewer(), $user); - - } - - public function testDeveloperField() - { - - $user = new UserVO(); - $user->setLogin('Hermes'); - - $this->VO->setDeveloper($user); - - $this->assertEquals($this->VO->getDeveloper(), $user); - - $user->setLogin('Leela'); - - $this->VO->setDeveloper($user); - - $this->assertEquals($this->VO->getDeveloper(), $user); - - } - - public function testTaskSectionField() - { - - $taskSection = new TaskSectionVO(); - $taskSection->setName('Delivery'); - - $this->VO->setTaskSection($taskSection); - - $this->assertEquals($this->VO->getTaskSection(), $taskSection); - - $taskSection->setName('Packaging'); - - $this->VO->setTaskSection($taskSection); - - $this->assertEquals($this->VO->getTaskSection(), $taskSection); - - } - - public function testSpentField() - { - - $this->VO->setSpent(15.5); - - $this->assertEquals($this->VO->getSpent(), 15.5); - - $this->VO->setSpent(2); - - $this->assertEquals($this->VO->getSpent(), 2); - - } - -} -?> diff --git a/test/VOTests/CustomerVOTests.php b/test/VOTests/CustomerVOTests.php deleted file mode 100644 index 3fbf52d5c..000000000 --- a/test/VOTests/CustomerVOTests.php +++ /dev/null @@ -1,109 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/CustomerVO.php'); - -class CustomerVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new CustomerVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testNameField() - { - - $this->VO->setName("Mommy"); - - $this->assertEquals($this->VO->getName(), "Mommy"); - - $this->VO->setName("Ogden Wernstrom"); - - $this->assertEquals($this->VO->getName(), "Ogden Wernstrom"); - - } - - public function testTypeField() - { - - $this->VO->setType("Biggest industry on Earth"); - - $this->assertEquals($this->VO->getType(), "Biggest industry on Earth"); - - $this->VO->setType("Professor"); - - $this->assertEquals($this->VO->getType(), "Professor"); - - } - - public function testURLField() - { - - $this->VO->setURL("www.mommyindustries.com"); - - $this->assertEquals($this->VO->getURL(), "www.mommyindustries.com"); - - $this->VO->setURL("www.marsuniversity.com/teaching/wernstrom"); - - $this->assertEquals($this->VO->getURL(), "www.marsuniversity.com/teaching/wernstrom"); - - } - - public function testSectorIdField() - { - - $this->VO->setSectorId(2); - - $this->assertEquals($this->VO->getSectorId(), 2); - - $this->VO->setSectorId(45); - - $this->assertEquals($this->VO->getSectorId(), 45); - - } - -} -?> diff --git a/test/VOTests/ExtraHourVOTests.php b/test/VOTests/ExtraHourVOTests.php deleted file mode 100644 index 8c0e3fb64..000000000 --- a/test/VOTests/ExtraHourVOTests.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/ExtraHourVO.php'); - -class ExtraHourVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new ExtraHourVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testHoursField() - { - - $this->VO->setHours(2.5); - - $this->assertEquals($this->VO->getHours(), 2.5); - - $this->VO->setHours(4.5); - - $this->assertEquals($this->VO->getHours(), 4.5); - - } - - public function testDateField() - { - - $this->VO->setDate(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getDate(), date_create('1999-12-31')); - - $this->VO->setDate(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getDate(), date_create('2999-12-31')); - - } - - public function testUserIdField() - { - - $this->VO->setUserId(2); - - $this->assertEquals($this->VO->getUserId(), 2); - - $this->VO->setUserId(45); - - $this->assertEquals($this->VO->getUserId(), 45); - - } - -} -?> diff --git a/test/VOTests/HourCostHistoryVOTests.php b/test/VOTests/HourCostHistoryVOTests.php deleted file mode 100644 index 85f8b01e3..000000000 --- a/test/VOTests/HourCostHistoryVOTests.php +++ /dev/null @@ -1,109 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/HourCostHistoryVO.php'); - -class HourCostHistoryVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new HourCostHistoryVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testHourCostField() - { - - $this->VO->setHourCost(2.54); - - $this->assertEquals($this->VO->getHourCost(), 2.54); - - $this->VO->setHourCost(4.32); - - $this->assertEquals($this->VO->getHourCost(), 4.32); - - } - - public function testInitDateField() - { - - $this->VO->setInitDate(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getInitDate(), date_create('1999-12-31')); - - $this->VO->setInitDate(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getInitDate(), date_create('2999-12-31')); - - } - - public function testEndDateField() - { - - $this->VO->setEndDate(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getEndDate(), date_create('1999-12-31')); - - $this->VO->setEndDate(NULL); - - $this->assertEquals($this->VO->getEndDate(), NULL); - - } - - public function testUserIdField() - { - - $this->VO->setUserId(2); - - $this->assertEquals($this->VO->getUserId(), 2); - - $this->VO->setUserId(45); - - $this->assertEquals($this->VO->getUserId(), 45); - - } - -} -?> diff --git a/test/VOTests/IterationVOTests.php b/test/VOTests/IterationVOTests.php deleted file mode 100644 index 7a3f258aa..000000000 --- a/test/VOTests/IterationVOTests.php +++ /dev/null @@ -1,122 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/IterationVO.php'); - -class IterationVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new IterationVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testInitField() - { - - $this->VO->setInit(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getInit(), date_create('1999-12-31')); - - $this->VO->setInit(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getInit(), date_create('2999-12-31')); - - } - - public function testEndField() - { - - $this->VO->setEnd(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getEnd(), date_create('1999-12-31')); - - $this->VO->setEnd(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getEnd(), date_create('2999-12-31')); - - } - - public function testNameField() - { - - $this->VO->setName('Mars'); - - $this->assertEquals($this->VO->getName(), 'Mars'); - - $this->VO->setName('Omicron Persei'); - - $this->assertEquals($this->VO->getName(), 'Omicron Persei'); - - } - - public function testSummaryField() - { - - $this->VO->setSummary('Deliveries on Mars'); - - $this->assertEquals($this->VO->getSummary(), 'Deliveries on Mars'); - - $this->VO->setSummary('Deliveries on Omicron Persei'); - - $this->assertEquals($this->VO->getSummary(), 'Deliveries on Omicron Persei'); - - } - - public function testProjectIdField() - { - - $this->VO->setProjectId(2); - - $this->assertEquals($this->VO->getProjectId(), 2); - - $this->VO->setProjectId(45); - - $this->assertEquals($this->VO->getProjectId(), 45); - - } - -} -?> diff --git a/test/VOTests/JourneyHistoryVOTests.php b/test/VOTests/JourneyHistoryVOTests.php deleted file mode 100644 index 724ae277e..000000000 --- a/test/VOTests/JourneyHistoryVOTests.php +++ /dev/null @@ -1,109 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/JourneyHistoryVO.php'); - -class JourneyHistoryVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new JourneyHistoryVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testJourneyField() - { - - $this->VO->setJourney(2); - - $this->assertEquals($this->VO->getJourney(), 2); - - $this->VO->setJourney(4); - - $this->assertEquals($this->VO->getJourney(), 4); - - } - - public function testInitDateField() - { - - $this->VO->setInitDate(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getInitDate(), date_create('1999-12-31')); - - $this->VO->setInitDate(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getInitDate(), date_create('2999-12-31')); - - } - - public function testEndDateField() - { - - $this->VO->setEndDate(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getEndDate(), date_create('1999-12-31')); - - $this->VO->setEndDate(NULL); - - $this->assertEquals($this->VO->getEndDate(), NULL); - - } - - public function testUserIdField() - { - - $this->VO->setUserId(2); - - $this->assertEquals($this->VO->getUserId(), 2); - - $this->VO->setUserId(45); - - $this->assertEquals($this->VO->getUserId(), 45); - - } - -} -?> diff --git a/test/VOTests/ModuleVOTests.php b/test/VOTests/ModuleVOTests.php deleted file mode 100644 index 12c585a05..000000000 --- a/test/VOTests/ModuleVOTests.php +++ /dev/null @@ -1,122 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/ModuleVO.php'); - -class ModuleVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new ModuleVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testInitField() - { - - $this->VO->setInit(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getInit(), date_create('1999-12-31')); - - $this->VO->setInit(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getInit(), date_create('2999-12-31')); - - } - - public function testEndField() - { - - $this->VO->setEnd(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getEnd(), date_create('1999-12-31')); - - $this->VO->setEnd(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getEnd(), date_create('2999-12-31')); - - } - - public function testNameField() - { - - $this->VO->setName('Mars'); - - $this->assertEquals($this->VO->getName(), 'Mars'); - - $this->VO->setName('Omicron Persei'); - - $this->assertEquals($this->VO->getName(), 'Omicron Persei'); - - } - - public function testSummaryField() - { - - $this->VO->setSummary('Deliveries on Mars'); - - $this->assertEquals($this->VO->getSummary(), 'Deliveries on Mars'); - - $this->VO->setSummary('Deliveries on Omicron Persei'); - - $this->assertEquals($this->VO->getSummary(), 'Deliveries on Omicron Persei'); - - } - - public function testProjectIdField() - { - - $this->VO->setProjectId(2); - - $this->assertEquals($this->VO->getProjectId(), 2); - - $this->VO->setProjectId(45); - - $this->assertEquals($this->VO->getProjectId(), 45); - - } - -} -?> diff --git a/test/VOTests/ProjectScheduleVOTests.php b/test/VOTests/ProjectScheduleVOTests.php deleted file mode 100644 index f221f69c9..000000000 --- a/test/VOTests/ProjectScheduleVOTests.php +++ /dev/null @@ -1,148 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/ProjectScheduleVO.php'); - -class ProjectScheduleVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new ProjectScheduleVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testWeeklyLoadField() - { - - $this->VO->setWeeklyLoad(2.5); - - $this->assertEquals($this->VO->getWeeklyLoad(), 2.5); - - $this->VO->setWeeklyLoad(4.5); - - $this->assertEquals($this->VO->getWeeklyLoad(), 4.5); - - } - - public function testInitWeekField() - { - - $this->VO->setInitWeek(1); - - $this->assertEquals($this->VO->getInitWeek(), 1); - - $this->VO->setInitWeek(50); - - $this->assertEquals($this->VO->getInitWeek(), 50); - - } - - public function testEndWeekField() - { - - $this->VO->setEndWeek(1); - - $this->assertEquals($this->VO->getEndWeek(), 1); - - $this->VO->setEndWeek(50); - - $this->assertEquals($this->VO->getEndWeek(), 50); - - } - - public function testInitYearField() - { - - $this->VO->setInitYear(2000); - - $this->assertEquals($this->VO->getInitYear(), 2000); - - $this->VO->setInitYear(3000); - - $this->assertEquals($this->VO->getInitYear(), 3000); - - } - - public function testEndYearField() - { - - $this->VO->setEndYear(2000); - - $this->assertEquals($this->VO->getEndYear(), 2000); - - $this->VO->setEndYear(3000); - - $this->assertEquals($this->VO->getEndYear(), 3000); - - } - - public function testUserIdField() - { - - $this->VO->setUserId(2); - - $this->assertEquals($this->VO->getUserId(), 2); - - $this->VO->setUserId(45); - - $this->assertEquals($this->VO->getUserId(), 45); - - } - - public function testProjectIdField() - { - - $this->VO->setProjectId(2); - - $this->assertEquals($this->VO->getProjectId(), 2); - - $this->VO->setProjectId(45); - - $this->assertEquals($this->VO->getProjectId(), 45); - - } - -} -?> diff --git a/test/VOTests/ProjectVOTests.php b/test/VOTests/ProjectVOTests.php deleted file mode 100644 index 5cd641ee6..000000000 --- a/test/VOTests/ProjectVOTests.php +++ /dev/null @@ -1,187 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/ProjectVO.php'); - -class ProjectVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new ProjectVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testInitField() - { - - $this->VO->setInit(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getInit(), date_create('1999-12-31')); - - $this->VO->setInit(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getInit(), date_create('2999-12-31')); - - } - - public function testEndField() - { - - $this->VO->setEnd(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getEnd(), date_create('1999-12-31')); - - $this->VO->setEnd(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getEnd(), date_create('2999-12-31')); - - } - - public function testInvoiceField() - { - - $this->VO->setInvoice(2.54); - - $this->assertEquals($this->VO->getInvoice(), 2.54); - - $this->VO->setInvoice(4.54); - - $this->assertEquals($this->VO->getInvoice(), 4.54); - - } - - public function testEstHoursField() - { - - $this->VO->setEstHours(2.54); - - $this->assertEquals($this->VO->getEstHours(), 2.54); - - $this->VO->setEstHours(4.54); - - $this->assertEquals($this->VO->getEstHours(), 4.54); - - } - - public function testMovedHoursField() - { - - $this->VO->setMovedHours(2.54); - - $this->assertEquals($this->VO->getMovedHours(), 2.54); - - $this->VO->setMovedHours(4.54); - - $this->assertEquals($this->VO->getMovedHours(), 4.54); - - } - - public function testDescriptionField() - { - - $this->VO->setDescription("Good news, everyone!"); - - $this->assertEquals($this->VO->getDescription(), "Good news, everyone!"); - - $this->VO->setDescription("I've taught the toaster to feel love!"); - - $this->assertEquals($this->VO->getDescription(), "I've taught the toaster to feel love!"); - - } - - public function testActivationField() - { - - $this->VO->setActivation(TRUE); - - $this->assertEquals($this->VO->getActivation(), TRUE); - - $this->VO->setActivation(FALSE); - - $this->assertEquals($this->VO->getActivation(), FALSE); - - } - - public function testTypeField() - { - - $this->VO->setType("Good news, everyone!"); - - $this->assertEquals($this->VO->getType(), "Good news, everyone!"); - - $this->VO->setType("I've taught the toaster to feel love!"); - - $this->assertEquals($this->VO->getType(), "I've taught the toaster to feel love!"); - - } - - public function testSchedTypeField() - { - - $this->VO->setSchedType("Good news, everyone!"); - - $this->assertEquals($this->VO->getSchedType(), "Good news, everyone!"); - - $this->VO->setSchedType("I've taught the toaster to feel love!"); - - $this->assertEquals($this->VO->getSchedType(), "I've taught the toaster to feel love!"); - - } - - public function testAreaIdField() - { - - $this->VO->setAreaId(2); - - $this->assertEquals($this->VO->getAreaId(), 2); - - $this->VO->setAreaId(45); - - $this->assertEquals($this->VO->getAreaId(), 45); - - } - -} -?> diff --git a/test/VOTests/SectionVOTests.php b/test/VOTests/SectionVOTests.php deleted file mode 100644 index 573e78b96..000000000 --- a/test/VOTests/SectionVOTests.php +++ /dev/null @@ -1,122 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/SectionVO.php'); - -class SectionVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new SectionVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testNameField() - { - - $this->VO->setName('Mars'); - - $this->assertEquals($this->VO->getName(), 'Mars'); - - $this->VO->setName('Omicron Persei'); - - $this->assertEquals($this->VO->getName(), 'Omicron Persei'); - - } - - public function testAcceptedField() - { - - $this->VO->setAccepted(TRUE); - - $this->assertTrue($this->VO->getAccepted()); - - $this->VO->setAccepted(FALSE); - - $this->assertFalse($this->VO->getAccepted()); - - } - - public function testModuleIdField() - { - - $this->VO->setModuleId(2); - - $this->assertEquals($this->VO->getModuleId(), 2); - - $this->VO->setModuleId(45); - - $this->assertEquals($this->VO->getModuleId(), 45); - - } - - public function testUserIdField() - { - - $this->VO->setUserId(2); - - $this->assertEquals($this->VO->getUserId(), 2); - - $this->VO->setUserId(45); - - $this->assertEquals($this->VO->getUserId(), 45); - - } - - public function testTextField() - { - - $this->VO->setName('Mars'); - - $this->assertEquals($this->VO->getName(), 'Mars'); - - $this->VO->setName('Omicron Persei'); - - $this->assertEquals($this->VO->getName(), 'Omicron Persei'); - - } - -} -?> diff --git a/test/VOTests/SectorVOTests.php b/test/VOTests/SectorVOTests.php deleted file mode 100644 index c6b2886fd..000000000 --- a/test/VOTests/SectorVOTests.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/SectorVO.php'); - -class SectorVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new SectorVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testNameField() - { - - $this->VO->setName("PlanetExpress"); - - $this->assertEquals($this->VO->getName(), "PlanetExpress"); - - $this->VO->setName("Mommy industries"); - - $this->assertEquals($this->VO->getName(), "Mommy industries"); - - } - -} -?> diff --git a/test/VOTests/StoryVOTests.php b/test/VOTests/StoryVOTests.php deleted file mode 100644 index 3951469a2..000000000 --- a/test/VOTests/StoryVOTests.php +++ /dev/null @@ -1,122 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/StoryVO.php'); - -class StoryVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new StoryVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testNameField() - { - - $this->VO->setName('Mars'); - - $this->assertEquals($this->VO->getName(), 'Mars'); - - $this->VO->setName('Omicron Persei'); - - $this->assertEquals($this->VO->getName(), 'Omicron Persei'); - - } - - public function testAcceptedField() - { - - $this->VO->setAccepted(TRUE); - - $this->assertTrue($this->VO->getAccepted()); - - $this->VO->setAccepted(FALSE); - - $this->assertFalse($this->VO->getAccepted()); - - } - - public function testIterationIdField() - { - - $this->VO->setIterationId(2); - - $this->assertEquals($this->VO->getIterationId(), 2); - - $this->VO->setIterationId(45); - - $this->assertEquals($this->VO->getIterationId(), 45); - - } - - public function testUserIdField() - { - - $this->VO->setUserId(2); - - $this->assertEquals($this->VO->getUserId(), 2); - - $this->VO->setUserId(45); - - $this->assertEquals($this->VO->getUserId(), 45); - - } - - public function testStoryIdField() - { - - $this->VO->setStoryId(2); - - $this->assertEquals($this->VO->getStoryId(), 2); - - $this->VO->setStoryId(45); - - $this->assertEquals($this->VO->getStoryId(), 45); - - } - -} -?> diff --git a/test/VOTests/TaskSectionVOTests.php b/test/VOTests/TaskSectionVOTests.php deleted file mode 100644 index 9558359e9..000000000 --- a/test/VOTests/TaskSectionVOTests.php +++ /dev/null @@ -1,122 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/TaskSectionVO.php'); - -class TaskSectionVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new TaskSectionVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testNameField() - { - - $this->VO->setName('Mars'); - - $this->assertEquals($this->VO->getName(), 'Mars'); - - $this->VO->setName('Omicron Persei'); - - $this->assertEquals($this->VO->getName(), 'Omicron Persei'); - - } - - public function testEstHoursField() - { - - $this->VO->setEstHours(15.75); - - $this->assertEquals($this->VO->getEstHours(), 15.75); - - $this->VO->setEstHours(7.66); - - $this->assertEquals($this->VO->getEstHours(), 7.66); - - } - - public function testRiskField() - { - - $this->VO->setRisk(1); - - $this->assertEquals($this->VO->getRisk(), 1); - - $this->VO->setRisk(3); - - $this->assertEquals($this->VO->getRisk(), 3); - - } - - public function testSectionIdField() - { - - $this->VO->setSectionId(2); - - $this->assertEquals($this->VO->getSectionId(), 2); - - $this->VO->setSectionId(45); - - $this->assertEquals($this->VO->getSectionId(), 45); - - } - - public function testUserIdField() - { - - $this->VO->setUserId(2); - - $this->assertEquals($this->VO->getUserId(), 2); - - $this->VO->setUserId(45); - - $this->assertEquals($this->VO->getUserId(), 45); - - } - -} -?> diff --git a/test/VOTests/TaskStoryVOTests.php b/test/VOTests/TaskStoryVOTests.php deleted file mode 100644 index a5c6c4f44..000000000 --- a/test/VOTests/TaskStoryVOTests.php +++ /dev/null @@ -1,187 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/TaskStoryVO.php'); - -class TaskStoryVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new TaskStoryVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testNameField() - { - - $this->VO->setName('Mars'); - - $this->assertEquals($this->VO->getName(), 'Mars'); - - $this->VO->setName('Omicron Persei'); - - $this->assertEquals($this->VO->getName(), 'Omicron Persei'); - - } - - public function testEstHoursField() - { - - $this->VO->setEstHours(15.75); - - $this->assertEquals($this->VO->getEstHours(), 15.75); - - $this->VO->setEstHours(7.66); - - $this->assertEquals($this->VO->getEstHours(), 7.66); - - } - - public function testToDoField() - { - - $this->VO->setToDo(15.75); - - $this->assertEquals($this->VO->getToDo(), 15.75); - - $this->VO->setToDo(7.66); - - $this->assertEquals($this->VO->getToDo(), 7.66); - - } - - public function testInitField() - { - - $this->VO->setInit(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getInit(), date_create('1999-12-31')); - - $this->VO->setInit(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getInit(), date_create('2999-12-31')); - - } - - public function testEndField() - { - - $this->VO->setEnd(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getEnd(), date_create('1999-12-31')); - - $this->VO->setEnd(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getEnd(), date_create('2999-12-31')); - - } - - public function testEstEndField() - { - - $this->VO->setEstEnd(date_create('1999-12-31')); - - $this->assertEquals($this->VO->getEstEnd(), date_create('1999-12-31')); - - $this->VO->setEstEnd(date_create('2999-12-31')); - - $this->assertEquals($this->VO->getEstEnd(), date_create('2999-12-31')); - - } - - public function testRiskField() - { - - $this->VO->setRisk(1); - - $this->assertEquals($this->VO->getRisk(), 1); - - $this->VO->setRisk(3); - - $this->assertEquals($this->VO->getRisk(), 3); - - } - - public function testStoryIdField() - { - - $this->VO->setStoryId(2); - - $this->assertEquals($this->VO->getStoryId(), 2); - - $this->VO->setStoryId(45); - - $this->assertEquals($this->VO->getStoryId(), 45); - - } - - public function testTaskSectionIdField() - { - - $this->VO->setTaskSectionId(2); - - $this->assertEquals($this->VO->getTaskSectionId(), 2); - - $this->VO->setTaskSectionId(45); - - $this->assertEquals($this->VO->getTaskSectionId(), 45); - - } - - public function testUserIdField() - { - - $this->VO->setUserId(2); - - $this->assertEquals($this->VO->getUserId(), 2); - - $this->VO->setUserId(45); - - $this->assertEquals($this->VO->getUserId(), 45); - - } - -} -?> diff --git a/test/VOTests/TaskVOTests.php b/test/VOTests/TaskVOTests.php deleted file mode 100644 index 510a66fbc..000000000 --- a/test/VOTests/TaskVOTests.php +++ /dev/null @@ -1,187 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/TaskVO.php'); - -class TaskVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new TaskVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testInitField() - { - - $this->VO->setInit(2); - - $this->assertEquals($this->VO->getInit(), 2); - - $this->VO->setInit(4); - - $this->assertEquals($this->VO->getInit(), 4); - - } - - public function testEndField() - { - - $this->VO->setEnd(2); - - $this->assertEquals($this->VO->getEnd(), 2); - - $this->VO->setEnd(4); - - $this->assertEquals($this->VO->getEnd(), 4); - - } - - public function testStoryField() - { - - $this->VO->setStory("Good news, everyone!"); - - $this->assertEquals($this->VO->getStory(), "Good news, everyone!"); - - $this->VO->setStory("I've taught the toaster to feel love!"); - - $this->assertEquals($this->VO->getStory(), "I've taught the toaster to feel love!"); - - } - - public function testTeleworkField() - { - - $this->VO->setTelework(TRUE); - - $this->assertEquals($this->VO->getTelework(), TRUE); - - $this->VO->setTelework(FALSE); - - $this->assertEquals($this->VO->getTelework(), FALSE); - - } - - public function testTextField() - { - - $this->VO->setText("Good news, everyone!"); - - $this->assertEquals($this->VO->getText(), "Good news, everyone!"); - - $this->VO->setText("I've taught the toaster to feel love!"); - - $this->assertEquals($this->VO->getText(), "I've taught the toaster to feel love!"); - - } - - public function testTtypeField() - { - - $this->VO->setTtype("Good news, everyone!"); - - $this->assertEquals($this->VO->getTtype(), "Good news, everyone!"); - - $this->VO->setTtype("I've taught the toaster to feel love!"); - - $this->assertEquals($this->VO->getTtype(), "I've taught the toaster to feel love!"); - - } - - public function testPhaseField() - { - - $this->VO->setPhase("Scruffy"); - - $this->assertEquals($this->VO->getPhase(), "Scruffy"); - - $this->VO->setPhase("Nibbles"); - - $this->assertEquals($this->VO->getPhase(), "Nibbles"); - - } - - public function testUsrIdField() - { - - $this->VO->setUserId(2); - - $this->assertEquals($this->VO->getUserId(), 2); - - $this->VO->setUserId(45); - - $this->assertEquals($this->VO->getUserId(), 45); - - } - - public function testProjectIdField() - { - - $this->VO->setProjectId(2); - - $this->assertEquals($this->VO->getProjectId(), 2); - - $this->VO->setProjectId(45); - - $this->assertEquals($this->VO->getProjectId(), 45); - - } - - public function testCustomerIdField() - { - - $this->VO->setCustomerId(2); - - $this->assertEquals($this->VO->getCustomerId(), 2); - - $this->VO->setCustomerId(45); - - $this->assertEquals($this->VO->getCustomerId(), 45); - - } - -} -?> diff --git a/test/VOTests/UserGroupVOTests.php b/test/VOTests/UserGroupVOTests.php deleted file mode 100644 index a760f32b3..000000000 --- a/test/VOTests/UserGroupVOTests.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/UserGroupVO.php'); - -class UserGroupVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new UserGroupVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testNameField() - { - - $this->VO->setName("PlanetExpress"); - - $this->assertEquals($this->VO->getName(), "PlanetExpress"); - - $this->VO->setName("Mommy industries"); - - $this->assertEquals($this->VO->getName(), "Mommy industries"); - - } - -} -?> diff --git a/test/VOTests/UserVOTests.php b/test/VOTests/UserVOTests.php deleted file mode 100644 index 503dd6678..000000000 --- a/test/VOTests/UserVOTests.php +++ /dev/null @@ -1,100 +0,0 @@ - - * - * This file is part of PhpReport. - * - * PhpReport is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * PhpReport is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with PhpReport. If not, see . - */ - - -include_once(PHPREPORT_ROOT . '/model/vo/UserVO.php'); - -class UserVOTests extends PHPUnit_Framework_TestCase -{ - - protected $VO; - - protected function setUp() - { - - $this->VO = new UserVO(); - - } - - public function testNew() - { - - $this->assertNotNull($this->VO); - - } - - public function testIdField() - { - - $this->VO->setId(1); - - $this->assertEquals($this->VO->getId(), 1); - - $this->VO->setId(2); - - $this->assertEquals($this->VO->getId(), 2); - - } - - public function testLoginField() - { - - $this->VO->setLogin("bender"); - - $this->assertEquals($this->VO->getLogin(), "bender"); - - $this->VO->setLogin("fry"); - - $this->assertEquals($this->VO->getLogin(), "fry"); - - } - - public function testPasswordField() - { - - $this->VO->setPassword("kiss my shiny metal ass"); - - $this->assertEquals($this->VO->getPassword(), "kiss my shiny metal ass"); - - $this->VO->setPassword("you meat-bag"); - - $this->assertEquals($this->VO->getPassword(), "you meat-bag"); - - } - - public function testGroupsField() - { - - $groups = array("Fry", "Leela", "Bender", "Hubert"); - - $this->VO->setGroups($groups); - - $this->assertEquals($this->VO->getGroups(), $groups); - - $groups[3] = "Zoidberg"; - - $this->VO->setGroups($groups); - - $this->assertEquals($this->VO->getGroups(), $groups); - - } - -} -?> From 55b4b2bbec9d2d134144cbe5920d1a53ce733b5d Mon Sep 17 00:00:00 2001 From: Ana Rute Mendes Date: Mon, 23 Aug 2021 18:25:03 -0300 Subject: [PATCH 2/7] Add composer and autoload settings --- .gitignore | 3 + composer.json | 21 + composer.lock | 2121 +++++++++++++++++++++++++++++++++++ docs/admin/installation.rst | 10 +- 4 files changed, 2154 insertions(+), 1 deletion(-) create mode 100644 composer.json create mode 100644 composer.lock diff --git a/.gitignore b/.gitignore index 691dda5c9..eceda906a 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,6 @@ config/config.defaults #minified JS and source maps *.min.js *.min.js.map + +# Composer dependencies +vendor diff --git a/composer.json b/composer.json new file mode 100644 index 000000000..b3e775eca --- /dev/null +++ b/composer.json @@ -0,0 +1,21 @@ +{ + "name": "igalia/phpreport", + "description": "phpreport", + "type": "project", + "license": "GNU GPLv3", + "autoload": { + "psr-4": { + "Phpreport\\Model\\": "model/", + "Phpreport\\Web\\": "web/" + } + }, + "autoload-dev": { + "psr-4": { + "Phpreport\\Tests\\": "tests/" + } + }, + "minimum-stability": "dev", + "require-dev": { + "phpunit/phpunit": "9.5.x-dev" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 000000000..59137ba6c --- /dev/null +++ b/composer.lock @@ -0,0 +1,2121 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "3848deeaee8c80c327ea854bd565a52a", + "packages": [], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.5.x-dev", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "6410c4b8352cb64218641457cef64997e6b784fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/6410c4b8352cb64218641457cef64997e6b784fb", + "reference": "6410c4b8352cb64218641457cef64997e6b784fb", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^8.0", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.4.x" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2020-11-10T19:05:51+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.x-dev", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "default-branch": true, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2020-11-13T09:40:50+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.12.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "6608f01670c3cc5079e18c1dab1104e002579143" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6608f01670c3cc5079e18c1dab1104e002579143", + "reference": "6608f01670c3cc5079e18c1dab1104e002579143", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.12.0" + }, + "time": "2021-07-21T10:44:31+00:00" + }, + { + "name": "phar-io/manifest", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.3" + }, + "time": "2021-07-20T11:28:43+00:00" + }, + { + "name": "phar-io/version", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "bae7c545bef187884426f042434e561ab1ddb182" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", + "reference": "bae7c545bef187884426f042434e561ab1ddb182", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.1.0" + }, + "time": "2021-02-23T14:00:09+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "a0eeab580cbdf4414fef6978732510a36ed0a9d6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/a0eeab580cbdf4414fef6978732510a36ed0a9d6", + "reference": "a0eeab580cbdf4414fef6978732510a36ed0a9d6", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/master" + }, + "time": "2021-06-25T13:47:51+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "c5ac781da36459457837159b308fe88912e07a78" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/c5ac781da36459457837159b308fe88912e07a78", + "reference": "c5ac781da36459457837159b308fe88912e07a78", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" + }, + "require-dev": { + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + }, + "time": "2021-08-13T09:13:23+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.x-dev", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "7b2df704cbe99a7b0522c7d5d7b7c5ea61b196bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/7b2df704cbe99a7b0522c7d5d7b7c5ea61b196bb", + "reference": "7b2df704cbe99a7b0522c7d5d7b7c5ea61b196bb", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "*", + "psalm/phar": "^4.8" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.x" + }, + "time": "2021-08-20T10:47:25+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "1.13.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", + "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.2", + "php": "^7.2 || ~8.0, <8.1", + "phpdocumentor/reflection-docblock": "^5.2", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" + }, + "require-dev": { + "phpspec/phpspec": "^6.0", + "phpunit/phpunit": "^8.0 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11.x-dev" + } + }, + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/1.13.0" + }, + "time": "2021-03-17T13:42:18+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "9.2.x-dev", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "d96981c0d2718c56aea9eeb254d3159b808156c3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d96981c0d2718c56aea9eeb254d3159b808156c3", + "reference": "d96981c0d2718c56aea9eeb254d3159b808156c3", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.10.2", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcov": "*", + "ext-xdebug": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-08-17T14:56:04+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "3.0.x-dev", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "d7e633e95043246c5370e96d4cd17aa2cc79ab78" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/d7e633e95043246c5370e96d4cd17aa2cc79ab78", + "reference": "d7e633e95043246c5370e96d4cd17aa2cc79ab78", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-07-30T13:35:46+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "5.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:16:10+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "9.5.x-dev", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "0979089082b2506ad2e75fb221268018b9bb79eb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0979089082b2506ad2e75fb221268018b9bb79eb", + "reference": "0979089082b2506ad2e75fb221268018b9bb79eb", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.3.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.3", + "phpspec/prophecy": "^1.12.1", + "phpunit/php-code-coverage": "^9.2.3", + "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.5", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.3", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^2.3.4", + "sebastian/version": "^3.0.2" + }, + "require-dev": { + "ext-pdo": "*", + "phpspec/prophecy-phpunit": "^2.0.1" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.5-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ], + "files": [ + "src/Framework/Assert/Functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5" + }, + "funding": [ + { + "url": "https://phpunit.de/donate.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-08-20T05:38:37+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:08:49+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" + }, + { + "name": "sebastian/comparator", + "version": "4.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "55f4261989e546dc112258c7a75935a81a7ce382" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", + "reference": "55f4261989e546dc112258c7a75935a81a7ce382", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:49:45+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.7", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:52:27+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:10:38+00:00" + }, + { + "name": "sebastian/environment", + "version": "5.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "388b6ced16caa751030f6a69e588299fa09200ac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", + "reference": "388b6ced16caa751030f6a69e588299fa09200ac", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:52:38+00:00" + }, + { + "name": "sebastian/exporter", + "version": "4.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:24:23+00:00" + }, + { + "name": "sebastian/global-state", + "version": "5.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-06-11T13:31:12+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.6", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:42:11+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:17:30+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:45:17+00:00" + }, + { + "name": "sebastian/type", + "version": "2.3.x-dev", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "f24cbc541026c3bb7d27c647f0f9ea337135b22a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/f24cbc541026c3bb7d27c647f0f9ea337135b22a", + "reference": "f24cbc541026c3bb7d27c647f0f9ea337135b22a", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/2.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-06-18T06:28:45+00:00" + }, + { + "name": "sebastian/version", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c6c1022351a901512170118436c764e473f6de8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "dev-main", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-02-19T12:13:01+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2021-07-28T10:34:58+00:00" + }, + { + "name": "webmozart/assert", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/webmozarts/assert.git", + "reference": "b419d648592b0b8911cbbe10d450fe314f4fd262" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/b419d648592b0b8911cbbe10d450fe314f4fd262", + "reference": "b419d648592b0b8911cbbe10d450fe314f4fd262", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<4.6.1 || 4.6.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.13" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/master" + }, + "time": "2021-06-19T13:45:26+00:00" + } + ], + "aliases": [], + "minimum-stability": "dev", + "stability-flags": { + "phpunit/phpunit": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.1.0" +} diff --git a/docs/admin/installation.rst b/docs/admin/installation.rst index 01d9b8413..33665417e 100644 --- a/docs/admin/installation.rst +++ b/docs/admin/installation.rst @@ -10,7 +10,7 @@ To install PhpReport in your system, you will need the following software: * PostgreSQL database server (tested with PostgreSQL 9) -* PHP 7.0 or higher +* PHP 7.3 or higher * Support for PostgreSQL @@ -29,6 +29,14 @@ Run the following command with root privileges: * RHEL: ``yum install postgresql-server httpd php php-pgsql php-xml`` +Install composer to manage the project dependencies. Follow the official +docs for the instructions: https://getcomposer.org/doc/00-intro.md#installation-linux-unix-macos + +After installing composer, run ``composer dump-autoload -o`` inside PhpReport root +directory, so it can generate the autoload files. + +Run ``composer install`` to install the project dependencies. + Step 1: Setting up the database =============================== From 74a3e2a405dca021068cd89cc2552c317b6bcac2 Mon Sep 17 00:00:00 2001 From: Ana Rute Mendes Date: Tue, 31 Aug 2021 15:41:05 -0300 Subject: [PATCH 3/7] Move template creation logic to TemplateService The createTemplateService will just receive a request and return whatever the TemplateService parses and executes from it. The goal is to start splitting what handles the requests and what processes the data and business logic. --- web/services/TemplateService.php | 217 ++++++++++++++++++++++++ web/services/createTemplatesService.php | 213 +---------------------- 2 files changed, 222 insertions(+), 208 deletions(-) create mode 100644 web/services/TemplateService.php diff --git a/web/services/TemplateService.php b/web/services/TemplateService.php new file mode 100644 index 000000000..6e8a0974c --- /dev/null +++ b/web/services/TemplateService.php @@ -0,0 +1,217 @@ + + * + * This file is part of PhpReport. + * + * PhpReport is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PhpReport is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with PhpReport. If not, see . + */ + +namespace Phpreport\Web\services; + +if (!defined('PHPREPORT_ROOT')) define('PHPREPORT_ROOT', __DIR__ . '/../../'); + +include_once(PHPREPORT_ROOT . '/web/services/WebServicesFunctions.php'); +include_once(PHPREPORT_ROOT . '/model/facade/TemplatesFacade.php'); +include_once(PHPREPORT_ROOT . '/model/vo/TemplateVO.php'); +require_once(PHPREPORT_ROOT . '/util/LoginManager.php'); + +class TemplateService +{ + public function createTemplate(string $request): string + { + $parser = new \XMLReader(); + + $parser->XML($request); + $sid = NULL; + + do { + + $parser->read(); + + if ($parser->name == 'templates') { + + $sid = $parser->getAttribute("sid"); + + $parser->read(); + } + + /* We check authentication and authorization */ + $user = \LoginManager::isLogged($sid); + + if (!$user) { + $string = "falseYou must be logged in"; + break; + } + + if (!\LoginManager::isAllowed($sid)) { + $string = "falseForbidden service for this User"; + break; + } + + $createTemplates = []; + do { + if ($parser->name == "template") { + $templatesVO = new \TemplateVO(); + + $templatesVO->setTelework(false); + $templatesVO->setOnsite(false); + $templatesVO->setUserId($user->getId()); + + $parser->read(); + + while ($parser->name != "template") { + + switch ($parser->name) { + case "story": + $parser->read(); + if ($parser->hasValue) { + $templatesVO->setStory(unescape_string($parser->value)); + $parser->next(); + $parser->next(); + } + break; + + case "telework": + $parser->read(); + if ($parser->hasValue) { + if (strtolower($parser->value) == "true") + $templatesVO->setTelework(true); + $parser->next(); + $parser->next(); + } + break; + + case "onsite": + $parser->read(); + if ($parser->hasValue) { + if (strtolower($parser->value) == "true") + $templatesVO->setOnsite(true); + $parser->next(); + $parser->next(); + } + break; + + case "ttype": + $parser->read(); + if ($parser->hasValue) { + $templatesVO->setTtype(unescape_string($parser->value)); + $parser->next(); + $parser->next(); + } + break; + + case "text": + $parser->read(); + if ($parser->hasValue) { + $templatesVO->setText(unescape_string($parser->value)); + $parser->next(); + $parser->next(); + } + break; + + case "name": + $parser->read(); + if ($parser->hasValue) { + $templatesVO->setName(substr(unescape_string($parser->value), 0, 75)); + $parser->next(); + $parser->next(); + } + break; + + case "taskStoryId": + $parser->read(); + if ($parser->hasValue) { + $templatesVO->setTaskStoryId($parser->value); + $parser->next(); + $parser->next(); + } + break; + + case "projectId": + $parser->read(); + if ($parser->hasValue) { + $templatesVO->setProjectId($parser->value); + $parser->next(); + $parser->next(); + } + break; + + case "initTime": + $initTimeFormat = $parser->getAttribute("format"); + if (is_null($initTimeFormat)) + $initTimeFormat = "H:i"; + $parser->read(); + if ($parser->hasValue) { + $initTimeRaw = $parser->value; + $initTimeParse = date_parse_from_format($initTimeFormat, $initTimeRaw); + $initTime = $initTimeParse['hour'] * 60 + $initTimeParse['minute']; + $templatesVO->setInitTime($initTime); + $templatesVO->setInitTimeRaw($initTimeRaw); + $parser->next(); + $parser->next(); + } else { + $templatesVO->setInitTime(NULL); + } + break; + + case "endTime": + $endTimeFormat = $parser->getAttribute("format"); + if (is_null($endTimeFormat)) + $endTimeFormat = "H:i"; + $parser->read(); + if ($parser->hasValue) { + $endTimeRaw = $parser->value; + $endTimeParse = date_parse_from_format($endTimeFormat, $endTimeRaw); + if (($endTimeParse['hour'] == 0) && ($endTimeParse['minute'] == 0)) $endTimeParse['hour'] = 24; + $endTime = $endTimeParse['hour'] * 60 + $endTimeParse['minute']; + $templatesVO->setEndTime($endTime); + $templatesVO->setEndTimeRaw($endTimeRaw); + $parser->next(); + $parser->next(); + } else { + $templatesVO->setEndTime(NULL); + } + break; + default: + $parser->next(); + break; + } + } + $createTemplates[] = $templatesVO; + } + } while ($parser->read()); + + $string = ""; + if (count($createTemplates) >= 1) { + if (\TemplatesFacade::CreateTemplates($createTemplates) == -1) + $string = "falseThere was some error while creating the tasks"; + + if (!$string) { + $string = "trueOperation Success!"; + foreach ($createTemplates as $template) { + $string .= $template->toXml(); + } + $string .= ""; + } + } + } while (false); + + // make it into a proper XML document with header etc + $xml = simplexml_load_string($string); + + // output correctly formatted XML + return $xml->asXML(); + } +} diff --git a/web/services/createTemplatesService.php b/web/services/createTemplatesService.php index cfd418c1e..455eb0e69 100644 --- a/web/services/createTemplatesService.php +++ b/web/services/createTemplatesService.php @@ -17,220 +17,17 @@ * You should have received a copy of the GNU General Public License * along with PhpReport. If not, see . */ +if (!defined('PHPREPORT_ROOT')) define('PHPREPORT_ROOT', __DIR__ . '/../../'); -define('PHPREPORT_ROOT', __DIR__ . '/../../'); -include_once(PHPREPORT_ROOT . '/web/services/WebServicesFunctions.php'); -include_once(PHPREPORT_ROOT . '/model/facade/TemplatesFacade.php'); -include_once(PHPREPORT_ROOT . '/model/vo/TemplateVO.php'); +require PHPREPORT_ROOT . "vendor/autoload.php"; -$parser = new XMLReader(); +use Phpreport\Web\services\TemplateService as TemplateService; $request = trim(file_get_contents('php://input')); -/*$request = ''; -*/ -$parser->XML($request); -$sid = NULL; - -do { - - $parser->read(); - - if ($parser->name == 'templates') - { - - $sid = $parser->getAttribute("sid"); - - $parser->read(); - - } - - /* We check authentication and authorization */ - require_once(PHPREPORT_ROOT . '/util/LoginManager.php'); - - $user = LoginManager::isLogged($sid); - - if (!$user) - { - $string = "falseYou must be logged in"; - break; - } - - if (!LoginManager::isAllowed($sid)) - { - $string = "falseForbidden service for this User"; - break; - } - - $createTemplates = array(); - - do { - if ($parser->name == "template") { - $templatesVO = new TemplateVO(); - - $templatesVO->setTelework(false); - $templatesVO->setOnsite(false); - $templatesVO->setUserId($user->getId()); - - $parser->read(); - - while ($parser->name != "template") { - - switch ($parser->name) { - case "story": - $parser->read(); - if ($parser->hasValue) - { - $templatesVO->setStory(unescape_string($parser->value)); - $parser->next(); - $parser->next(); - } - break; - - case "telework": - $parser->read(); - if ($parser->hasValue) - { - if (strtolower($parser->value) == "true") - $templatesVO->setTelework(true); - $parser->next(); - $parser->next(); - } - break; - - case "onsite": - $parser->read(); - if ($parser->hasValue) - { - if (strtolower($parser->value) == "true") - $templatesVO->setOnsite(true); - $parser->next(); - $parser->next(); - } - break; - - case "ttype": - $parser->read(); - if ($parser->hasValue) - { - $templatesVO->setTtype(unescape_string($parser->value)); - $parser->next(); - $parser->next(); - } - break; - - case "text": - $parser->read(); - if ($parser->hasValue) - { - $templatesVO->setText(unescape_string($parser->value)); - $parser->next(); - $parser->next(); - } - break; - - case "name": - $parser->read(); - if ($parser->hasValue) - { - $templatesVO->setName(substr(unescape_string($parser->value), 0, 75)); - $parser->next(); - $parser->next(); - } - break; - - case "taskStoryId": - $parser->read(); - if ($parser->hasValue) - { - $templatesVO->setTaskStoryId($parser->value); - $parser->next(); - $parser->next(); - } - break; - - case "projectId": - $parser->read(); - if ($parser->hasValue) - { - $templatesVO->setProjectId($parser->value); - $parser->next(); - $parser->next(); - } - break; - - case "initTime": - $initTimeFormat = $parser->getAttribute("format"); - if (is_null($initTimeFormat)) - $initTimeFormat = "H:i"; - $parser->read(); - if ($parser->hasValue) - { - $initTimeRaw = $parser->value; - $initTimeParse = date_parse_from_format($initTimeFormat, $initTimeRaw); - $initTime = $initTimeParse['hour']*60 + $initTimeParse['minute']; - $templatesVO->setInitTime($initTime); - $templatesVO->setInitTimeRaw($initTimeRaw); - $parser->next(); - $parser->next(); - } - else { - $templatesVO->setInitTime(NULL); - } - break; - - case "endTime": - $endTimeFormat = $parser->getAttribute("format"); - if (is_null($endTimeFormat)) - $endTimeFormat = "H:i"; - $parser->read(); - if ($parser->hasValue) - { - $endTimeRaw = $parser->value; - $endTimeParse = date_parse_from_format($endTimeFormat, $endTimeRaw); - if (($endTimeParse['hour']==0) && ($endTimeParse['minute']==0)) $endTimeParse['hour'] = 24; - $endTime = $endTimeParse['hour']*60 + $endTimeParse['minute']; - $templatesVO->setEndTime($endTime); - $templatesVO->setEndTimeRaw($endTimeRaw); - $parser->next(); - $parser->next(); - } - else { - $templatesVO->setEndTime(NULL); - } - break; - default: - $parser->next(); - break; - } - } - $createTemplates[] = $templatesVO; - } - } while ($parser->read()); - - $string = ""; - if (count($createTemplates) >= 1) { - if (TemplatesFacade::CreateTemplates($createTemplates) == -1) - $string = "falseThere was some error while creating the tasks"; - - if (!$string) - { - $string = "trueOperation Success!"; - foreach ($createTemplates as $template) { - $string .= $template->toXml(); - } - $string .= ""; - } - } - -} while (false); - - -// make it into a proper XML document with header etc -$xml = simplexml_load_string($string); +$service = new TemplateService(); // send an XML mime header header("Content-type: text/xml"); -// output correctly formatted XML -echo $xml->asXML(); +echo $service->createTemplate($request); From 864c208b0b547847a88624b88f5e1b335a825a1e Mon Sep 17 00:00:00 2001 From: Ana Rute Mendes Date: Tue, 31 Aug 2021 15:50:09 -0300 Subject: [PATCH 4/7] Split template creation Add parseTemplates that is a pure function that receives a XMLReader and returns an array of TemplateVO with the parsed values from the XML. --- web/services/TemplateService.php | 270 ++++++++++++++++--------------- 1 file changed, 138 insertions(+), 132 deletions(-) diff --git a/web/services/TemplateService.php b/web/services/TemplateService.php index 6e8a0974c..32834b5dd 100644 --- a/web/services/TemplateService.php +++ b/web/services/TemplateService.php @@ -29,6 +29,143 @@ class TemplateService { + public function parseTemplates(\XMLReader $parser, string $userId): array + { + $createTemplates = []; + do { + if ($parser->name == "template") { + $templatesVO = new \TemplateVO(); + + $templatesVO->setTelework(false); + $templatesVO->setOnsite(false); + $templatesVO->setUserId($userId); + + $parser->read(); + + while ($parser->name != "template") { + + switch ($parser->name) { + case "story": + $parser->read(); + if ($parser->hasValue) { + $templatesVO->setStory(unescape_string($parser->value)); + $parser->next(); + $parser->next(); + } + break; + + case "telework": + $parser->read(); + if ($parser->hasValue) { + if (strtolower($parser->value) == "true") + $templatesVO->setTelework(true); + $parser->next(); + $parser->next(); + } + break; + + case "onsite": + $parser->read(); + if ($parser->hasValue) { + if (strtolower($parser->value) == "true") + $templatesVO->setOnsite(true); + $parser->next(); + $parser->next(); + } + break; + + case "ttype": + $parser->read(); + if ($parser->hasValue) { + $templatesVO->setTtype(unescape_string($parser->value)); + $parser->next(); + $parser->next(); + } + break; + + case "text": + $parser->read(); + if ($parser->hasValue) { + $templatesVO->setText(unescape_string($parser->value)); + $parser->next(); + $parser->next(); + } + break; + + case "name": + $parser->read(); + if ($parser->hasValue) { + $templatesVO->setName(substr(unescape_string($parser->value), 0, 75)); + $parser->next(); + $parser->next(); + } + break; + + case "taskStoryId": + $parser->read(); + if ($parser->hasValue) { + $templatesVO->setTaskStoryId($parser->value); + $parser->next(); + $parser->next(); + } + break; + + case "projectId": + $parser->read(); + if ($parser->hasValue) { + $templatesVO->setProjectId($parser->value); + $parser->next(); + $parser->next(); + } + break; + + case "initTime": + $initTimeFormat = $parser->getAttribute("format"); + if (is_null($initTimeFormat)) + $initTimeFormat = "H:i"; + $parser->read(); + if ($parser->hasValue) { + $initTimeRaw = $parser->value; + $initTimeParse = date_parse_from_format($initTimeFormat, $initTimeRaw); + $initTime = $initTimeParse['hour'] * 60 + $initTimeParse['minute']; + $templatesVO->setInitTime($initTime); + $templatesVO->setInitTimeRaw($initTimeRaw); + $parser->next(); + $parser->next(); + } else { + $templatesVO->setInitTime(NULL); + } + break; + + case "endTime": + $endTimeFormat = $parser->getAttribute("format"); + if (is_null($endTimeFormat)) + $endTimeFormat = "H:i"; + $parser->read(); + if ($parser->hasValue) { + $endTimeRaw = $parser->value; + $endTimeParse = date_parse_from_format($endTimeFormat, $endTimeRaw); + if (($endTimeParse['hour'] == 0) && ($endTimeParse['minute'] == 0)) $endTimeParse['hour'] = 24; + $endTime = $endTimeParse['hour'] * 60 + $endTimeParse['minute']; + $templatesVO->setEndTime($endTime); + $templatesVO->setEndTimeRaw($endTimeRaw); + $parser->next(); + $parser->next(); + } else { + $templatesVO->setEndTime(NULL); + } + break; + default: + $parser->next(); + break; + } + } + $createTemplates[] = $templatesVO; + } + } while ($parser->read()); + return $createTemplates; + } + public function createTemplate(string $request): string { $parser = new \XMLReader(); @@ -60,138 +197,7 @@ public function createTemplate(string $request): string break; } - $createTemplates = []; - do { - if ($parser->name == "template") { - $templatesVO = new \TemplateVO(); - - $templatesVO->setTelework(false); - $templatesVO->setOnsite(false); - $templatesVO->setUserId($user->getId()); - - $parser->read(); - - while ($parser->name != "template") { - - switch ($parser->name) { - case "story": - $parser->read(); - if ($parser->hasValue) { - $templatesVO->setStory(unescape_string($parser->value)); - $parser->next(); - $parser->next(); - } - break; - - case "telework": - $parser->read(); - if ($parser->hasValue) { - if (strtolower($parser->value) == "true") - $templatesVO->setTelework(true); - $parser->next(); - $parser->next(); - } - break; - - case "onsite": - $parser->read(); - if ($parser->hasValue) { - if (strtolower($parser->value) == "true") - $templatesVO->setOnsite(true); - $parser->next(); - $parser->next(); - } - break; - - case "ttype": - $parser->read(); - if ($parser->hasValue) { - $templatesVO->setTtype(unescape_string($parser->value)); - $parser->next(); - $parser->next(); - } - break; - - case "text": - $parser->read(); - if ($parser->hasValue) { - $templatesVO->setText(unescape_string($parser->value)); - $parser->next(); - $parser->next(); - } - break; - - case "name": - $parser->read(); - if ($parser->hasValue) { - $templatesVO->setName(substr(unescape_string($parser->value), 0, 75)); - $parser->next(); - $parser->next(); - } - break; - - case "taskStoryId": - $parser->read(); - if ($parser->hasValue) { - $templatesVO->setTaskStoryId($parser->value); - $parser->next(); - $parser->next(); - } - break; - - case "projectId": - $parser->read(); - if ($parser->hasValue) { - $templatesVO->setProjectId($parser->value); - $parser->next(); - $parser->next(); - } - break; - - case "initTime": - $initTimeFormat = $parser->getAttribute("format"); - if (is_null($initTimeFormat)) - $initTimeFormat = "H:i"; - $parser->read(); - if ($parser->hasValue) { - $initTimeRaw = $parser->value; - $initTimeParse = date_parse_from_format($initTimeFormat, $initTimeRaw); - $initTime = $initTimeParse['hour'] * 60 + $initTimeParse['minute']; - $templatesVO->setInitTime($initTime); - $templatesVO->setInitTimeRaw($initTimeRaw); - $parser->next(); - $parser->next(); - } else { - $templatesVO->setInitTime(NULL); - } - break; - - case "endTime": - $endTimeFormat = $parser->getAttribute("format"); - if (is_null($endTimeFormat)) - $endTimeFormat = "H:i"; - $parser->read(); - if ($parser->hasValue) { - $endTimeRaw = $parser->value; - $endTimeParse = date_parse_from_format($endTimeFormat, $endTimeRaw); - if (($endTimeParse['hour'] == 0) && ($endTimeParse['minute'] == 0)) $endTimeParse['hour'] = 24; - $endTime = $endTimeParse['hour'] * 60 + $endTimeParse['minute']; - $templatesVO->setEndTime($endTime); - $templatesVO->setEndTimeRaw($endTimeRaw); - $parser->next(); - $parser->next(); - } else { - $templatesVO->setEndTime(NULL); - } - break; - default: - $parser->next(); - break; - } - } - $createTemplates[] = $templatesVO; - } - } while ($parser->read()); + $createTemplates = $this->parseTemplates($parser, $user->getId()); $string = ""; if (count($createTemplates) >= 1) { From 61077057738479b1e54def1f8dfe9dce3780b860 Mon Sep 17 00:00:00 2001 From: Ana Rute Mendes Date: Tue, 31 Aug 2021 15:59:37 -0300 Subject: [PATCH 5/7] Pass LoginManager as a parameter instead of instanciating it Use depedency injection to decouple TemplateService from LoginManager. This will make TemplateService more isolated and easier to test, since with this change we are able to mock LoginManager instead of instanciating it. --- web/services/TemplateService.php | 13 ++++++++++--- web/services/createTemplatesService.php | 5 +++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/web/services/TemplateService.php b/web/services/TemplateService.php index 32834b5dd..b84c3cee6 100644 --- a/web/services/TemplateService.php +++ b/web/services/TemplateService.php @@ -25,10 +25,17 @@ include_once(PHPREPORT_ROOT . '/web/services/WebServicesFunctions.php'); include_once(PHPREPORT_ROOT . '/model/facade/TemplatesFacade.php'); include_once(PHPREPORT_ROOT . '/model/vo/TemplateVO.php'); -require_once(PHPREPORT_ROOT . '/util/LoginManager.php'); class TemplateService { + private \LoginManager $loginManager; + + public function __construct( + \LoginManager $loginManager + ) { + $this->loginManager = $loginManager; + } + public function parseTemplates(\XMLReader $parser, string $userId): array { $createTemplates = []; @@ -185,14 +192,14 @@ public function createTemplate(string $request): string } /* We check authentication and authorization */ - $user = \LoginManager::isLogged($sid); + $user = $this->loginManager::isLogged($sid); if (!$user) { $string = "falseYou must be logged in"; break; } - if (!\LoginManager::isAllowed($sid)) { + if (!$this->loginManager::isAllowed($sid)) { $string = "falseForbidden service for this User"; break; } diff --git a/web/services/createTemplatesService.php b/web/services/createTemplatesService.php index 455eb0e69..55370d38f 100644 --- a/web/services/createTemplatesService.php +++ b/web/services/createTemplatesService.php @@ -20,12 +20,13 @@ if (!defined('PHPREPORT_ROOT')) define('PHPREPORT_ROOT', __DIR__ . '/../../'); require PHPREPORT_ROOT . "vendor/autoload.php"; +require_once(PHPREPORT_ROOT . '/util/LoginManager.php'); use Phpreport\Web\services\TemplateService as TemplateService; $request = trim(file_get_contents('php://input')); - -$service = new TemplateService(); +$loginManager = new \LoginManager(); +$service = new TemplateService($loginManager); // send an XML mime header header("Content-type: text/xml"); From e40028df628f9ef11b169406dec43f5c8abcb78f Mon Sep 17 00:00:00 2001 From: Ana Rute Mendes Date: Tue, 31 Aug 2021 16:12:48 -0300 Subject: [PATCH 6/7] Add tests for TemplateService Add initial set of tests for the TemplateService: one for testing the parserTemplates method and another to check if user can't create a template if there's no active section --- tests/web/services/TemplateServiceTest.php | 107 +++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 tests/web/services/TemplateServiceTest.php diff --git a/tests/web/services/TemplateServiceTest.php b/tests/web/services/TemplateServiceTest.php new file mode 100644 index 000000000..cf653ff78 --- /dev/null +++ b/tests/web/services/TemplateServiceTest.php @@ -0,0 +1,107 @@ +setId($sid); + return $userVO; + } + return NULL; + } + + public static function isAllowed($sid = NULL) + { + return true; + } +} + +class TemplateServiceTest extends TestCase +{ + private \LoginManager $loginManagerMock; + + public function setUp(): void + { + $this->loginManagerMock = new LoginManagerMock(); + $this->instance = new TemplateService( + $this->loginManagerMock + ); + } + + public function testCannotCreateATemplateIfLoggedOut(): void + { + $request = '' + . '' + . '' + . ''; + + $this->assertEquals( + "\nfalseYou must be logged in\n", + $this->instance->createTemplate($request) + ); + } + + public function testCanParseRequestWithCorrectPayload(): void + { + $request = '' + . '' + . '' + . ''; + + $parser = new \XMLReader(); + $parser->XML($request); + + $expectedTemplate = new \TemplateVO(); + $expectedTemplate->setStory('piedpiper'); + $expectedTemplate->setTelework(true); + $expectedTemplate->setOnsite(false); + $expectedTemplate->setUserId('456'); + $expectedTemplate->setTaskStoryId('3'); + $expectedTemplate->setTtype('community'); + $expectedTemplate->setName('awesome template'); + $expectedTemplate->setText('fixing this crazy bug'); + $expectedTemplate->setProjectId('1'); + $expectedTemplate->setInitTime(165); + $expectedTemplate->setInitTimeRaw('02:45'); + $expectedTemplate->setEndTime(795); + $expectedTemplate->setEndTimeRaw('13:15'); + + $this->assertEquals( + [$expectedTemplate], + $this->instance->parseTemplates($parser, $userId = '456') + ); + } +} From 21fd68dcbe943d6421c12eeebc74528feba881d4 Mon Sep 17 00:00:00 2001 From: Ana Rute Mendes Date: Tue, 31 Aug 2021 16:19:12 -0300 Subject: [PATCH 7/7] Add automated tests instructions --- docs/developer/devel-setup.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/developer/devel-setup.rst b/docs/developer/devel-setup.rst index fc1bb8028..887af4481 100644 --- a/docs/developer/devel-setup.rst +++ b/docs/developer/devel-setup.rst @@ -62,3 +62,14 @@ password ``admin`` to try a user with full privileges, or ``user`` with password ``user`` to try a login with restricted permissions. You will also be able to create users with any permission level once you are logged in as ``admin``. + +Step 6: Running automated tests +=========================== + +Make sure you have composer and the projects dependencies installed. +To install the dependencies run ``composer install`` in the project +root directory. + +All the automated tests should be placed inside the `tests` +From the project root, run `./vendor/bin/phpunit --testdox tests` +to execute the automated tests.