/**
  * Handle attribute collection and return an associative array
  *
  * @param ParameterCollection $attributeCollection
  *
  * @return array  List of attributes
  */
 private function handleAttributes(ParameterCollection $attributeCollection)
 {
     $attributes = array();
     /** @var Parameter $attribute */
     foreach ($attributeCollection->toArray() as $attribute) {
         $attributes[$attribute->getKey()] = $attribute->getValue();
     }
     return $attributes;
 }
 public function testShouldSendTransactionalEmailAndReturnTrue()
 {
     $this->CCNotificationServiceMock->expects($this->once())->method('sendObject');
     $service = new CCManagerNotificationService($this->CCNotificationServiceMock);
     $transactionalEmailMock = $this->getMockBuilder(TransactionalEmail::CLASS_NAME)->disableOriginalConstructor()->getMock();
     $parameterCollection = new ParameterCollection();
     $parameterCollection->addParameterByKeyValue('encrypt', 'abc123');
     $parameterCollection->addParameterByKeyValue('random', '1234567890');
     $recipientCollection = new RecipientCollection();
     $recipientCollection->addRecipientByValue('*****@*****.**');
     $attributesCollection = new ParameterCollection();
     $transactionalEmailMock->expects($this->atLeastOnce())->method('getOptions')->willReturn($parameterCollection);
     $transactionalEmailMock->expects($this->atLeastOnce())->method('getRecipients')->willReturn($recipientCollection);
     $transactionalEmailMock->expects($this->atLeastOnce())->method('getAttributes')->willReturn($attributesCollection);
     $service->send($transactionalEmailMock);
 }
 public function testShouldUploadFileAndReturnTrue()
 {
     $this->CCBatchMemberServiceMock->expects($this->once())->method('uploadFileMerge');
     $service = new CCManagerBatchMemberService($this->CCBatchMemberServiceMock);
     $memberImportFileMock = $this->getMockBuilder(MemberFileImport::CLASS_NAME)->disableOriginalConstructor()->getMock();
     $columnCollection = $this->getMock(ColumnCollection::CLASS_NAME);
     $columnCollection->expects($this->atLeastOnce())->method('toArray')->willReturn(array());
     $mappingMock = $this->getMock(Mapping::CLASS_NAME);
     $mappingMock->expects($this->once())->method('getColumns')->willReturn($columnCollection);
     $parameterCollection = new ParameterCollection();
     $parameterCollection->addParameterByKeyValue('file', 'abc123');
     $parameterCollection->addParameterByKeyValue('criteria', 'LOWER(EMAIL)');
     $parameterCollection->addParameterByKeyValue('dateFormat', 'YYYY-mm-dd');
     $parameterCollection->addParameterByKeyValue('skipFirstLine', true);
     $parameterCollection->addParameterByKeyValue('mapping', $mappingMock);
     $memberImportFileMock->expects($this->atLeastOnce())->method('getOptions')->willReturn($parameterCollection);
     $service->uploadFile($memberImportFileMock);
 }
 /**
  * Add an option
  * 
  * @param string $key
  * @param string $value
  *
  * @return $this
  */
 public function addOption($key, $value)
 {
     $this->options->addParameterByKeyValue($key, $value);
     return $this;
 }