/**
  * @param object $entity
  * @param string $resultType
  * @param string $scope
  * @return int|null
  */
 protected function getProcessedIdentifier($entity, $resultType, $scope = EntityPaginationManager::VIEW_SCOPE)
 {
     $entityIds = $this->storage->getEntityIds($entity, $scope);
     $entityId = null;
     switch ($resultType) {
         case self::LAST:
             $entityId = end($entityIds);
             break;
         case self::FIRST:
             $entityId = reset($entityIds);
             break;
         case self::PREVIOUS:
             $currentPosition = $this->storage->getCurrentPosition($entity, $scope);
             if (isset($entityIds[$currentPosition - 1])) {
                 $entityId = $entityIds[$currentPosition - 1];
             }
             break;
         case self::NEXT:
             $currentPosition = $this->storage->getCurrentPosition($entity, $scope);
             if (isset($entityIds[$currentPosition + 1])) {
                 $entityId = $entityIds[$currentPosition + 1];
             }
             break;
     }
     return $entityId;
 }
 /**
  * @param array $source
  * @param int $expected
  *
  * @dataProvider getCurrentPositionDataProvider
  */
 public function testGetCurrentPosition(array $source, $expected)
 {
     $this->setStorage($source['storage_data']);
     $this->doctrineHelper->expects($this->any())->method('getSingleEntityIdentifier')->with($this->entity)->will($this->returnValue($source['entity_id']));
     $result = $this->storage->getCurrentPosition($this->entity, $source['scope']);
     $this->assertSame($expected, $result);
 }