Пример #1
0
 public function testExecuteAction()
 {
     $options = ['html' => '$.html', 'attribute' => '$.attribute'];
     $fakeContext = ['fake', 'things', 'are', 'here'];
     $this->contextAccessor->expects($this->once())->method('getValue')->with($this->equalTo($fakeContext), $this->equalTo('$.html'))->will($this->returnValue($html = '<html></html>'));
     $this->contextAccessor->expects($this->once())->method('setValue')->with($this->equalTo($fakeContext), $this->equalTo('$.attribute'), $this->equalTo($stripped = 'stripped'));
     $this->helper->expects($this->once())->method('purify')->with($this->equalTo($html))->will($this->returnValue($purified = 'purified'));
     $this->helper->expects($this->once())->method('stripTags')->with($this->equalTo($purified))->will($this->returnValue($stripped));
     $this->action->initialize($options);
     $this->action->execute($fakeContext);
 }
Пример #2
0
 public function testExecuteAction()
 {
     $email = new Email();
     $options = ['process_type' => 'demo', 'email' => '$.email', 'attribute' => '$.attribute'];
     $fakeContext = ['fake', 'things', 'are', 'here'];
     $mailboxes = [new Mailbox()];
     $this->contextAccessor->expects($this->at(0))->method('getValue')->with($this->equalTo($fakeContext), $this->equalTo('demo'))->will($this->returnValue('demo'));
     $this->contextAccessor->expects($this->at(1))->method('getValue')->with($this->equalTo($fakeContext), $this->equalTo('$.email'))->will($this->returnValue($email));
     $this->contextAccessor->expects($this->once())->method('setValue')->with($this->equalTo($fakeContext), $this->equalTo('$.attribute'), $this->equalTo($mailboxes));
     $this->repository->expects($this->once())->method('findBySettingsClassAndEmail')->with($this->equalTo('DemoProcessSettings'), $this->equalTo($email))->will($this->returnValue($mailboxes));
     $this->action->initialize($options);
     $this->action->execute($fakeContext);
 }
Пример #3
0
 public function testExecuteActionWithoutAttribute()
 {
     $options = ['email' => '$.email', 'target_entity' => '$.target_entity'];
     $fakeContext = ['fake', 'things', 'are', 'here'];
     $this->contextAccessor->expects($this->at(0))->method('getValue')->with($this->equalTo($fakeContext), $this->equalTo('$.email'))->will($this->returnValue($email = new Email()));
     $this->contextAccessor->expects($this->at(1))->method('getValue')->with($this->equalTo($fakeContext), $this->equalTo('$.target_entity'))->will($this->returnValue($target = new User()));
     $this->contextAccessor->expects($this->never())->method('setValue');
     $this->activityListChainProvider->expects($this->any())->method('getActivityListEntitiesByActivityEntity')->with($this->equalTo($email))->will($this->returnValue($list = new ActivityList()));
     $this->entityManager->expects($this->once())->method('persist')->with($this->equalTo($list));
     $this->emailActivityManager->expects($this->once())->method('addAssociation')->with($this->equalTo($email), $this->equalTo($target))->will($this->returnValue(true));
     $this->action->initialize($options);
     $this->action->execute($fakeContext);
 }