/**
  * Checks whether the UID provided as the second argument when starting the
  * CLI script actually exists in the "pages" table. If the page UID is
  * valid, defines this UID as the one where to take the configuration from,
  * otherwise throws an exception.
  *
  * @throws InvalidArgumentException if no page UID or an invalid UID was provided
  *
  * @return void
  */
 public function setConfigurationPage()
 {
     if (!isset($_SERVER['argv'][1])) {
         throw new InvalidArgumentException('Please provide the UID for the page with the configuration for the CLI module.', 1333292959);
     }
     $uid = (int) $_SERVER['argv'][1];
     if ($uid == 0 || tx_oelib_db::selectSingle('COUNT(*) AS number', 'pages', 'uid = ' . $uid) != array('number' => 1)) {
         throw new InvalidArgumentException('The provided UID for the page with the configuration was ' . $_SERVER['argv'][1] . ', which was not found to be a UID of an existing page. Please provide the UID of an existing page.', 1333292966);
     }
     tx_oelib_PageFinder::getInstance()->setPageUid($uid);
 }
Пример #2
0
 /**
  * @test
  */
 public function setConfigurationPageSetsTheExistingPidIsProvidedForThePageFinder()
 {
     $pageUid = $this->testingFramework->createFrontEndPage();
     $_SERVER['argv'][1] = $pageUid;
     $this->fixture->setConfigurationPage();
     self::assertSame($pageUid, tx_oelib_PageFinder::getInstance()->getPageUid());
 }
Пример #3
0
 protected function setUp()
 {
     $configuration = new Tx_Oelib_Configuration();
     Tx_Oelib_ConfigurationRegistry::getInstance()->set('plugin.tx_seminars', $configuration);
     $this->extConfBackup = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'];
     $this->t3VarBackup = $GLOBALS['T3_VAR']['getUserObj'];
     $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['seminars'] = array();
     $this->languageBackup = $GLOBALS['LANG']->lang;
     $GLOBALS['LANG']->lang = 'default';
     // Loads the locallang file for properly working localization in the tests.
     $GLOBALS['LANG']->includeLLFile('EXT:seminars/BackEnd/locallang.xml');
     tx_oelib_headerProxyFactory::getInstance()->enableTestMode();
     /** @var Tx_Oelib_MailerFactory $mailerFactory */
     $mailerFactory = t3lib_div::makeInstance('Tx_Oelib_MailerFactory');
     $mailerFactory->enableTestMode();
     $this->mailer = $mailerFactory->getMailer();
     $this->testingFramework = new tx_oelib_testingFramework('tx_seminars');
     tx_oelib_MapperRegistry::getInstance()->activateTestingMode($this->testingFramework);
     $this->dummySysFolderUid = $this->testingFramework->createSystemFolder();
     tx_oelib_PageFinder::getInstance()->setPageUid($this->dummySysFolderUid);
     $this->organizerUid = $this->testingFramework->createRecord('tx_seminars_organizers', array('title' => 'Dummy Organizer', 'email' => '*****@*****.**'));
     $this->eventUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('pid' => $this->dummySysFolderUid, 'title' => 'Dummy event', 'object_type' => tx_seminars_Model_Event::TYPE_DATE, 'begin_date' => $GLOBALS['SIM_EXEC_TIME'] + 86400, 'organizers' => 0));
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $this->eventUid, $this->organizerUid, 'organizers');
     $this->fixture = new tx_seminars_BackEnd_CancelEventMailForm($this->eventUid);
     $this->linkBuilder = $this->getMock('tx_seminars_Service_SingleViewLinkBuilder', array('createAbsoluteUrlForEvent'));
     $this->linkBuilder->expects(self::any())->method('createAbsoluteUrlForEvent')->will(self::returnValue('http://singleview.example.com/'));
     $this->fixture->injectLinkBuilder($this->linkBuilder);
 }
Пример #4
0
 /**
  * Redirects to the list view.
  *
  * @return void
  */
 private function redirectToListView()
 {
     $url = t3lib_BEfunc::getModuleUrl(self::MODULE_NAME, array('id' => tx_oelib_PageFinder::getInstance()->getPageUid()), FALSE, TRUE);
     tx_oelib_headerProxyFactory::getInstance()->getHeaderProxy()->addHeader('Location: ' . $url);
 }
 protected function setUp()
 {
     $configuration = new Tx_Oelib_Configuration();
     Tx_Oelib_ConfigurationRegistry::getInstance()->set('plugin.tx_seminars', $configuration);
     $this->extConfBackup = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'];
     $this->t3VarBackup = $GLOBALS['T3_VAR']['getUserObj'];
     $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['seminars'] = array();
     $this->languageBackup = $GLOBALS['LANG']->lang;
     $GLOBALS['LANG']->lang = 'default';
     // Loads the locallang file for properly working localization in the tests.
     $GLOBALS['LANG']->includeLLFile('EXT:seminars/BackEnd/locallang.xml');
     tx_oelib_headerProxyFactory::getInstance()->enableTestMode();
     /** @var Tx_Oelib_MailerFactory $mailerFactory */
     $mailerFactory = t3lib_div::makeInstance('Tx_Oelib_MailerFactory');
     $mailerFactory->enableTestMode();
     $this->mailer = $mailerFactory->getMailer();
     $this->testingFramework = new tx_oelib_testingFramework('tx_seminars');
     $this->dummySysFolderUid = $this->testingFramework->createSystemFolder();
     tx_oelib_PageFinder::getInstance()->setPageUid($this->dummySysFolderUid);
     $this->organizerUid = $this->testingFramework->createRecord('tx_seminars_organizers', array('title' => 'Dummy Organizer', 'email' => '*****@*****.**'));
     $this->eventUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('organizers' => 1, 'begin_date' => $GLOBALS['SIM_EXEC_TIME'] + 42, 'title' => 'Dummy Event', 'registrations' => 1));
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $this->eventUid, $this->organizerUid, 'organizers');
     $this->fixture = new tx_seminars_BackEnd_GeneralEventMailForm($this->eventUid);
 }