/** * @test */ public function findWithUidOfExistingRecordReturnsRecordAsModel() { $uid = $this->testingFramework->createRecord('tx_seminars_checkboxes', array('title' => 'I agree with the T&C.')); /** @var tx_seminars_Model_Checkbox $model */ $model = $this->fixture->find($uid); self::assertEquals('I agree with the T&C.', $model->getTitle()); }
/** * Inserts a skill record into the database and creates a relation to it * from the fixture. * * @param array $skillData data of the skill to add, may be empty * * @return int the UID of the created record, will always be > 0 */ private function addSkillRelation(array $skillData) { $uid = $this->testingFramework->createRecord('tx_seminars_skills', $skillData); $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_speakers', $this->fixture->getUid(), $uid, 'skills'); $this->fixture = new tx_seminars_speaker($this->fixture->getUid()); return $uid; }
/** * @test */ public function findWithUidOfExistingRecordReturnsRecordAsModel() { $uid = $this->testingFramework->createRecord('tx_seminars_organizers', array('title' => 'Fabulous organizer')); /** @var tx_seminars_Model_Lodging $model */ $model = $this->fixture->find($uid); self::assertEquals('Fabulous organizer', $model->getName()); }
/** * @test */ public function findWithUidOfExistingRecordReturnsRecordAsModel() { $uid = $this->testingFramework->createRecord('tx_seminars_foods', array('title' => 'Crunchy crisps')); /** @var tx_seminars_Model_Food $model */ $model = $this->fixture->find($uid); self::assertEquals('Crunchy crisps', $model->getTitle()); }
/** * @test */ public function findWithUidOfExistingRecordReturnsRecordAsModel() { $uid = $this->testingFramework->createRecord('tx_seminars_sites', array('title' => 'Nice place')); /** @var tx_seminars_Model_Place $model */ $model = $this->fixture->find($uid); self::assertEquals('Nice place', $model->getTitle()); }
/** * @test */ public function findWithUidOfExistingRecordReturnsRecordAsModel() { $uid = $this->testingFramework->createRecord('tx_seminars_target_groups', array('title' => 'Housewives')); /** @var tx_seminars_Model_TargetGroup $model */ $model = $this->fixture->find($uid); self::assertEquals('Housewives', $model->getTitle()); }
protected function setUp() { $this->testingFramework = new tx_oelib_testingFramework('tx_seminars'); $this->uidOfFirstRecord = $this->testingFramework->createRecord('tx_seminars_test', array('title' => 'test 1')); $this->uidOfSecondRecord = $this->testingFramework->createRecord('tx_seminars_test', array('title' => 'test 2')); $this->fixture = new tx_seminars_tests_fixtures_Bag_Testing('is_dummy_record=1'); }
/** * @test */ public function findWithUidOfExistingRecordReturnsRecordAsModel() { $uid = $this->testingFramework->createRecord('tx_seminars_event_types', array('title' => 'Workshop')); /** @var tx_seminars_Model_EventType $model */ $model = $this->fixture->find($uid); self::assertEquals('Workshop', $model->getTitle()); }
protected function setUp() { $this->testingFramework = new tx_oelib_testingFramework('tx_seminars'); $systemFolderUid = $this->testingFramework->createSystemFolder(); $this->testingFramework->createTemplate($systemFolderUid, array('tstamp' => $GLOBALS['SIM_EXEC_TIME'], 'sorting' => 256, 'crdate' => $GLOBALS['SIM_EXEC_TIME'], 'cruser_id' => 1, 'title' => 'TEST', 'root' => 1, 'clear' => 3, 'include_static_file' => 'EXT:seminars/Configuration/TypoScript/')); $this->fixtureUid = $this->testingFramework->createRecord('tx_seminars_test', array('pid' => $systemFolderUid, 'title' => 'Test')); $this->fixture = new tx_seminars_tests_fixtures_OldModel_Testing($this->fixtureUid); }
protected function setUp() { $this->testingFramework = new tx_oelib_testingFramework('tx_seminars'); $fixtureUid = $this->testingFramework->createRecord('tx_seminars_organizers', array('title' => 'Test organizer', 'email' => '*****@*****.**')); $this->fixture = new tx_seminars_OldModel_Organizer($fixtureUid); $maximalFixtureUid = $this->testingFramework->createRecord('tx_seminars_organizers', array('title' => 'Test organizer', 'homepage' => 'http://www.test.com/', 'email' => '*****@*****.**', 'email_footer' => 'line 1' . LF . 'line 2', 'attendances_pid' => 99, 'description' => 'foo')); $this->maximalFixture = new tx_seminars_OldModel_Organizer($maximalFixtureUid); }
/** * @test */ public function getEntriesFromGeneralStoragePageForUseStoragePidNotAndStoragePidSetFindsRecordWithPidOtherThanStoragePid() { $sysFolderUid = $this->testingFramework->createSystemFolder(0, array('storage_pid' => $this->testingFramework->createSystemFolder())); $recordUid = $this->testingFramework->createRecord($this->testingTable, array('title' => 'foo record', 'pid' => 42)); $configuration = $this->fixture->getEntriesFromGeneralStoragePage(array('config' => array('itemTable' => $this->testingTable), 'row' => array('pid' => $sysFolderUid), 'items' => array())); self::assertTrue(in_array(array(0 => 'foo record', 1 => $recordUid, 2 => 'fooicon'), $configuration['items'])); }
/** * @test */ public function getRegistrationDataForDisabledPaymentMethodFieldReturnsEmptyString() { $selectedPaymentMethodUid = $this->testingFramework->createRecord('tx_seminars_payment_methods', array('title' => 'payment foo')); $this->testingFramework->createRelation('tx_seminars_seminars_payment_methods_mm', $this->seminarUid, $selectedPaymentMethodUid, 'payment_methods'); $this->fixture->setFakedFormValue('method_of_payment', $selectedPaymentMethodUid); self::assertEquals('', $this->fixture->getAllRegistrationDataForConfirmation()); }
/** * @test */ public function hasTopicIntegerForDateForPositiveIntegerInTopicReturnsTrue() { $topicRecordUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_TOPIC, 'credit_points' => 1)); $dateRecordUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_DATE, 'topic' => $topicRecordUid)); $date = new tx_seminars_seminarchild($dateRecordUid); self::assertTrue($date->hasTopicInteger('credit_points')); }
/** * @test */ public function showForNoEventUidDoesNotAddEventUidToCsvExportIcon() { $userUid = $this->testingFramework->createFrontEndUser('', array('name' => 'user_foo')); $eventUid = $this->testingFramework->createRecord('tx_seminars_seminars'); $this->testingFramework->createRecord('tx_seminars_attendances', array('seminar' => $eventUid, 'user' => $userUid)); self::assertNotContains('tx_seminars_pi2[eventUid]=', $this->fixture->show()); }
/** * @test */ public function getSeminarWithSeminarReturnsEventInstance() { $seminar = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Event')->getNewGhost(); $timeSlotUid = $this->testingFramework->createRecord('tx_seminars_timeslots', array('seminar' => $seminar->getUid())); /** @var tx_seminars_Model_TimeSlot $model */ $model = $this->fixture->find($timeSlotUid); self::assertTrue($model->getSeminar() instanceof tx_seminars_Model_Event); }
/** * @test */ public function relationToAdditionalPersonsReturnsPersonsFromDatabase() { $registrationUid = $this->testingFramework->createRecord('tx_seminars_attendances', array('additional_persons' => 1)); $personUid = $this->testingFramework->createFrontEndUser('', array('tx_seminars_registration' => $registrationUid)); /** @var tx_seminars_Model_Registration $model */ $model = $this->fixture->find($registrationUid); self::assertEquals((string) $personUid, $model->getAdditionalPersons()->getUids()); }
/** * @test */ public function getPlaceWithPlaceReturnsPlaceInstance() { $place = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Place')->getNewGhost(); $timeSlotUid = $this->testingFramework->createRecord('tx_seminars_timeslots', array('place' => $place->getUid())); /** @var tx_seminars_Model_TimeSlot $model */ $model = $this->fixture->find($timeSlotUid); self::assertTrue($model->getPlace() instanceof tx_seminars_Model_Place); }
public function testSetLimitWithLimitActuallyLimitsTheBag() { $this->testingFramework->createRecord('tx_seminars_test'); $this->testingFramework->createRecord('tx_seminars_test'); $this->fixture->setLimit('0, 1'); $bag = $this->fixture->build(); self::assertEquals(1, $bag->count()); }
/** * @test */ public function renderCanContainWaitingListRegistrations() { $this->fixture->setConfigurationValue('showRegistrationFieldsInRegistrationList', 'uid'); $this->createLogInAndRegisterFrontEndUser(); $feUserUid = $this->testingFramework->createFrontEndUser(); $secondRegistration = $this->testingFramework->createRecord('tx_seminars_attendances', array('seminar' => $this->seminarUid, 'user' => $feUserUid, 'registration_queue' => 1)); self::assertRegExp('/<td>' . $secondRegistration . '/s', $this->fixture->render()); }
/** * @test */ public function renderForValidPublicationHashRemovesPublicationHashFromEvent() { $this->fixture->init(array()); $eventUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('hidden' => 1, 'publication_hash' => '123456ABC')); $this->fixture->piVars['hash'] = '123456ABC'; $this->fixture->render(); self::assertTrue($this->testingFramework->existsRecord('tx_seminars_seminars', 'uid = ' . $eventUid . ' AND publication_hash = ""')); }
public function testRenderCreatesCategoryListContainingLinksToListPageLimitedToCategory() { $this->fixture->setConfigurationValue('listPID', $this->testingFramework->createFrontEndPage()); $categoryUid = $this->testingFramework->createRecord('tx_seminars_categories', array('title' => 'one category')); $eventUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('pid' => $this->systemFolderPid, 'title' => 'my title', 'begin_date' => $GLOBALS['SIM_EXEC_TIME'] + 1000, 'categories' => 1)); $this->testingFramework->createRelation('tx_seminars_seminars_categories_mm', $eventUid, $categoryUid); self::assertContains('tx_seminars_pi1[category]=' . $categoryUid, $this->fixture->render()); }
/** * @test */ public function getSkillsWithOneSkillReturnsOneSkill() { $speakerUid = $this->testingFramework->createRecord('tx_seminars_speakers'); $skill = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Skill')->getNewGhost(); $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_speakers', $speakerUid, $skill->getUid(), 'skills'); /** @var tx_seminars_Model_Speaker $model */ $model = $this->fixture->find($speakerUid); self::assertEquals($skill->getUid(), $model->getSkills()->getUids()); }
/** * @test */ public function getDependenciesForEventTopicWithOneDependencyReturnsOneDependency() { $uid = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_TOPIC)); $relatedUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_TOPIC)); $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $relatedUid, $uid, 'dependencies'); /** @var tx_seminars_Model_Event $model */ $model = $this->fixture->find($relatedUid); self::assertEquals($uid, $model->getDependencies()->getUids()); }
/** * @test */ public function getCheckboxesForSingleEventWithOneCheckboxReturnsOneCheckbox() { $uid = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_COMPLETE)); $checkbox = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Checkbox')->getNewGhost(); $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $uid, $checkbox->getUid(), 'checkboxes'); /** @var tx_seminars_Model_Event $model */ $model = $this->fixture->find($uid); self::assertEquals($checkbox->getUid(), $model->getCheckboxes()->getUids()); }
public function testLimitToExistingUsersDoesNotFindRegistrationWithDeletedUser() { $feUserUid = $this->testingFramework->createFrontEndUser(); $this->testingFramework->changeRecord('fe_users', $feUserUid, array('deleted' => 1)); $this->testingFramework->createRecord('tx_seminars_attendances', array('user' => $feUserUid)); $this->fixture->limitToExistingUsers(); $bag = $this->fixture->build(); self::assertTrue($bag->isEmpty()); }
/** * @test */ public function myEnteredEventViewForTimeFrameSetToCurrentShowsEventEndedInPast() { $editorGroupUid = $this->testingFramework->createFrontEndUserGroup(); $this->fixture->setConfigurationValue('what_to_display', 'my_entered_events'); $this->fixture->setConfigurationValue('eventEditorFeGroupID', $editorGroupUid); $this->fixture->setConfigurationValue('timeframeInList', 'current'); $feUserUid = $this->testingFramework->createAndLoginFrontEndUser($editorGroupUid); $this->testingFramework->createRecord('tx_seminars_seminars', array('pid' => $this->systemFolderPid, 'owner_feuser' => $feUserUid, 'hidden' => 1, 'title' => 'pastEvent', 'begin_date' => $GLOBALS['SIM_EXEC_TIME'] - 30, 'end_date' => $GLOBALS['SIM_EXEC_TIME'] - 20)); self::assertContains('pastEvent', $this->fixture->main('', array())); }
public function testLimitToEventsResultsInAnEmptyBagIfThereAreNoMatches() { $this->testingFramework->createRecord('tx_seminars_categories'); $eventUid1 = $this->testingFramework->createRecord('tx_seminars_seminars'); $categoryUid = $this->testingFramework->createRecord('tx_seminars_categories'); $this->testingFramework->createRelation('tx_seminars_seminars_categories_mm', $eventUid1, $categoryUid); $eventUid2 = $this->testingFramework->createRecord('tx_seminars_seminars'); $this->fixture->limitToEvents($eventUid2); $bag = $this->fixture->build(); self::assertTrue($bag->isEmpty()); }
/** * @test */ public function sendAdditionalNotificationUsesTheFirstOrganizerAsSenderIfEmailIsSentToTwoOrganizers() { $organizerUid = $this->testingFramework->createRecord('tx_seminars_organizers', array('title' => 'test organizer 2', 'email' => '*****@*****.**')); $this->testingFramework->createRelation('tx_seminars_seminars_organizers_mm', $this->seminarUid, $organizerUid); $this->testingFramework->changeRecord('tx_seminars_seminars', $this->seminarUid, array('organizers' => 2)); $registration = $this->createRegistration(); $this->fixture->sendAdditionalNotification($registration); $sentEmails = $this->mailer->getSentEmails(); self::assertArrayHasKey('*****@*****.**', $sentEmails[0]->getFrom()); self::assertArrayHasKey('*****@*****.**', $sentEmails[1]->getFrom()); }
/** * @test */ public function sendEmailForTwoRegistrationsCallsHookTwice() { $this->testingFramework->createRecord('tx_seminars_attendances', array('pid' => $this->dummySysFolderUid, 'seminar' => $this->eventUid, 'user' => $this->testingFramework->createFrontEndUser('', array('email' => '*****@*****.**', 'name' => 'foo User')))); $this->testingFramework->createRecord('tx_seminars_attendances', array('pid' => $this->dummySysFolderUid, 'seminar' => $this->eventUid, 'user' => $this->testingFramework->createFrontEndUser('', array('email' => '*****@*****.**', 'name' => 'foo User')))); $hook = $this->getMock('tx_seminars_Interface_Hook_BackEndModule'); $hook->expects(self::exactly(2))->method('modifyCancelEmail'); $hookClass = get_class($hook); $GLOBALS['T3_VAR']['getUserObj'][$hookClass] = $hook; $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['seminars']['backEndModule'][$hookClass] = $hookClass; $this->fixture->setPostData(array('action' => 'confirmEvent', 'isSubmitted' => '1', 'sender' => $this->organizerUid, 'subject' => 'foo', 'messageBody' => 'some message body')); $this->fixture->render(); }
/** * @test */ public function limitToEventSortsByRelationSorting() { $eventUid = $this->testingFramework->createRecord('tx_seminars_seminars', array('organizers' => 2)); $organizerUid1 = $this->testingFramework->createRecord('tx_seminars_organizers'); $organizerUid2 = $this->testingFramework->createRecord('tx_seminars_organizers'); $this->testingFramework->createRelation('tx_seminars_seminars_organizers_mm', $eventUid, $organizerUid2); $this->testingFramework->createRelation('tx_seminars_seminars_organizers_mm', $eventUid, $organizerUid1); $this->fixture->limitToEvent($eventUid); $bag = $this->fixture->build(); $bag->rewind(); self::assertEquals($organizerUid2, $bag->current()->getUid()); }