/**
  * action sync
  *
  * @param \Aijko\SharepointConnector\Domain\Model\Mapping\Lists $list
  * @return void
  */
 public function syncAction(\Aijko\SharepointConnector\Domain\Model\Mapping\Lists $list)
 {
     $GLOBALS['typo3CacheManager']->flushCachesByTag('spc_list_attributes');
     $sharepointAttributes = $this->sharepointListsRepository->findAttributesByListIdentifier($list->getSharepointListIdentifier());
     $typo3ListAttributes = $list->getAttributes();
     if ($sharepointAttributes) {
         // Sync sharepoint attributes with TYPO3 attributes
         $newAttributes = \Aijko\SharepointConnector\Utility\Attribute::syncAttributesAndFindAllNewOnes($sharepointAttributes, $typo3ListAttributes);
         $this->view->assign('newAttributes', $newAttributes);
         // Sync TYPO3 attributes with sharepoint attributes to find out all deprecated attributes
         $deprecatedAttributes = \Aijko\SharepointConnector\Utility\Attribute::syncAttributesToFindDeprecatedAttributes($sharepointAttributes, $typo3ListAttributes);
         if (count($deprecatedAttributes) > 0) {
             foreach ($deprecatedAttributes as $deprecatedAttribute) {
                 $this->mappingAttributeRepository->update($deprecatedAttribute);
             }
         }
         // Sync TYPO3 attributes with sharepoint attributes to find out all renamed attributes
         $renamedAttributes = \Aijko\SharepointConnector\Utility\Attribute::syncAttributesToFindRenamedAttributes($sharepointAttributes, $typo3ListAttributes, $this->mappingAttributeRepository);
         if (count($renamedAttributes) > 0) {
             foreach ($renamedAttributes as $renamedAttribute) {
                 $this->mappingAttributeRepository->update($renamedAttribute);
             }
         }
     }
     $this->view->assign('list', $list);
 }
 /**
  * @test
  */
 public function isARenamedAttributeAvailableAfterSync()
 {
     $sharepointListAttributes = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
     $sharepointListAttributeFirstName = $this->getMock('Aijko\\SharepointConnector\\Domain\\Model\\Mapping\\Attribute');
     $sharepointListAttributeFirstName->expects($this->any())->method('getSharepointFieldName')->will($this->returnValue('FirstName'));
     $sharepointListAttributeFirstName->expects($this->any())->method('getSharepointDisplayName')->will($this->returnValue('FirstNameWithNewDisplayname'));
     $sharepointListAttributes->attach($sharepointListAttributeFirstName);
     $typo3ListAttributes = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
     $typo3ListAttributeFirstName = $this->getMock('Aijko\\SharepointConnector\\Domain\\Model\\Mapping\\Attribute');
     $typo3ListAttributeFirstName->expects($this->any())->method('getSharepointFieldName')->will($this->returnValue('FirstName'));
     $typo3ListAttributeFirstName->expects($this->once())->method('getSharepointDisplayName')->will($this->returnValue('FirstName'));
     $typo3ListAttributeFirstName->expects($this->once())->method('setStatus')->will($this->returnValue(\Aijko\SharepointConnector\Domain\Model\Mapping\Attribute::STATUS_SYNC_RENAMED));
     $typo3ListAttributeFirstName->expects($this->once())->method('getStatus')->will($this->returnValue(\Aijko\SharepointConnector\Domain\Model\Mapping\Attribute::STATUS_SYNC_RENAMED));
     $typo3ListAttributes->attach($typo3ListAttributeFirstName);
     $renamedAttributes = \Aijko\SharepointConnector\Utility\Attribute::syncAttributesToFindRenamedAttributes($sharepointListAttributes, $typo3ListAttributes);
     $this->assertSame(\Aijko\SharepointConnector\Domain\Model\Mapping\Attribute::STATUS_SYNC_RENAMED, $renamedAttributes[0]->getStatus());
 }