/**
  * @test
  */
 public function renderWithOneElementListReturnsOneElementsTitleHtmlspecialchared()
 {
     $model = new tx_seminars_tests_fixtures_Model_TitledTestingModel();
     $model->setData(array('title' => '<test>Testing model</test>'));
     $this->list->add($model);
     self::assertSame(htmlspecialchars($model->getTitle()), $this->fixture->render($this->list));
 }
Beispiel #2
0
 /**
  * @test
  */
 public function attachRegistrationNotRemovesExistingRegistration()
 {
     $registrations = new tx_oelib_List();
     $oldRegistration = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Registration')->getNewGhost();
     $registrations->add($oldRegistration);
     $this->fixture->setRegistrations($registrations);
     $newRegistration = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Registration')->getLoadedTestingModel(array());
     $this->fixture->attachRegistration($newRegistration);
     self::assertTrue($this->fixture->getRegistrations()->hasUid($oldRegistration->getUid()));
 }
Beispiel #3
0
 /**
  * @test
  */
 public function makeListToFormidableListForListWithTwoElementsReturnsArrayWithTwoModels()
 {
     $targetGroup1 = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_TargetGroup')->getLoadedTestingModel(array());
     $targetGroup2 = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_TargetGroup')->getLoadedTestingModel(array());
     $list = new tx_oelib_List();
     $list->add($targetGroup1);
     $list->add($targetGroup2);
     self::assertEquals(2, count(tx_seminars_FrontEnd_EventEditor::makeListToFormidableList($list)));
 }
Beispiel #4
0
 /**
  * Returns an array of caption value pairs for formidable checkboxes.
  *
  * @param tx_oelib_List $models
  *        List of models to show in the checkboxes, may be empty
  *
  * @return array[] items as an array with the keys "caption" (for the title)
  *         and "value" (for the UID), will be empty if an empty model list
  *         was provided
  */
 public static function makeListToFormidableList(tx_oelib_List $models)
 {
     if ($models->isEmpty()) {
         return array();
     }
     $result = array();
     /** @var Tx_Oelib_Model $model */
     foreach ($models as $model) {
         $result[] = array('caption' => $model->getTitle(), 'value' => $model->getUid());
     }
     return $result;
 }
 /**
  * @test
  */
 public function setRegistrationDataForUnavailablePaymentMethodAndOneAvailableSetsAvailable()
 {
     $className = $this->createAccessibleProxyClass();
     /** @var tx_seminars_registrationmanager $fixture */
     $fixture = new $className();
     $paymentMethod = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_PaymentMethod')->getNewGhost();
     $paymentMethods = new tx_oelib_List();
     $paymentMethods->add($paymentMethod);
     $event = $this->getMock('tx_seminars_Model_Event', array('getAvailablePrices', 'getPaymentMethods'));
     $event->expects(self::any())->method('getAvailablePrices')->will(self::returnValue(array('regular' => 12)));
     $event->expects(self::any())->method('getPaymentMethods')->will(self::returnValue($paymentMethods));
     $registration = new tx_seminars_Model_Registration();
     /** @var tx_seminars_Model_Event $event */
     $registration->setEvent($event);
     $fixture->setRegistrationData($registration, array('method_of_payment' => $paymentMethod->getUid() + 1));
     self::assertSame($paymentMethod, $registration->getPaymentMethod());
 }
Beispiel #6
0
 /**
  * @test
  */
 public function getAuxiliaryRecordsFolderForTwoGroupsBothWithDifferentAuxiliaryRecordPidsReturnsOnlyOneOfThePids()
 {
     $group1 = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_BackEndUserGroup')->getLoadedTestingModel(array('tx_seminars_auxiliaries_folder' => 23));
     $group2 = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_BackEndUserGroup')->getLoadedTestingModel(array('tx_seminars_auxiliaries_folder' => 42));
     $groups = new tx_oelib_List();
     $groups->add($group1);
     $groups->add($group2);
     $this->fixture->setData(array('usergroup' => $groups));
     $eventFolder = $this->fixture->getAuxiliaryRecordsFolder();
     self::assertTrue($eventFolder == 23 || $eventFolder == 42);
 }
Beispiel #7
0
 /**
  * @test
  */
 public function hasDefaultOrganizersForNonEmptyDefaultOrganizersReturnsTrue()
 {
     $organizer = tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Organizer')->getNewGhost();
     $organizers = new tx_oelib_List();
     $organizers->add($organizer);
     $fixture = $this->getMock('tx_seminars_Model_FrontEndUser', array('getDefaultOrganizers'));
     $fixture->expects(self::any())->method('getDefaultOrganizers')->will(self::returnValue($organizers));
     self::assertTrue($fixture->hasDefaultOrganizers());
 }
 /**
  * @test
  */
 public function hasDefaultCategoriesForOneAssignedCategoryReturnsTrue()
 {
     $list = new tx_oelib_List();
     $list->add(tx_oelib_MapperRegistry::get('tx_seminars_Mapper_Category')->getNewGhost());
     $this->fixture->setData(array('tx_seminars_default_categories' => $list));
     self::assertTrue($this->fixture->hasDefaultCategories());
 }