/** * @test */ public function commitToDbCanCreateCheckboxesRelation() { $seminar = new tx_seminars_seminar($this->seminarUid); $checkboxesUid = $this->testingFramework->createRecord('tx_seminars_checkboxes'); $registration = new tx_seminars_registrationchild(0); $registration->setRegistrationData($seminar, 0, array('checkboxes' => array($checkboxesUid))); $registration->enableTestMode(); $this->testingFramework->markTableAsDirty('tx_seminars_attendances'); $this->testingFramework->markTableAsDirty('tx_seminars_attendances_checkboxes_mm'); self::assertTrue($registration->isOk()); self::assertTrue($registration->commitToDb()); self::assertSame(1, $this->testingFramework->countRecords('tx_seminars_attendances', 'uid=' . $registration->getUid()), 'The registration record cannot be found in the DB.'); self::assertSame(1, $this->testingFramework->countRecords('tx_seminars_attendances_checkboxes_mm', 'uid_local=' . $registration->getUid() . ' AND uid_foreign=' . $checkboxesUid), 'The relation record cannot be found in the DB.'); }
/** * @TODO: This is just a transitional test that can be removed once * createRegistration does not use the old registration model anymore. * * @test */ public function createRegistrationCreatesOldAndNewRegistrationModelForTheSameUid() { // Drops the non-saving mapper so that the registration mapper (once we // use it) actually saves the registration. tx_oelib_MapperRegistry::purgeInstance(); tx_oelib_MapperRegistry::getInstance()->activateTestingMode($this->testingFramework); $this->testingFramework->markTableAsDirty('tx_seminars_seminars'); $this->createAndLogInFrontEndUser(); $plugin = new tx_seminars_FrontEnd_DefaultController(); $plugin->cObj = $GLOBALS['TSFE']->cObj; $fixture = $this->getMock('tx_seminars_registrationmanager', array('notifyAttendee', 'notifyOrganizers', 'sendAdditionalNotification', 'setRegistrationData')); $registration = $fixture->createRegistration($this->seminar, array(), $plugin); $uid = $fixture->getRegistration()->getUid(); // @TODO: This line needs to be removed once createRegistration uses // the data mapper to save the registration. tx_oelib_db::delete('tx_seminars_attendances', 'uid = ' . $uid); self::assertSame($registration->getUid(), $fixture->getRegistration()->getUid()); }
public function testCreateMmRecordsWithCreatesSecondMmRecordWithSortingTwo() { $this->testingFramework->markTableAsDirty('tx_seminars_test_test_mm'); $this->fixture->createMmRecords('tx_seminars_test_test_mm', array(42, 31)); self::assertTrue($this->testingFramework->existsRecord('tx_seminars_test_test_mm', 'uid_local = ' . $this->fixtureUid . ' AND uid_foreign = 31 ' . 'AND sorting = 2')); }