• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP models\UserAccountModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中models\UserAccountModel的典型用法代码示例。如果您正苦于以下问题:PHP UserAccountModel类的具体用法?PHP UserAccountModel怎么用?PHP UserAccountModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了UserAccountModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: setFeature

 public function setFeature(SiteModel $site, \BaseSiteFeature $siteFeature, $value, UserAccountModel $userAccountModel = null)
 {
     try {
         $this->app['db']->beginTransaction();
         $changeMade = false;
         $stat = $this->app['db']->prepare("SELECT is_on FROM site_feature_information WHERE site_id=:site_id AND extension_id =:extension_id AND feature_id =:feature_id");
         $stat->execute(array('site_id' => $site->getId(), 'extension_id' => $siteFeature->getExtensionId(), 'feature_id' => $siteFeature->getFeatureId()));
         if ($stat->rowCount() == 1) {
             $data = $stat->fetch();
             if ($data['is_on'] != $value) {
                 $stat = $this->app['db']->prepare("UPDATE site_feature_information SET  is_on=:is_on " . " WHERE site_id=:site_id AND extension_id =:extension_id AND feature_id =:feature_id ");
                 $stat->execute(array('site_id' => $site->getId(), 'extension_id' => $siteFeature->getExtensionId(), 'feature_id' => $siteFeature->getFeatureId(), 'is_on' => $value ? 1 : 0));
                 $changeMade = true;
             }
         } else {
             $stat = $this->app['db']->prepare("INSERT INTO site_feature_information (site_id, extension_id, feature_id, is_on) " . " VALUES(:site_id, :extension_id, :feature_id, :is_on) ");
             $stat->execute(array('site_id' => $site->getId(), 'extension_id' => $siteFeature->getExtensionId(), 'feature_id' => $siteFeature->getFeatureId(), 'is_on' => $value ? 1 : 0));
             $changeMade = true;
         }
         if ($changeMade) {
             $stat = $this->app['db']->prepare("INSERT INTO site_feature_history (site_id, extension_id, feature_id, is_on, user_account_id, created_at) " . " VALUES (:site_id, :extension_id, :feature_id, :is_on, :user_account_id, :created_at)");
             $stat->execute(array('site_id' => $site->getId(), 'extension_id' => $siteFeature->getExtensionId(), 'feature_id' => $siteFeature->getFeatureId(), 'is_on' => $value ? 1 : 0, 'user_account_id' => $userAccountModel ? $userAccountModel->getId() : null, 'created_at' => \TimeSource::getFormattedForDataBase()));
         }
         $this->app['db']->commit();
     } catch (Exception $e) {
         $this->app['db']->rollBack();
     }
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:28,代码来源:SiteFeatureRepository.php


示例2: testUserIsUserGroup

 function testUserIsUserGroup()
 {
     $user = new UserAccountModel();
     $user->setEmail("[email protected]");
     $user->setUsername("test");
     $user->setPassword("password");
     $userTest = new UserAccountModel();
     $userTest->setEmail("[email protected]");
     $userTest->setUsername("testtest");
     $userTest->setPassword("password");
     $userRepo = new UserAccountRepository();
     $userRepo->create($user);
     $userRepo->create($userTest);
     $site = new SiteModel();
     $site->setTitle("Test");
     $site->setSlug("test");
     $siteRepo = new SiteRepository();
     $siteRepo->create($site, $user, array(), $this->getSiteQuotaUsedForTesting());
     $usrb = new \repositories\builders\UserGroupRepositoryBuilder();
     $usrb->setSite($site);
     $userGroups = $usrb->fetchAll();
     $this->assertTrue(count($userGroups) > 0);
     $userGroup = $userGroups[0];
     $uiugr = new \repositories\UserGroupRepository();
     $uiugr->addUserToGroup($userTest, $userGroup);
     // Test user in user group has it
     $srb = new \repositories\builders\SiteRepositoryBuilder();
     $srb->setUserInterestedIn($userTest);
     $sites = $srb->fetchAll();
     $this->assertEquals(1, count($sites));
 }
开发者ID:schlos,项目名称:MeetYourNextMP-Web-Core,代码行数:31,代码来源:SiteRepositoryBuilderUserInterestedInTest.php


示例3: UserAccountModel

 function test1()
 {
     $this->addCountriesToTestDB();
     $user = new UserAccountModel();
     $user->setEmail("[email protected]");
     $user->setUsername("test");
     $user->setPassword("password");
     $userRepo = new UserAccountRepository();
     $userRepo->create($user);
     $site = new SiteModel();
     $site->setTitle("Test");
     $site->setSlug("test");
     $siteRepo = new SiteRepository();
     $siteRepo->create($site, $user, array(), $this->getSiteQuotaUsedForTesting());
     $countryRepo = new CountryRepository();
     $gb = $countryRepo->loadByTwoCharCode('GB');
     $venue = new VenueModel();
     $venue->setTitle("test");
     $venue->setDescription("test test");
     $venue->setCountryId($gb->getId());
     $venueRepo = new VenueRepository();
     $venueRepo->create($venue, $site, $user);
     $this->checkVenueInTest1($venueRepo->loadById($venue->getId()));
     $this->checkVenueInTest1($venueRepo->loadBySlug($site, $venue->getSlug()));
     $grb = new VenueRepositoryBuilder();
     $grb->setFreeTextsearch('test');
     $this->assertEquals(1, count($grb->fetchAll()));
     $grb = new VenueRepositoryBuilder();
     $grb->setFreeTextsearch('cats');
     $this->assertEquals(0, count($grb->fetchAll()));
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:31,代码来源:VenueCreateTest.php


示例4: UserAccountModel

 function testIntegration1()
 {
     $this->addCountriesToTestDB();
     \TimeSource::mock(2014, 1, 1, 12, 0, 0);
     $user = new UserAccountModel();
     $user->setEmail("[email protected]");
     $user->setUsername("test");
     $user->setPassword("password");
     $userRepo = new UserAccountRepository();
     $userRepo->create($user);
     $site = new SiteModel();
     $site->setTitle("Test");
     $site->setSlug("test");
     $siteRepo = new SiteRepository();
     $siteRepo->create($site, $user, array(), $this->getSiteQuotaUsedForTesting());
     $countryRepo = new CountryRepository();
     $gb = $countryRepo->loadByTwoCharCode('GB');
     ## Create area
     \TimeSource::mock(2014, 1, 1, 13, 0, 0);
     $area = new AreaModel();
     $area->setTitle("test");
     $area->setDescription("test test");
     $area->setCountryId($gb->getId());
     $areaRepo = new AreaRepository();
     $areaRepo->create($area, null, $site, $gb, $user);
     ## Edit area
     \TimeSource::mock(2014, 1, 1, 14, 0, 0);
     $area = $areaRepo->loadById($area->getId());
     $area->setDescription("testy");
     $areaRepo->edit($area, $user);
     ## Now save changed flags on these .....
     $areaHistoryRepo = new AreaHistoryRepository();
     $stat = $this->app['db']->prepare("SELECT * FROM area_history");
     $stat->execute();
     while ($data = $stat->fetch()) {
         $areaHistory = new AreaHistoryModel();
         $areaHistory->setFromDataBaseRow($data);
         $areaHistoryRepo->ensureChangedFlagsAreSet($areaHistory);
     }
     ## Now load and check
     $historyRepo = new HistoryRepositoryBuilder();
     $historyRepo->setIncludeEventHistory(false);
     $historyRepo->setIncludeVenueHistory(false);
     $historyRepo->setIncludeGroupHistory(false);
     $historyRepo->setIncludeAreaHistory(true);
     $histories = $historyRepo->fetchAll();
     $this->assertEquals(2, count($histories));
     #the edit
     $this->assertEquals(FALSE, $histories[0]->getTitleChanged());
     $this->assertEquals(true, $histories[0]->getDescriptionChanged());
     $this->assertEquals(false, $histories[0]->getCountryIdChanged());
     $this->assertEquals(false, $histories[0]->getParentAreaIdChanged());
     $this->assertEquals(false, $histories[0]->getIsDeletedChanged());
     #the create
     $this->assertEquals(true, $histories[1]->getTitleChanged());
     $this->assertEquals(true, $histories[1]->getDescriptionChanged());
     $this->assertEquals(true, $histories[1]->getCountryIdChanged());
     $this->assertEquals(false, $histories[1]->getParentAreaIdChanged());
     $this->assertEquals(false, $histories[1]->getIsDeletedChanged());
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:60,代码来源:AreaHistoryWithDBTest.php


示例5: UserAccountModel

 function test1()
 {
     $user = new UserAccountModel();
     $user->setEmail("[email protected]");
     $user->setUsername("test");
     $user->setPassword("password");
     $userRepo = new UserAccountRepository();
     $userRepo->create($user);
     $site = new SiteModel();
     $site->setTitle("Test");
     $site->setSlug("test");
     $siteRepo = new SiteRepository();
     $siteRepo->create($site, $user, array(), $this->getSiteQuotaUsedForTesting());
     $group = new GroupModel();
     $group->setTitle("test");
     $group->setDescription("test test");
     $group->setUrl("http://www.group.com");
     $groupRepo = new GroupRepository();
     $groupRepo->create($group, $site, $user);
     $this->checkGroupInTest1($groupRepo->loadById($group->getId()));
     $this->checkGroupInTest1($groupRepo->loadBySlug($site, $group->getSlug()));
     $grb = new GroupRepositoryBuilder();
     $grb->setFreeTextsearch('test');
     $this->assertEquals(1, count($grb->fetchAll()));
     $grb = new GroupRepositoryBuilder();
     $grb->setFreeTextsearch('cats');
     $this->assertEquals(0, count($grb->fetchAll()));
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:28,代码来源:GroupCreateTest.php


示例6: UserAccountModel

 function test1()
 {
     TimeSource::mock(2014, 5, 1, 7, 0, 0);
     $user = new UserAccountModel();
     $user->setEmail("[email protected]");
     $user->setUsername("test");
     $user->setPassword("password");
     $userRepo = new UserAccountRepository();
     $userRepo->create($user);
     $site = new SiteModel();
     $site->setTitle("Test");
     $site->setSlug("test");
     $siteRepo = new SiteRepository();
     $siteRepo->create($site, $user, array(), $this->getSiteQuotaUsedForTesting());
     $group = new GroupModel();
     $group->setTitle("test");
     $group->setDescription("test test");
     $group->setUrl("http://www.group.com");
     $groupRepo = new GroupRepository();
     $groupRepo->create($group, $site, $user);
     $event = new EventModel();
     $event->setSummary("test");
     $event->setDescription("test test");
     $event->setStartAt(getUTCDateTime(2014, 5, 10, 19, 0, 0));
     $event->setEndAt(getUTCDateTime(2014, 5, 10, 21, 0, 0));
     $event->setUrl("http://www.info.com");
     $event->setTicketUrl("http://www.tickets.com");
     $eventDupe = new EventModel();
     $eventDupe->setSummary("test");
     $eventDupe->setStartAt(getUTCDateTime(2014, 5, 10, 19, 0, 0));
     $eventDupe->setEndAt(getUTCDateTime(2014, 5, 10, 21, 0, 0));
     $eventRepository = new EventRepository();
     $eventRepository->create($event, $site, $user, $group);
     $eventRepository->create($eventDupe, $site, $user, $group);
     TimeSource::mock(2014, 5, 1, 7, 1, 0);
     $eventRepository->markDuplicate($eventDupe, $event);
     $userAtEvent = new \models\UserAtEventModel();
     $userAtEvent->setEventId($event->getId());
     $userAtEvent->setUserAccountId($user->getId());
     $userAtEvent->setIsPlanAttending(true);
     $userAtEventRepo = new \repositories\UserAtEventRepository();
     $userAtEventRepo->create($userAtEvent);
     $curatedList = new CuratedListModel();
     $curatedList->setTitle("test");
     $curatedList->setDescription("test this!");
     $clRepo = new CuratedListRepository();
     $clRepo->create($curatedList, $site, $user);
     $clRepo->addEventtoCuratedList($event, $curatedList, $user);
     $tag = new TagModel();
     $tag->setTitle("Test");
     $tagRepo = new TagRepository();
     $tagRepo->create($tag, $site, $user);
     $tagRepo->addTagToEvent($tag, $event, $user);
     ## TEST
     $this->assertNotNull($eventRepository->loadBySlug($site, $event->getSlug()));
     ## PURGE!
     $eventRepository->purge($event);
     ## TEST
     $this->assertNull($eventRepository->loadBySlug($site, $event->getSlug()));
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:60,代码来源:EventPurgeTest.php


示例7: isUserInSite

 public function isUserInSite(UserAccountModel $userAccountModel, SiteModel $siteModel)
 {
     global $DB;
     $stat = $DB->prepare("SELECT * FROM user_has_no_editor_permissions_in_site WHERE site_id=:site_id AND user_account_id=:user_account_id AND removed_at IS NULL");
     $stat->execute(array("site_id" => $siteModel->getId(), "user_account_id" => $userAccountModel->getId()));
     return $stat->rowCount() > 0;
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:7,代码来源:UserHasNoEditorPermissionsInSiteRepository.php


示例8: userLogIn

function userLogIn(UserAccountModel $user)
{
    global $WEBSESSION;
    if (!$user->getIsClosedBySysAdmin()) {
        $WEBSESSION->set('userID', $user->getId());
    }
}
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:7,代码来源:autoloadWebApp.php


示例9: UserAccountModel

 function test1()
 {
     \TimeSource::mock(2014, 1, 1, 0, 0, 0);
     $this->addCountriesToTestDB();
     $user = new UserAccountModel();
     $user->setEmail("[email protected]");
     $user->setUsername("test");
     $user->setPassword("password");
     $userRepo = new UserAccountRepository();
     $userRepo->create($user);
     $site = new SiteModel();
     $site->setTitle("Test");
     $site->setSlug("test");
     $siteRepo = new SiteRepository();
     $siteRepo->create($site, $user, array(), $this->getSiteQuotaUsedForTesting());
     $countryRepo = new CountryRepository();
     $gb = $countryRepo->loadByTwoCharCode('GB');
     $venue = new VenueModel();
     $venue->setTitle("test");
     $venue->setDescription("test test");
     $venue->setCountryId($gb->getId());
     \TimeSource::mock(2014, 1, 1, 1, 0, 0);
     $venueRepo = new VenueRepository();
     $venueRepo->create($venue, $site, $user);
     \TimeSource::mock(2014, 1, 1, 2, 0, 0);
     $venueRepo->delete($venue, $user);
     $this->checkVenueInTest1($venueRepo->loadById($venue->getId()));
     $this->checkVenueInTest1($venueRepo->loadBySlug($site, $venue->getSlug()));
     $vrb = new VenueRepositoryBuilder();
     $vrb->setIncludeDeleted(true);
     $this->assertEquals(1, count($vrb->fetchAll()));
     $vrb = new VenueRepositoryBuilder();
     $vrb->setIncludeDeleted(false);
     $this->assertEquals(0, count($vrb->fetchAll()));
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:35,代码来源:VenueDeleteTest.php


示例10: UserAccountModel

 function test2()
 {
     $user = new UserAccountModel();
     $user->setEmail("[email protected]");
     $user->setUsername("test");
     $user->setPassword("password");
     $userRepo = new UserAccountRepository();
     $userRepo->create($user);
     $userAccountResetRepository = new UserAccountResetRepository();
     # Test1: recently unused is null
     TimeSource::mock(2013, 1, 1, 1, 0, 1);
     $x = $userAccountResetRepository->loadRecentlyUnusedSentForUserAccountId($user->getId(), 180);
     $this->assertNull($x);
     # Test2: Request one
     TimeSource::mock(2013, 1, 1, 1, 0, 2);
     $userAccountReset = $userAccountResetRepository->create($user);
     #Test 3: recently unused has one
     TimeSource::mock(2013, 1, 1, 1, 0, 3);
     $x = $userAccountResetRepository->loadRecentlyUnusedSentForUserAccountId($user->getId(), 180);
     $this->assertTrue($x != null);
     # Test4: days pass. recently unused is null again
     TimeSource::mock(2013, 1, 5, 1, 0, 5);
     $x = $userAccountResetRepository->loadRecentlyUnusedSentForUserAccountId($user->getId(), 180);
     $this->assertNull($x);
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:25,代码来源:UserResetTest.php


示例11: testWinterTime

 function testWinterTime()
 {
     TimeSource::mock(2014, 5, 1, 7, 0, 0);
     $user = new UserAccountModel();
     $user->setEmail("[email protected]");
     $user->setUsername("test");
     $user->setPassword("password");
     $userRepo = new UserAccountRepository();
     $userRepo->create($user);
     $site = new SiteModel();
     $site->setTitle("Test");
     $site->setSlug("test");
     $siteRepo = new SiteRepository();
     $siteRepo->create($site, $user, array(), $this->getSiteQuotaUsedForTesting());
     $event = new EventModel();
     $event->setSummary("test");
     $event->setDescription("test test");
     $event->setStartAt($this->mktime(2014, 11, 10, 19, 0, 0, 'Europe/London'));
     $event->setEndAt($this->mktime(2014, 11, 10, 21, 0, 0, 'Europe/London'));
     $eventRepository = new EventRepository();
     $eventRepository->create($event, $site, $user);
     $event = $eventRepository->loadBySlug($site, $event->getSlug());
     $this->assertEquals("test test", $event->getDescription());
     $this->assertEquals("test", $event->getSummary());
     $startAtShouldBe = $this->mktime(2014, 11, 10, 19, 0, 0, 'UTC');
     $startAtIs = clone $event->getStartAt();
     $startAtIs->setTimezone(new \DateTimeZone('UTC'));
     $this->assertEquals($startAtShouldBe->format("c"), $startAtIs->format("c"));
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:29,代码来源:EventCreateTest.php


示例12: UserAccountModel

 /**
  *
  */
 function test1()
 {
     $feature = new \sitefeatures\EditCommentsFeature();
     $user = new UserAccountModel();
     $user->setEmail("[email protected]");
     $user->setUsername("test");
     $user->setPassword("password");
     $userRepo = new UserAccountRepository();
     $userRepo->create($user);
     $site = new SiteModel();
     $site->setTitle("Test");
     $site->setSlug("test");
     $siteRepo = new SiteRepository();
     $siteRepo->create($site, $user, array(), $this->getSiteQuotaUsedForTesting());
     $siteFeatureRepo = new SiteFeatureRepository($this->app);
     // Test Get Default Option
     $this->app['timesource']->mock(2015, 1, 1, 1, 1, 1);
     $data = $siteFeatureRepo->getForSiteAsTree($site);
     $this->assertEquals(false, $data[$feature->getExtensionId()][$feature->getFeatureId()]->isOn());
     // Test Set True
     $this->app['timesource']->mock(2015, 1, 1, 1, 1, 2);
     $siteFeatureRepo->setFeature($site, $feature, true, $user);
     $data = $siteFeatureRepo->getForSiteAsTree($site);
     $this->assertEquals(true, $data[$feature->getExtensionId()][$feature->getFeatureId()]->isOn());
     // Test Set False
     $this->app['timesource']->mock(2015, 1, 1, 1, 1, 3);
     $siteFeatureRepo->setFeature($site, $feature, false, $user);
     $data = $siteFeatureRepo->getForSiteAsTree($site);
     $this->assertEquals(false, $data[$feature->getExtensionId()][$feature->getFeatureId()]->isOn());
     // Test Set False whilst already false
     $this->app['timesource']->mock(2015, 1, 1, 1, 1, 4);
     $siteFeatureRepo->setFeature($site, $feature, false, $user);
     $data = $siteFeatureRepo->getForSiteAsTree($site);
     $this->assertEquals(false, $data[$feature->getExtensionId()][$feature->getFeatureId()]->isOn());
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:38,代码来源:SiteFeatureRepositoryTest.php


示例13: UserAccountModel

 function test1()
 {
     \TimeSource::mock(2014, 1, 1, 0, 0, 0);
     $user1 = new UserAccountModel();
     $user1->setEmail("[email protected]");
     $user1->setUsername("test");
     $user1->setPassword("password");
     $user2 = new UserAccountModel();
     $user2->setEmail("[email protected]");
     $user2->setUsername("test2");
     $user2->setPassword("password");
     $userRepo = new UserAccountRepository();
     $userRepo->create($user1);
     $userRepo->create($user2);
     $site = new SiteModel();
     $site->setTitle("Test");
     $site->setSlug("test");
     $siteRepo = new SiteRepository();
     $siteRepo->create($site, $user1, array(), $this->getSiteQuotaUsedForTesting());
     $group1 = new GroupModel();
     $group1->setTitle("test1");
     $group1->setDescription("test test");
     $group1->setUrl("http://www.group.com");
     $group2 = new GroupModel();
     $group2->setTitle("test this looks similar");
     $group2->setDescription("test test");
     $group2->setUrl("http://www.group.com");
     $groupRepo = new GroupRepository();
     \TimeSource::mock(2014, 1, 1, 1, 0, 0);
     $groupRepo->create($group1, $site, $user1);
     $groupRepo->create($group2, $site, $user2);
     $event = new EventModel();
     $event->setSummary("test");
     $event->setStartAt(getUTCDateTime(2014, 5, 10, 19, 0, 0));
     $event->setEndAt(getUTCDateTime(2014, 5, 10, 21, 0, 0));
     $eventRepository = new EventRepository();
     $eventRepository->create($event, $site, $user1, $group2);
     $uwgr = new UserWatchesGroupRepository();
     // Test before
     $erb = new \repositories\builders\EventRepositoryBuilder();
     $erb->setGroup($group1);
     $this->assertEquals(0, count($erb->fetchAll()));
     $this->assertNull($uwgr->loadByUserAndGroup($user2, $group1));
     $group2 = $groupRepo->loadById($group2->getId());
     $this->assertFalse($group2->getIsDeleted());
     $this->assertNull($group2->getIsDuplicateOfId());
     // Mark
     \TimeSource::mock(2014, 1, 1, 2, 0, 0);
     $groupRepo->markDuplicate($group2, $group1, $user1);
     // Test Duplicate
     $erb = new \repositories\builders\EventRepositoryBuilder();
     $erb->setGroup($group1);
     $this->assertEquals(1, count($erb->fetchAll()));
     $uwg = $uwgr->loadByUserAndGroup($user2, $group1);
     $this->assertNotNull($uwg);
     $group2 = $groupRepo->loadById($group2->getId());
     $this->assertTrue($group2->getIsDeleted());
     $this->assertEquals($group1->getId(), $group2->getIsDuplicateOfId());
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:59,代码来源:GroupDuplicateTest.php


示例14: getLastSentForUserAccount

 public function getLastSentForUserAccount(UserAccountModel $user)
 {
     global $DB;
     $stat = $DB->prepare("SELECT MAX(created_at) AS c FROM user_account_verify_email WHERE user_account_id=:user_account_id");
     $stat->execute(array('user_account_id' => $user->getId()));
     $data = $stat->fetch();
     return $data['c'] ? new \DateTime($data['c'], new \DateTimeZone('UTC')) : null;
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:8,代码来源:UserAccountVerifyEmailRepository.php


示例15: testInChildArea

 function testInChildArea()
 {
     $this->addCountriesToTestDB();
     TimeSource::mock(2013, 7, 1, 7, 0, 0);
     $user = new UserAccountModel();
     $user->setEmail("[email protected]");
     $user->setUsername("test");
     $user->setPassword("password");
     $userRepo = new UserAccountRepository();
     $userRepo->create($user);
     $site = new SiteModel();
     $site->setTitle("Test");
     $site->setSlug("test");
     $siteRepo = new SiteRepository();
     $siteRepo->create($site, $user, array(), $this->getSiteQuotaUsedForTesting());
     $area1 = new AreaModel();
     $area1->setTitle("scotland");
     $area1child = new AreaModel();
     $area1child->setTitle("edinburgh");
     $area2 = new AreaModel();
     $area2->setTitle("england");
     $areaRepo = new AreaRepository();
     $countryRepo = new CountryRepository();
     $areaRepo->create($area1, null, $site, $countryRepo->loadByTwoCharCode('GB'), $user);
     $areaRepo->buildCacheAreaHasParent($area1);
     $areaRepo->create($area1child, $area1, $site, $countryRepo->loadByTwoCharCode('GB'), $user);
     $areaRepo->buildCacheAreaHasParent($area1child);
     $areaRepo->create($area2, null, $site, $countryRepo->loadByTwoCharCode('GB'), $user);
     $areaRepo->buildCacheAreaHasParent($area2);
     $event = new EventModel();
     $event->setSummary("test");
     $event->setDescription("test test");
     $event->setStartAt($this->mktime(2013, 8, 1, 19, 0, 0));
     $event->setEndAt($this->mktime(2013, 8, 1, 21, 0, 0));
     $event->setAreaId($area1child->getId());
     $eventRepository = new EventRepository();
     $eventRepository->create($event, $site, $user);
     #test - find in erb
     $erb = new EventRepositoryBuilder();
     $erb->setSite($site);
     $erb->setArea($area1);
     $events = $erb->fetchAll();
     $this->assertEquals(1, count($events));
     $this->assertEquals($event->getId(), $events[0]->getId());
     #test - find in erb
     $erb = new EventRepositoryBuilder();
     $erb->setSite($site);
     $erb->setArea($area1child);
     $events = $erb->fetchAll();
     $this->assertEquals(1, count($events));
     $this->assertEquals($event->getId(), $events[0]->getId());
     #test - don't find in erb
     $erb = new EventRepositoryBuilder();
     $erb->setSite($site);
     $erb->setArea($area2);
     $events = $erb->fetchAll();
     $this->assertEquals(0, count($events));
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:58,代码来源:EventInAreaTest.php


示例16: testBasic

 function testBasic()
 {
     global $CONFIG;
     \TimeSource::mock(2013, 10, 1, 1, 1, 1);
     $CONFIG->importURLAllowEventsSecondsIntoFuture = 7776000;
     // 90 days
     $user = new UserAccountModel();
     $user->setEmail("[email protected]");
     $user->setUsername("test");
     $user->setPassword("password");
     $userRepo = new UserAccountRepository();
     $userRepo->create($user);
     $site = new SiteModel();
     $site->setTitle("Test");
     $site->setSlug("test");
     $siteRepo = new SiteRepository();
     $siteRepo->create($site, $user, array(), $this->getSiteQuotaUsedForTesting());
     $group = new GroupModel();
     $group->setTitle("test");
     $group->setDescription("test test");
     $group->setUrl("http://www.group.com");
     $groupRepo = new GroupRepository();
     $groupRepo->create($group, $site, $user);
     $importURLRepository = new ImportURLRepository();
     $importURL = new ImportURLModel();
     $importURL->setIsEnabled(true);
     $importURL->setSiteId($site->getId());
     $importURL->setGroupId($group->getId());
     $importURL->setTitle("Test");
     $importURL->setUrl("http://test.com");
     $importURLRepository->create($importURL, $site, $user);
     // Import
     $importURLRun = new ImportURLRun($importURL, $site);
     $importURLRun->setTemporaryFileStorageForTesting(dirname(__FILE__) . '/data/Lanyrd1.ical');
     $importURLRun->setFlag(ImportURLRun::$FLAG_ADD_UIDS);
     $i = new ImportURLICalHandler();
     $i->setImportURLRun($importURLRun);
     $this->assertTrue($i->canHandle());
     $r = $i->handle();
     // Load!
     $erb = new EventRepositoryBuilder();
     $erb->setSite($site);
     $events = $erb->fetchAll();
     $this->assertEquals(1, count($events));
     $event = $events[0];
     $this->assertEquals("State of the Map Scotland 2013", $event->getSummary());
     $this->assertEquals('2013-10-11 00:00:00', $event->getStartAt()->format('Y-m-d H:i:s'));
     $this->assertEquals('2013-10-14 23:59:59', $event->getEndAt()->format('Y-m-d H:i:s'));
     $this->assertEquals("http://sotms.eventbrite.com/\n\nhttp://lanyrd.com/crkmt", $event->getDescription());
     $this->assertEquals('http://lanyrd.com/2013/sotmscot2013/', $event->getURL());
     $this->assertFalse($event->getIsDeleted());
     // Look for event
     $erb = new EventRepositoryBuilder();
     $erb->setSite($site);
     $erb->setImportURL($importURL);
     $this->assertEquals(1, count($erb->fetchAll()));
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:57,代码来源:ImportURLLanyrdDataTest.php


示例17: UserAccountModel

 function testIntegration1()
 {
     \TimeSource::mock(2014, 1, 1, 12, 0, 0);
     $user = new UserAccountModel();
     $user->setEmail("[email protected]");
     $user->setUsername("test");
     $user->setPassword("password");
     $userRepo = new UserAccountRepository();
     $userRepo->create($user);
     $site = new SiteModel();
     $site->setTitle("Test");
     $site->setSlug("test");
     $siteRepo = new SiteRepository();
     $siteRepo->create($site, $user, array(), $this->getSiteQuotaUsedForTesting());
     ## Create group
     \TimeSource::mock(2014, 1, 1, 13, 0, 0);
     $group = new GroupModel();
     $group->setTitle("test");
     $group->setDescription("test test");
     $group->setUrl("http://www.group.com");
     $groupRepo = new GroupRepository();
     $groupRepo->create($group, $site, $user);
     ## Edit group
     \TimeSource::mock(2014, 1, 1, 14, 0, 0);
     $group = $groupRepo->loadById($group->getId());
     $group->setTwitterUsername("testy");
     $groupRepo->edit($group, $user);
     ## Now save changed flags on these .....
     $groupHistoryRepo = new GroupHistoryRepository();
     $stat = $this->app['db']->prepare("SELECT * FROM group_history");
     $stat->execute();
     while ($data = $stat->fetch()) {
         $groupHistory = new GroupHistoryModel();
         $groupHistory->setFromDataBaseRow($data);
         $groupHistoryRepo->ensureChangedFlagsAreSet($groupHistory);
     }
     ## Now load and check
     $historyRepo = new HistoryRepositoryBuilder();
     $historyRepo->setGroup($group);
     $historyRepo->setIncludeEventHistory(false);
     $historyRepo->setIncludeVenueHistory(false);
     $historyRepo->setIncludeGroupHistory(true);
     $histories = $historyRepo->fetchAll();
     $this->assertEquals(2, count($histories));
     #the edit
     $this->assertEquals(FALSE, $histories[0]->getTitleChanged());
     $this->assertEquals(false, $histories[0]->getDescriptionChanged());
     $this->assertEquals(false, $histories[0]->getUrlChanged());
     $this->assertEquals(true, $histories[0]->getTwitterUsernameChanged());
     $this->assertEquals(false, $histories[0]->getIsDeletedChanged());
     #the create
     $this->assertEquals(true, $histories[1]->getTitleChanged());
     $this->assertEquals(true, $histories[1]->getDescriptionChanged());
     $this->assertEquals(true, $histories[1]->getUrlChanged());
     $this->assertEquals(false, $histories[1]->getTwitterUsernameChanged());
     $this->assertEquals(false, $histories[1]->getIsDeletedChanged());
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:57,代码来源:GroupHistoryWithDBTest.php


示例18: testBasic

 function testBasic()
 {
     global $CONFIG;
     \TimeSource::mock(2013, 10, 1, 1, 1, 1);
     $CONFIG->importURLAllowEventsSecondsIntoFuture = 7776000;
     // 90 days
     $user = new UserAccountModel();
     $user->setEmail("[email protected]");
     $user->setUsername("test");
     $user->setPassword("password");
     $userRepo = new UserAccountRepository();
     $userRepo->create($user);
     $site = new SiteModel();
     $site->setTitle("Test");
     $site->setSlug("test");
     $siteRepo = new SiteRepository();
     $siteRepo->create($site, $user, array(), $this->getSiteQuotaUsedForTesting());
     $group = new GroupModel();
     $group->setTitle("test");
     $group->setDescription("test test");
     $group->setUrl("http://www.group.com");
     $groupRepo = new GroupRepository();
     $groupRepo->create($group, $site, $user);
     $importURLRepository = new ImportURLRepository();
     $importURL = new ImportURLModel();
     $importURL->setIsEnabled(true);
     $importURL->setSiteId($site->getId());
     $importURL->setGroupId($group->getId());
     $importURL->setTitle("Test");
     $importURL->setUrl("http://test.com");
     $importURLRepository->create($importURL, $site, $user);
     // Import
     $importURLRun = new ImportURLRun($importURL, $site);
     $importURLRun->setTemporaryFileStorageForTesting(dirname(__FILE__) . '/data/Eventbrite1.ical');
     $importURLRun->setFlag(ImportURLRun::$FLAG_ADD_UIDS);
     $importURLRun->setFlag(ImportURLRun::$FLAG_SET_TICKET_URL_AS_URL);
     $i = new ImportURLICalHandler();
     $i->setImportURLRun($importURLRun);
     $this->assertTrue($i->canHandle());
     $r = $i->handle();
     // Load!
     $erb = new EventRepositoryBuilder();
     $erb->setSite($site);
     $events = $erb->fetchAll();
     $this->assertEquals(1, count($events));
     $event = $events[0];
     $this->assertEquals("Computing At School Scotland Conference 2013", $event->getSummary());
     $this->assertEquals('2013-10-26 07:30:00', $event->getStartAt()->format('Y-m-d H:i:s'));
     $this->assertEquals('2013-10-26 16:00:00', $event->getEndAt()->format('Y-m-d H:i:s'));
     $this->assertEquals('For details, click here: https://casscot13.eventbrite.co.uk', $event->getDescription());
     $this->assertEquals('https://casscot13.eventbrite.co.uk', $event->getURL());
     $this->assertEquals('https://casscot13.eventbrite.co.uk', $event->getTicketURL());
     $this->assertFalse($event->getIsDeleted());
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:54,代码来源:ImportURLEventbriteDataTest.php


示例19: loadByUserAndSiteId

 public function loadByUserAndSiteId(UserAccountModel $user, $siteID)
 {
     global $DB;
     $stat = $DB->prepare("SELECT user_interested_in_site_information.* FROM user_interested_in_site_information WHERE user_account_id =:user_account_id AND site_id=:site_id");
     $stat->execute(array('user_account_id' => $user->getId(), 'site_id' => $siteID));
     if ($stat->rowCount() > 0) {
         $uiis = new UserInterestedInSiteModel();
         $uiis->setFromDataBaseRow($stat->fetch());
         return $uiis;
     }
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:11,代码来源:UserInterestedInSiteRepository.php


示例20: loadBySlugForSiteAndUser

 public function loadBySlugForSiteAndUser($slug, SiteModel $siteModel, UserAccountModel $userAccountModel)
 {
     global $DB;
     $stat = $DB->prepare("SELECT new_event_draft_information.*  FROM new_event_draft_information " . " WHERE new_event_draft_information.slug =:slug AND new_event_draft_information.site_id = :site_id AND new_event_draft_information.user_account_id = :user_id");
     $stat->execute(array('slug' => $slug, 'site_id' => $siteModel->getId(), 'user_id' => $userAccountModel->getId()));
     if ($stat->rowCount() > 0) {
         $event = new NewEventDraftModel();
         $event->setFromDataBaseRow($stat->fetch());
         return $event;
     }
 }
开发者ID:radical-assembly,项目名称:OpenACalendar-Web-Core,代码行数:11,代码来源:NewEventDraftRepository.php



注:本文中的models\UserAccountModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Money\Money类代码示例发布时间:2022-05-23
下一篇:
PHP models\User类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap