コード例 #1
0
 /**
  * Deletes a trash item.
  *
  * The corresponding content object will be removed
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to delete this trash item
  *
  * @param \eZ\Publish\API\Repository\Values\Content\TrashItem $trashItem
  */
 public function deleteTrashItem(TrashItem $trashItem)
 {
     if (false === $this->repository->canUser('content', 'remove', $trashItem)) {
         throw new UnauthorizedExceptionStub('What error code should be used?');
     }
     unset($this->trashItems[$trashItem->id], $this->locations[$trashItem->id]);
 }
コード例 #2
0
 /**
  * removes an url wildcard
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to remove url wildcards
  *
  * @param \eZ\Publish\API\Repository\Values\Content\UrlWildcard $urlWildcard the url wildcard to remove
  */
 public function remove(URLWildcard $urlWildcard)
 {
     if (false === $this->repository->canUser('content', 'edit', $urlWildcard)) {
         throw new UnauthorizedExceptionStub('What error code should be used?');
     }
     unset($this->wildcards[$urlWildcard->id]);
 }
コード例 #3
0
 /**
  * Helper method that initializes some default data from an existing legacy
  * test fixture.
  *
  * @return void
  */
 private function initFromFixture()
 {
     list($this->userGroups) = $this->repository->loadFixture('UserGroup');
     list($this->users) = $this->repository->loadFixture('User');
     // Set the default relations.
     $this->user2groups[10] = array(42 => true);
     $this->user2groups[14] = array(12 => true);
 }
コード例 #4
0
 /**
  * Helper method that initializes some default data from an existing legacy
  * test fixture.
  *
  * @return void
  */
 private function initFromFixture()
 {
     $this->groups = array();
     list($this->groups, $this->nextGroupId) = $this->repository->loadFixture('ObjectStateGroup');
     ++$this->nextGroupId;
     list($this->states, $this->groupStateMap, $this->objectStateMap, $this->nextStateId) = $this->repository->loadFixture('ObjectState', array('groups' => $this->groups));
     ++$this->nextStateId;
 }
コード例 #5
0
 /**
  * Helper method that initializes some default data from an existing legacy
  * test fixture.
  *
  * @return void
  */
 private function initFromFixture()
 {
     $this->locations = array();
     $this->nextLocationId = 0;
     list($locations, $this->nextLocationId) = $this->repository->loadFixture('Location');
     foreach ($locations as $location) {
         $this->locations[$location->id] = $location;
         $this->nextLocationId = max($this->nextLocationId, $location->id);
     }
 }
コード例 #6
0
 /**
  * Helper method that initializes some default data from an existing legacy
  * test fixture.
  *
  * @return void
  */
 private function initFromFixture()
 {
     $this->aliases = array();
     $this->nextAliasId = 0;
     list($aliases, $this->nextAliasId) = $this->repository->loadFixture('URLAlias');
     foreach ($aliases as $alias) {
         $this->aliases[$alias->id] = $alias;
         $this->nextAliasId = max($this->nextAliasId, $alias->id);
     }
 }
コード例 #7
0
 /**
  * Helper method that initializes some default data from an existing legacy
  * test fixture.
  *
  * @return void
  */
 private function initFromFixture()
 {
     $this->groups = array();
     $this->groupsById = array();
     list($contentTypeGroups, $this->nextGroupId) = $this->repository->loadFixture('ContentTypeGroup');
     ++$this->nextGroupId;
     foreach ($contentTypeGroups as $group) {
         $this->setGroup($group);
     }
     list($this->types, $this->nextTypeId, $this->nextFieldDefinitionId) = $this->repository->loadFixture('ContentType', array('groups' => $contentTypeGroups));
     ++$this->nextTypeId;
     ++$this->nextFieldDefinitionId;
 }
コード例 #8
0
 /**
  * Helper method that initializes some default data from an existing legacy
  * test fixture.
  *
  * @return void
  */
 private function initFromFixture()
 {
     list($this->languages, $this->codes, $this->nextId) = $this->repository->loadFixture('Language');
 }
コード例 #9
0
 /**
  * Returns a configured repository for testing.
  *
  * @param boolean $initializeFromScratch if the back end should be initialized
  *                                    from scratch or re-used
  * @return \eZ\Publish\API\Repository\Repository
  */
 public function getRepository($initializeFromScratch = true)
 {
     $repository = new RepositoryStub(__DIR__ . '/../_fixtures', isset($_ENV['backendVersion']) ? (int) $_ENV['backendVersion'] : 5);
     $repository->setCurrentUser(new \eZ\Publish\API\Repository\Tests\Stubs\Values\User\UserStub(array('content' => new \eZ\Publish\API\Repository\Tests\Stubs\Values\Content\ContentStub(array('id' => 14)))));
     return $repository;
 }
コード例 #10
0
 /**
  * Helper method that initializes some default data from an existing legacy
  * test fixture.
  *
  * @return void
  */
 private function initFromFixture()
 {
     list($this->roles, $this->nameToRoleId, $this->nextRoleId, $this->content2roles, $this->policies, $this->policyNextId, $this->role2policy, $this->roleLimitations) = $this->repository->loadFixture('Role');
 }
コード例 #11
0
 /**
  * Helper method that initializes some default data from an existing legacy
  * test fixture.
  *
  * @return void
  */
 private function initFromFixture()
 {
     list($this->sections, $this->identifiers, $this->assignedContents, $this->nextId) = $this->repository->loadFixture('Section');
 }
コード例 #12
0
 /**
  * Helper method that initializes some default data from an existing legacy
  * test fixture.
  *
  * @return void
  */
 private function initFromFixture()
 {
     list($this->contentInfo, $this->contentNextId, $this->versionInfo, $this->versionNextId, $this->content) = $this->repository->loadFixture('Content');
 }