/** * @test * @expectedException \RuntimeException */ public function doesFindByUidThrowException() { $testUid = rand(1, 1000); $this->databaseMock->expects($this->once())->method('exec_SELECTgetSingleRow')->will($this->returnCallback(array($this, 'getSingleRowCallback'))); $this->getSingleRowCallbackReturnValue = array('uid' => $testUid, 'type' => uniqid('unknown')); $object = $this->fixture->findByUid($testUid); }
/** * Returns a specific collection referenced by uid. * * @param integer $uid * @return mixed */ public function render($uid) { if (null !== $uid) { /** @var \TYPO3\CMS\Core\Collection\AbstractRecordCollection $collection */ $collection = $this->collectionRepository->findByUid($uid); if (null !== $collection) { $collection->loadContents(); } return $collection; } return null; }
/** * Finds a record collection by uid. * * @todo the parent function throws already an exception if not found * @param integer $uid The uid to be looked up * @return NULL|\TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection * @throws \RuntimeException */ public function findByUid($uid) { $object = parent::findByUid($uid); if ($object === NULL) { throw new \RuntimeException('Could not find row with uid "' . $uid . '" in table "' . $this->table . '"', 1314354065); } return $object; }
/** * Finds a record collection by uid. * * @param int $uid The uid to be looked up * @return NULL|Collection\AbstractFileCollection * @throws ResourceDoesNotExistException */ public function findByUid($uid) { $object = parent::findByUid($uid); if ($object === null) { throw new ResourceDoesNotExistException('Could not find row with uid "' . $uid . '" in table "' . $this->table . '"', 1314354066); } return $object; }