/**
  * test permission
  *
  * @return void
  */
 public function testPermission()
 {
     $entity = new DocumentEntity();
     $entity->setUserType(DocumentEntity::USER_TYPE_GUEST);
     $guest = m::mock('Xpressengine\\Member\\Entities\\Guest');
     $guest->shouldReceive('getId')->andReturn('guest');
     $guest->shouldReceive('getDisplayName')->andReturn('guest');
     $this->assertTrue($entity->alterPerm($guest));
     $this->assertTrue($entity->deletePerm($guest));
     $entity->setUserType(DocumentEntity::USER_TYPE_USER);
     $entity->userId = 'id';
     $this->assertFalse($entity->alterPerm($guest));
     $this->assertFalse($entity->deletePerm($guest));
     $user = m::mock('Xpressengine\\Member\\Entities\\Database\\MemberEntity');
     $user->shouldReceive('getId')->andReturn('id');
     $user->shouldReceive('getDisplayName')->andReturn('name');
     $author = m::mock('Xpressengine\\Member\\Entities\\Database\\MemberEntity');
     $author->shouldReceive('getId')->andReturn('id_author');
     $author->shouldReceive('getDisplayName')->andReturn('name_author');
     $entity->setAuthor($user);
     $this->assertFalse($entity->alterPerm($author));
     $this->assertFalse($entity->deletePerm($author));
     $this->assertTrue($entity->alterPerm($user));
     $this->assertTrue($entity->deletePerm($user));
 }