Пример #1
0
 /**
  * @param int $uid
  * @param string $begin
  * @param string $end
  * @param array $speakerIds
  * @param bool $expected
  *
  * @test
  * @dataProvider collidingSessionsAreDeterminedDataProvider
  */
 public function collidingSessionsAreDetermined($uid, $begin, $end, array $speakerIds, $exclude, $expected)
 {
     $beginDateTime = \DateTime::createFromFormat(DATE_ISO8601, $begin);
     $endDateTime = \DateTime::createFromFormat(DATE_ISO8601, $end);
     $session = new AnySession();
     $session->_setProperty('uid', $uid);
     $session->setBegin($beginDateTime);
     $session->setEnd($endDateTime);
     foreach ($speakerIds as $speakerId) {
         $speaker = new FrontendUser();
         $speaker->_setProperty('uid', $speakerId);
         $session->addSpeaker($speaker);
     }
     $result = $this->subject->getCollidingSessions($session, $exclude);
     $this->assertEquals($expected, is_array($result) ? count($result) : $result);
 }
 public function createAction(\TYPO3\CMS\Extbase\Domain\Model\FrontendUser $feUser)
 {
     //TODO prüfen ob username doppelt vergeben wird.
     if ($feUser->getPassword() == $this->request->getArgument('passwordConfirmation')) {
         $feUser->setPid($this->settings['pidFrontendUser']);
         $feUser->_setProperty('tx_extbase_type', 'Tx_Extbase_Domain_Model_FrontendUser');
         $feUser->addUserGroup($this->frontendUserGroupRepository->findByUid($this->settings['frontendUserGroup']));
         $this->frontendUserRepository->add($feUser);
         //it is not persistent already, we have to do it!
         $persistenceManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager');
         $persistenceManager->persistAll();
         //now feuser ist persistent
         // Message for User
         $GLOBALS['TSFE']->fe_user->setKey("ses", "feuserCreate", 'Der User <b>' . $feUser->getUsername() . '</b> wurde neu angelegt.');
         $redirectParams['feUser'] = $feUser;
         $this->redirect('successUpdate', 'FrontendUser', NULL, $redirectParams);
     } else {
         $GLOBALS['TSFE']->fe_user->setKey("ses", "feuserCreate", 'Das Passwort stimmt nicht überein.');
         $GLOBALS['TSFE']->fe_user->setKey("ses", "feuserData", array('username' => $feUser->getUsername()));
         $redirectParams['feUser'] = $feUser;
         $this->redirect('new', 'FrontendUser', NULL, array());
     }
 }
Пример #3
0
 /**
  * @param int $amount
  * @return FrontendUser[]
  */
 protected function createSpeakers($amount)
 {
     $speakers = [];
     for ($i = 1; $i <= $amount; $i++) {
         $speaker = new FrontendUser();
         $speaker->_setProperty('uid', $i + 2000);
         $speaker->setName('Speaker #' . $i);
         $speakers[] = $speaker;
     }
     return $speakers;
 }