/** * @test */ public function relatedRecordWithRelationToSelfReturnsSelf() { $uid = $this->testingFramework->createRecord('tx_oelib_test'); $this->testingFramework->changeRecord('tx_oelib_test', $uid, array('friend' => $uid)); /** @var Tx_Oelib_Tests_Unit_Fixtures_TestingModel $model */ $model = $this->subject->find($uid); self::assertSame($model, $model->getFriend()); }
/** * @test */ public function sendRemindersToOrganizersForEventWithTwoOrganizersSendsEmailWithFirstOrganizerAsSender() { $eventUid = $this->createSeminarWithOrganizer(array('begin_date' => $GLOBALS['SIM_EXEC_TIME'] + tx_oelib_Time::SECONDS_PER_DAY, 'cancelled' => tx_seminars_seminar::STATUS_CONFIRMED)); $organizerUid = $this->testingFramework->createRecord('tx_seminars_organizers', array('title' => 'foo', 'email' => '*****@*****.**')); $this->testingFramework->createRelation('tx_seminars_seminars_organizers_mm', $eventUid, $organizerUid); $this->testingFramework->changeRecord('tx_seminars_seminars', $eventUid, array('organizers' => 2)); $this->fixture->sendEventTakesPlaceReminders(); self::assertArrayHasKey('*****@*****.**', $this->mailer->getFirstSentEmail()->getFrom()); }
/** * @test */ public function sendEMailToReviewerUsesFrontEndUserMailAddressAsFromAddressForMail() { $seminarUid = $this->testingFramework->createRecord('tx_seminars_seminars'); $this->createAndLoginUserWithReviewer(); $this->fixture->setObjectUid($seminarUid); $formData = $this->fixture->modifyDataToInsert(array()); $this->testingFramework->changeRecord('tx_seminars_seminars', $seminarUid, array('hidden' => 1, 'publication_hash' => $formData['publication_hash'])); $this->fixture->sendEMailToReviewer(); self::assertArrayHasKey('*****@*****.**', $this->mailer->getFirstSentEmail()->getFrom()); }
/** * @test */ public function getLoggedInUserUsesMappedUserDataFromMemory() { $this->testingFramework->createFakeFrontEnd(); $feUserUid = $this->testingFramework->createAndLoginFrontEndUser('', array('name' => 'John Doe')); /** @var tslib_fe $frontEndController */ $frontEndController = $GLOBALS['TSFE']; $frontEndController->fe_user->user['name'] = 'Jane Doe'; $this->testingFramework->changeRecord('fe_users', $feUserUid, array('name' => 'James Doe')); self::assertSame('John Doe', $this->subject->getLoggedInUser()->getName()); }
/** * @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 createAndOutputListOfEventsSeparatesValuesWithSemicolons() { $this->testingFramework->changeRecord('tx_seminars_seminars', $this->eventUid, array('description' => 'foo', 'title' => 'bar')); $this->configuration->setAsString('fieldsFromEventsForCsv', 'description,title'); self::assertContains('foo;bar', $this->fixture->createAndOutputListOfEvents($this->pid)); }
/** * @test */ public function changeRecordFailsOnInexistentRecord() { $uid = $this->subject->createRecord('tx_oelib_test', array()); $this->setExpectedException('BadMethodCallException', 'There is no record with UID ' . ($uid + 1) . ' on table "tx_oelib_test".'); $this->subject->changeRecord('tx_oelib_test', $uid + 1, array('title' => 'foo')); }