/** * @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_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()); }
/** * @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()); }
/** * @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()); }
/** * @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_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 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 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()); }
public function testAddSkillRelationCreatesRelations() { self::assertEquals(0, $this->testingFramework->countRecords('tx_seminars_speakers_skills_mm', 'uid_local=' . $this->fixture->getUid())); $this->addSkillRelation(array()); self::assertEquals(1, $this->testingFramework->countRecords('tx_seminars_speakers_skills_mm', 'uid_local=' . $this->fixture->getUid())); $this->addSkillRelation(array()); self::assertEquals(2, $this->testingFramework->countRecords('tx_seminars_speakers_skills_mm', 'uid_local=' . $this->fixture->getUid())); }
/** * @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 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 testCreateCategoryListWithConfigurationValueSetToBothUsesCommasAsSeparators() { $this->fixture->setConfigurationValue('categoriesInListView', 'both'); $this->testingFramework->createDummyFile('foo.gif'); $this->testingFramework->createDummyFile('foo2.gif'); $multipleCategories = array(99 => array('title' => 'foo', 'icon' => 'foo.gif'), 100 => array('title' => 'bar', 'icon' => 'foo2.gif')); self::assertRegExp('/foo.*,.*bar/', $this->fixture->createCategoryList($multipleCategories)); }
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 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); }
/** * @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 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 canViewRegistrationsListMessageWithLoginAndAccessDeniedReturnsAccessDeniedMessage() { $fixture = $this->getMock('tx_seminars_seminar', array('needsRegistration', 'canViewRegistrationsList'), array(), '', FALSE); $fixture->expects(self::any())->method('needsRegistration')->will(self::returnValue(TRUE)); $fixture->expects(self::any())->method('canViewRegistrationsList')->will(self::returnValue(FALSE)); $this->testingFramework->createFakeFrontEnd(); $this->testingFramework->createAndLoginFrontEndUser(); self::assertSame($fixture->translate('message_accessDenied'), $fixture->canViewRegistrationsListMessage('list_registrations', 'world')); }
/** * @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 getRegistrationDataForThemselvesSelectedAndSeparateAttendeesRecordsEnabledContainsEMailAddress() { $this->testingFramework->createAndLoginFrontEndUser('', array('name' => 'Jane Doe', 'email' => '*****@*****.**')); $fixture = new tx_seminars_FrontEnd_RegistrationForm(array('templateFile' => 'EXT:seminars/Resources/Private/Templates/FrontEnd/FrontEnd.html', 'showRegistrationFields' => 'attendees_names,registered_themselves', 'createAdditionalAttendeesAsFrontEndUsers' => TRUE), $GLOBALS['TSFE']->cObj); $fixture->setTestMode(); $event = new tx_seminars_seminar($this->seminarUid); $fixture->setSeminar($event); $fixture->setFakedFormValue('registered_themselves', '1'); self::assertContains('*****@*****.**', $fixture->getAllRegistrationDataForConfirmation()); }
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 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()); }
/** * @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 myEventsListCallsModifyListRowHook() { /** @var tx_seminars_Model_Event $event */ $event = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Event')->find($this->seminarUid); $this->testingFramework->createAndLoginFrontEndUser(); $hook = $this->getMock('tx_seminars_Interface_Hook_EventListView'); $hook->expects(self::once())->method('modifyListRow')->with($event, self::anything()); // We don't test for the second parameter (the template instance here) // because we cannot access it from the outside. $hookClass = get_class($hook); $GLOBALS['T3_VAR']['getUserObj'][$hookClass] = $hook; $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['seminars']['listView'][$hookClass] = $hookClass; $this->fixture->main('', array()); }
/** * @test */ public function limitToMissingRegistrationsLimitsOutputToMissingRegistrationsOnly() { $userUid = $this->testingFramework->createAndLoginFrontEndUser(); $this->testingFramework->changeRecord('tx_seminars_seminars', $this->seminarUid, array('object_type' => tx_seminars_Model_Event::TYPE_TOPIC)); $requiredEvent1 = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_TOPIC, 'title' => 'required_foo')); $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_DATE, 'topic' => $requiredEvent1)); $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $this->seminarUid, $requiredEvent1, 'requirements'); $requiredEvent2 = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_TOPIC, 'title' => 'required_bar')); $requiredDate2 = $this->testingFramework->createRecord('tx_seminars_seminars', array('object_type' => tx_seminars_Model_Event::TYPE_DATE, 'topic' => $requiredEvent2)); $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $this->seminarUid, $requiredEvent2, 'requirements'); $this->testingFramework->createRecord('tx_seminars_attendances', array('seminar' => $requiredDate2, 'user' => $userUid)); $this->fixture->setEvent(new tx_seminars_seminar($this->seminarUid)); $this->fixture->limitToMissingRegistrations(); self::assertNotContains('required_bar', $this->fixture->render()); }
/** * @test */ public function renderForEnabledCategoryCanPreselectTwoValues() { $this->fixture->setConfigurationValue('displaySearchFormFields', 'categories'); $eventUid = $this->testingFramework->createRecord('tx_seminars_seminars'); $categoryName1 = 'Category 1'; $categoryUid1 = $this->testingFramework->createRecord('tx_seminars_categories', array('title' => $categoryName1)); $categoryName2 = 'Category 2'; $categoryUid2 = $this->testingFramework->createRecord('tx_seminars_categories', array('title' => $categoryName2)); $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $eventUid, $categoryUid1, 'categories'); $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $eventUid, $categoryUid2, 'categories'); $this->fixture->piVars['categories'][] = (string) $categoryUid1; $this->fixture->piVars['categories'][] = (string) $categoryUid2; $output = $this->fixture->render(); self::assertContains($categoryUid1 . '" selected="selected">' . $categoryName1 . '</option>', $output); self::assertContains($categoryUid2 . '" selected="selected">' . $categoryName2 . '</option>', $output); }
protected function tearDown() { $this->testingFramework->cleanUp(); }
protected function tearDown() { $this->testingFramework->cleanUp(); tx_seminars_registrationmanager::purgeInstance(); }