コード例 #1
0
ファイル: DailyLayout.php プロジェクト: hugutux/booked
 public function GetLayout(Date $date, $resourceId)
 {
     try {
         $hideBlocked = Configuration::Instance()->GetSectionKey(ConfigSection::SCHEDULE, ConfigKeys::SCHEDULE_HIDE_BLOCKED_PERIODS, new BooleanConverter());
         $sw = new StopWatch();
         $sw->Start();
         $items = $this->_reservationListing->OnDateForResource($date, $resourceId);
         $sw->Record('listing');
         $list = new ScheduleReservationList($items, $this->_scheduleLayout, $date, $hideBlocked);
         $slots = $list->BuildSlots();
         $sw->Record('slots');
         $sw->Stop();
         Log::Debug('DailyLayout::GetLayout - For resourceId %s on date %s, took %s seconds to get reservation listing, %s to build the slots, %s total seconds for %s reservations. Memory consumed=%sMB', $resourceId, $date->ToString(), $sw->GetRecordSeconds('listing'), $sw->TimeBetween('slots', 'listing'), $sw->GetTotalSeconds(), count($items), round(memory_get_usage() / 1048576, 2));
         return $slots;
     } catch (Exception $ex) {
         Log::Error('Error getting layout on date %s for resourceId %s. Exception=%s', $date->ToString(), $resourceId, $ex);
         throw $ex;
     }
 }
コード例 #2
0
ファイル: AttributeService.php プロジェクト: hugutux/booked
 public function GetAttributes($category, $entityIds = array())
 {
     if (!is_array($entityIds) && !empty($entityIds)) {
         $entityIds = array($entityIds);
     }
     $attributeList = new AttributeList();
     $attributes = $this->attributeRepository->GetByCategory($category);
     $stopwatch = new StopWatch();
     $stopwatch->Start();
     $values = $this->attributeRepository->GetEntityValues($category, $entityIds);
     foreach ($attributes as $attribute) {
         $attributeList->AddDefinition($attribute);
     }
     foreach ($values as $value) {
         $attributeList->AddValue($value);
     }
     $stopwatch->Stop();
     Log::Debug('Took %d seconds to load custom attributes for category %s', $stopwatch->GetTotalSeconds(), $category);
     return $attributeList;
 }
コード例 #3
0
ファイル: runone.php プロジェクト: utn-frm-si/booked
require_once ROOT_DIR . 'tests/fakes/namespace.php';
require_once ROOT_DIR . 'tests/TestBase.php';
$tests = array('Domain/Reservation/ReservationViewRepositoryTests.php', 'Domain/Reservation/AdminEmailNotificationTests.php', 'Domain/Reservation/OwnerEmailNotificationTests.php', 'Domain/Reservation/ReservationDateTimeRuleTests.php', 'Domain/PermissionValidationRuleTests.php', 'Domain/ResourceAvailabilityRuleTests.php', 'Domain/AddReservationValidationServiceTests.php', 'PresenterTests/EditReservationPresenterTests.php', 'PresenterTests/ReservationSavePresenterTests.php', 'Domain/RepeatOptionsTests.php', 'Domain/ReservationTests.php', 'Domain/UserRepositoryTests.php', 'Domain/ReservationRepositoryTests.php', 'PresenterTests/NewReservationPresenterTests.php', 'PresenterTests/ReservationInitializationTests.php', 'PresenterTests/NewReservationPreconditionServiceTests.php', 'ScheduleUserRepositoryTests.php', 'ResourcePermissionStoreTests.php', 'PermissionServiceTests.php', 'DateTests.php', 'ReservationListingTests.php', 'ScheduleLayoutTests.php', 'DailyLayoutTests.php', 'SchedulePresenterTests.php', 'ReservationServiceTests.php', 'ScheduleReservationListTests.php', 'ResourceRepositoryTestsitoryTests.php', 'SchedulesTests.php', 'AnnouncementRepositoryTeststoryTests.php', 'AnnouncementPresenterTests.php', 'PluginManagerTests.php', 'ConfigTests.php', 'ActiveDirectoryTests.php', 'RegisterPresenterTests.php', 'ValidatorTests.php', 'PasswordMigrationTests.php', 'ResourcesTests.php', 'LoginPresenterTests.php', 'DatabaseTests.php', 'DatabaseCommandTests.php', 'AuthorizationTests.php', 'PasswordEncryptionTests.php', 'RegistrationTests.php', 'SmartyControlTests.php');
/*
$tests = array(
'SchedulePresenterTests.php',
'ResourceRepositoryTests.phpyTests.php',
'DateTests.php',
'ScheduleReservationListTests.php');
*/
$passed = true;
$totalRun = 0;
$totalPassed = 0;
$totalFailed = 0;
$totalTimer = new StopWatch();
$totalTimer->Start();
$suite = new PHPUnit_Framework_TestSuite('PHPUnit Framework');
for ($i = 0; $i < count($tests); $i++) {
    require_once $tests[$i];
    $fileWithDir = explode('/', $tests[$i]);
    $fileName = $tests[$i];
    if (count($fileWithDir) > 1) {
        $fileName = $fileWithDir[count($fileWithDir) - 1];
    }
    $name_parts = explode('.', $fileName);
    $name = $name_parts[0];
    //$suite->addTestFile($tests[$i]);
    $suite->addTestSuite($name);
}
PHPUnit_TextUI_TestRunner::run($suite);
$totalTimer->Stop();
コード例 #4
0
ファイル: load_test.php プロジェクト: utn-frm-si/booked
(at your option) any later version.

