Пример #1
0
 /**
  * @test
  */
 public function createRelationAndUpdateCounterWithBidirectionalRelationCreatesRecordInRelationTable()
 {
     $firstRecordUid = $this->subject->createRecord('tx_oelib_test');
     $secondRecordUid = $this->subject->createRecord('tx_oelib_test');
     $this->subject->createRelationAndUpdateCounter('tx_oelib_test', $firstRecordUid, $secondRecordUid, 'bidirectional');
     $count = $this->subject->countRecords('tx_oelib_test_article_mm', 'uid_local=' . $secondRecordUid . ' AND uid_foreign=' . $firstRecordUid);
     self::assertSame(1, $count);
 }
Пример #2
0
 /**
  * @test
  */
 public function limitToAgeForAgeZeroGivenFindsEventWithAgeLimits()
 {
     $targetGroupUid = $this->testingFramework->createRecord('tx_seminars_target_groups', array('minimum_age' => 5, 'maximum_age' => 15));
     $eventUid = $this->testingFramework->createRecord('tx_seminars_seminars');
     $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $eventUid, $targetGroupUid, 'target_groups');
     $this->fixture->limitToAge(0);
     $bag = $this->fixture->build();
     self::assertSame(1, $bag->count());
 }
Пример #3
0
 /**
  * @test
  */
 public function bidirectionalMNRelationsWithOneRelatedModelReturnsListWithRelatedModelWithData()
 {
     $uid = $this->testingFramework->createRecord('tx_oelib_test');
     $relatedUid = $this->testingFramework->createRecord('tx_oelib_test');
     $this->testingFramework->createRelationAndUpdateCounter('tx_oelib_test', $relatedUid, $uid, 'bidirectional');
     /** @var Tx_Oelib_Tests_Unit_Fixtures_TestingModel $model */
     $model = $this->subject->find($relatedUid);
     self::assertSame((string) $uid, $model->getBidirectional()->getUids());
 }
Пример #4
0
 /**
  * @test
  */
 public function saveForModelWithMNTableRelationSavesNumberOfRelatedRecords()
 {
     $uid = $this->testingFramework->createRecord('tx_oelib_test');
     $relatedUid1 = $this->testingFramework->createRecord('tx_oelib_test');
     $this->testingFramework->createRelationAndUpdateCounter('tx_oelib_test', $uid, $relatedUid1, 'related_records');
     $relatedUid2 = $this->testingFramework->createRecord('tx_oelib_test');
     $this->testingFramework->createRelationAndUpdateCounter('tx_oelib_test', $uid, $relatedUid2, 'related_records');
     /** @var Tx_Oelib_Tests_Unit_Fixtures_TestingModel $model */
     $model = $this->subject->find($uid);
     $model->setTitle('bar');
     $this->subject->save($model);
     self::assertTrue($this->testingFramework->existsRecord('tx_oelib_test', 'title = "bar" AND related_records = 2'));
 }