/** * @test */ public function renderHasResultEndingWithCarriageReturnAndLineFeed() { $this->configuration->setAsString('fieldsFromEventsForCsv', 'uid'); $this->createEventInFolderAndSetPageUid(); $this->testingFramework->createRecord('tx_seminars_seminars', array('pid' => $this->pageUid, 'begin_date' => $GLOBALS['SIM_EXEC_TIME'] - 3600)); self::assertRegExp('/\\r\\n$/', $this->subject->render($this->pageUid)); }
/** * @test */ public function sendRemindersToOrganizersForEventWithOneRegistrationsSendsReminderWithMessageWithNumberOfRegistrations() { $eventUid = $this->createSeminarWithOrganizer(array('begin_date' => $GLOBALS['SIM_EXEC_TIME'] + tx_oelib_Time::SECONDS_PER_DAY, 'cancelled' => tx_seminars_seminar::STATUS_CONFIRMED)); $this->testingFramework->createRecord('tx_seminars_attendances', array('title' => 'test registration', 'seminar' => $eventUid, 'user' => $this->testingFramework->createFrontEndUser())); $this->fixture->sendEventTakesPlaceReminders(); self::assertContains('1', $this->mailer->getFirstSentEmail()->getBody()); }
/** * @test */ public function limitToMinimumPriceForMinimumPriceZeroFindsEventWithRegularPrice() { $this->testingFramework->createRecord('tx_seminars_seminars', array('price_regular' => 16)); $this->fixture->limitToMinimumPrice(0); $bag = $this->fixture->build(); self::assertSame(1, $bag->count()); }
/** * @test */ public function getPreselectedOrganizerForTwoAvailableOrganizersReturnsZero() { $this->testingFramework->createAndLoginFrontEndUser(); $this->testingFramework->createRecord('tx_seminars_organizers'); $this->testingFramework->createRecord('tx_seminars_organizers'); self::assertEquals(0, $this->fixture->getPreselectedOrganizer()); }
/** * @test */ public function logInUserOverwritesFormerRealLoggedInUser() { $this->testingFramework->createFakeFrontEnd(); $this->testingFramework->createAndLoginFrontEndUser(); $user = new Tx_Oelib_Model_FrontEndUser(); $this->subject->logInUser($user); self::assertSame($user, $this->subject->getLoggedInUser()); }
/** * @test */ public function renderForQueueRegistrationsAllowedForEmailNotContainsRegistrationOnQueue() { $this->configuration->setAsBoolean('showAttendancesOnRegistrationQueueInEmailCsv', TRUE); $this->configuration->setAsBoolean('showAttendancesOnRegistrationQueueInCSV', FALSE); $this->configuration->setAsString('fieldsFromAttendanceForCsv', 'uid'); $this->configuration->setAsString('fieldsFromAttendanceForEmailCsv', 'uid'); $registrationUid = $this->testingFramework->createRecord('tx_seminars_attendances', array('seminar' => $this->eventUid, 'crdate' => $GLOBALS['SIM_EXEC_TIME'], 'user' => $this->testingFramework->createFrontEndUser(), 'registration_queue' => TRUE)); self::assertContains((string) $registrationUid, $this->subject->render()); }
/** * @test */ public function renderReturnsRegistrationsOnSubpageOfGivenPage() { $this->subject->setEventUid(0); $this->subject->setPageUid($this->pageUid); $subpagePid = $this->testingFramework->createSystemFolder($this->pageUid); $this->registrationFieldKeys = array('address'); $this->testingFramework->createRecord('tx_seminars_attendances', array('seminar' => $this->eventUid, 'user' => $this->testingFramework->createFrontEndUser(), 'address' => 'foo', 'pid' => $subpagePid)); self::assertContains('foo', $this->subject->render()); }
/** * @test */ public function getAfterSetReturnsManuallySetConfigurationEvenIfThereIsAPage() { $pageUid = $this->testingFramework->createFrontEndPage(); $this->testingFramework->createTemplate($pageUid, array('config' => 'plugin.tx_oelib.bar = 42')); Tx_Oelib_PageFinder::getInstance()->setPageUid($pageUid); $configuration = new Tx_Oelib_Configuration(); Tx_Oelib_ConfigurationRegistry::getInstance()->set('plugin.tx_oelib', $configuration); self::assertSame($configuration, Tx_Oelib_ConfigurationRegistry::get('plugin.tx_oelib')); }
/** * @test */ public function createAndOutputListOfRegistrationsForWebModeNotUsesRegistrationsOnQueueSettingFromEmailConfiguration() { $this->configuration->setAsBoolean('showAttendancesOnRegistrationQueueInEmailCsv', TRUE); $this->configuration->setAsString('fieldsFromAttendanceForEmailCsv', 'uid'); $this->configuration->setAsBoolean('showAttendancesOnRegistrationQueueInCsv', FALSE); $this->configuration->setAsString('fieldsFromAttendanceForCsv', 'uid'); $this->testingFramework->createRecord('tx_seminars_attendances', array('seminar' => $this->eventUid, 'user' => $this->testingFramework->createFrontEndUser())); $queueUid = $this->testingFramework->createRecord('tx_seminars_attendances', array('seminar' => $this->eventUid, 'user' => $this->testingFramework->createFrontEndUser(), 'bank_name' => 'foo bank', 'registration_queue' => 1)); self::assertNotContains((string) $queueUid, $this->fixture->createAndOutputListOfRegistrations($this->eventUid)); }
/** * @test */ public function oneToManyRelationsWithOneRelatedModelReturnsListWithRelatedModelWithData() { $relatedTitle = 'Triss Merrigold'; $uid = $this->testingFramework->createRecord('tx_oelib_test', array('composition' => 1)); $this->testingFramework->createRecord('tx_oelib_testchild', array('parent' => $uid, 'title' => $relatedTitle)); /** @var Tx_Oelib_Tests_Unit_Fixtures_TestingModel $model */ $model = $this->subject->find($uid); /** @var Tx_Oelib_Tests_Unit_Fixtures_TestingModel $firstChildModel */ $firstChildModel = $model->getComposition()->first(); self::assertSame($relatedTitle, $firstChildModel->getTitle()); }
/** * @test */ public function sendRemindersToOrganizersForCliBackendUserWithLanguageGermanSendsReminderInGerman() { /** @var tx_seminars_Model_BackEndUser $user */ $user = tx_oelib_MapperRegistry::get('tx_oelib_Mapper_BackEndUser')->findByCliKey(); $this->testingFramework->changeRecord('be_users', $user->getUid(), array('lang' => 'de')); tx_oelib_MapperRegistry::purgeInstance(); $this->addSpeaker($this->createSeminarWithOrganizer(array('begin_date' => $GLOBALS['SIM_EXEC_TIME'] + tx_oelib_Time::SECONDS_PER_DAY, 'cancelled' => tx_seminars_seminar::STATUS_PLANNED))); $this->fixture->sendCancellationDeadlineReminders(); $GLOBALS['LANG']->includeLLFile(t3lib_extMgm::extPath('seminars') . 'locallang.xml'); $GLOBALS['LANG']->lang = 'de'; $subject = $GLOBALS['LANG']->getLL('email_cancelationDeadlineReminderSubject'); $subject = str_replace('%event', '', $subject); self::assertContains($subject, $this->mailer->getFirstSentEmail()->getSubject()); }
/** * @test */ public function createBackEndUserGroupForTitleGivenStoresTitleInGroupRecord() { $this->subject->createBackEndUserGroup(array('title' => 'foo group')); self::assertTrue($this->subject->existsRecord('be_groups', 'title = "foo group"')); }
/** * Creates a test record. * * @return int the UID */ private function createTestRecord() { return $this->testingFramework->createRecord('tx_oelib_test', array('title' => self::TEST_RECORD_TITLE)); }
/** * @test */ public function hasStoragePidForGrspSetReturnsTrue() { $pageUid = $this->testingFramework->createFrontEndPage(0, array('storage_pid' => 42)); $this->testingFramework->createFakeFrontEnd($pageUid); self::assertTrue($this->subject->hasStoragePid()); }
public function testHasEventIcon() { $this->testingFramework->createRecord('tx_seminars_seminars', array('pid' => $this->dummySysFolderPid, 'title' => 'event_1', 'object_type' => tx_seminars_Model_Event::TYPE_COMPLETE)); self::assertContains('EventComplete.gif', $this->fixture->show()); }
protected function tearDown() { $this->testingFramework->cleanUp(); }
/** * @test */ public function getByExtensionNameDoesNotDeleteLanguageLabelsNotAffectedByTypoScript() { $testingFramework = new Tx_Oelib_TestingFramework('oelib'); $testingFramework->createFakeFrontEnd(); $this->getFrontEndController()->initLLvars(); Tx_Oelib_ConfigurationRegistry::get('config')->set('language', 'default'); Tx_Oelib_ConfigurationRegistry::get('plugin.tx_oelib._LOCAL_LANG')->setData(array('default.' => array())); Tx_Oelib_ConfigurationRegistry::get('plugin.tx_oelib._LOCAL_LANG.default')->set('label_test_2', 'I am from TypoScript.'); self::assertSame('I am from file.', Tx_Oelib_TranslatorRegistry::get('oelib')->translate('label_test')); $testingFramework->discardFakeFrontEnd(); }
/** * @test */ public function getCurrentSourceForSetFrontEndPageUidReturnsSourceFrontEnd() { $this->testingFramework->createFakeFrontEnd(); self::assertSame(Tx_Oelib_PageFinder::SOURCE_FRONT_END, $this->subject->getCurrentSource()); }
protected function tearDown() { Tx_Oelib_BackEndLoginManager::purgeInstance(); $this->testingFramework->cleanUp(); $GLOBALS['BE_USER'] = $this->backEndUserBackup; }
protected function tearDown() { $this->testingFramework->cleanUp(); $GLOBALS['TYPO3_CONF_VARS']['SYS']['enableDeprecationLog'] = $this->deprecationLogEnabledBackup; }
/** * @test */ public function existsRecordWithUidUsesAdditionalNonEmptyWhereClause() { $uid = $this->testingFramework->createRecord('tx_oelib_test', array('deleted' => 1)); self::assertFalse(Tx_Oelib_Db::existsRecordWithUid('tx_oelib_test', $uid, ' AND deleted = 0')); }
/** * Purges the cached hooks. * * @return void */ public function purgeHooks() { self::$hooks = array(); self::$hooksHaveBeenRetrieved = FALSE; }
protected function tearDown() { $this->testingFramework->cleanUp(); tx_seminars_registrationmanager::purgeInstance(); }
/** * @test */ public function countByWhereClauseWithTwoMatchingRecordsReturnsTwo() { $this->testingFramework->createRecord('tx_oelib_test', array('title' => 'bar')); $this->testingFramework->createRecord('tx_oelib_test', array('title' => 'bar')); self::assertSame(2, $this->subject->countByWhereClause('title = "bar"')); }