Booked Scheduler 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 Booked Scheduler.  If not, see <http://www.gnu.org/licenses/>.
*/
define('ROOT_DIR', dirname(__FILE__) . '/../');
require_once ROOT_DIR . 'lib/Application/Reservation/namespace.php';
require_once ROOT_DIR . 'lib/Common/Helpers/namespace.php';
echo "<h1>Booked Scheduler Data Load</h1>";
$stopWatch = new StopWatch();
$stopWatch->Start();
$numberOfResources = 10;
$numberOfUsers = 1000;
$numberOfReservations = 5000;
$numberOfAccessories = 20;
$users = array();
$resources = array();
$db = ServiceLocator::GetDatabase();
// USERS
$db->Execute(new AdHocCommand("delete from users where fname ='load' and lname = 'test'"));
$userRepo = new UserRepository();
for ($i = 0; $i < $numberOfUsers; $i++) {
    $user = User::Create("load{$i}", "test{$i}", "email {$i}", "username {$i}", "en_us", "America/Chicago", "7b6aec38ff9b7650d64d0374194307bdde711425", "3b3dbb9b");
    $userId = $userRepo->Add($user);
    $users[] = $user;
}
コード例 #5
0
ファイル: StopWatch.php プロジェクト: Trideon/gigolo
 /**
  * @return StopWatch
  */
 public static function StartNew()
 {
     $sw = new StopWatch();
     $sw->Start();
     return $sw;
 }
コード例 #6
0
            unset($process[$key][$k]);
            if (is_array($v)) {
                $process[$key][stripslashes($k)] = $v;
                $process[] =& $process[$key][stripslashes($k)];
            } else {
                $process[$key][stripslashes($k)] = stripslashes($v);
            }
        }
    }
    unset($process);
}
// Error reporting
error_reporting(E_ALL ^ E_NOTICE);
define("FAKE", 1);
include "_cms/includes/global.php";
StopWatch::Start();
ObjMgr::Initialize();
$pageid = isset($_GET['page']) ? $_GET['page'] : Content::GetDefaultPageId();
if (isset($_GET['logout']) && ObjMgr::GetAccount()->m_loggedin) {
    ObjMgr::GetAccount()->Logout();
}
if (isset($_GET['locale'])) {
    Locales::SetUserLocale($_GET['locale']);
}
if (ObjMgr::GetAccount()->m_loggedin) {
    if (isset($_POST['action'])) {
        Compiler::$Mode = COMPILER_MODE_EDITOR;
        // Plugin Hook
        $data_object = new stdClass();
        $data_object->post = $_POST;
        ObjMgr::GetPluginMgr()->ExecuteHook("On_PostAction_" . $_POST['action'], $data_object);