Пример #1
0
 public function testWrite()
 {
     $log = new Log();
     $record = [];
     $record['channel'] = 'Channel';
     $record['level'] = 'Level';
     $record['level_name'] = 'LevelName';
     $record['message'] = 'Message';
     $record['datetime'] = 'Datetime';
     $record['context'] = 'Context';
     $record['extra'] = 'Extra';
     $this->subject->expects($this->once())->method('isHandling')->willReturn(true);
     $this->subject->expects($this->once())->method('processRecord')->willReturnArgument(0);
     $this->manager->expects($this->once())->method('create')->willReturn($log);
     $this->manager->expects($this->once())->method('save')->with($this->callback(function (LogInterface $log) {
         return 'Channel' == $log->getChannel();
     }), true);
     $this->subject->handle($record);
     //$this->assertEquals($record[''], $log->get);
     $this->assertEquals($record['channel'], $log->getChannel());
     $this->assertEquals($record['level'], $log->getLevel());
     $this->assertEquals($record['level_name'], $log->getLevelName());
     $this->assertEquals($record['message'], $log->getMessage());
     $this->assertEquals($record['datetime'], $log->getDatetime());
     $this->assertEquals($record['context'], $log->getContext());
     $this->assertEquals($record['extra'], $log->getExtra());
 }
 /**
  * @covers \Magento\BraintreeTwo\Gateway\Response\PayPalDetailsHandler::handle
  */
 public function testHandle()
 {
     $paymentData = $this->getPaymentDataObjectMock();
     $transaction = $this->getBraintreeTransaction();
     $subject = ['payment' => $paymentData];
     $response = ['object' => $transaction];
     $this->subjectReader->expects(self::once())->method('readPayment')->with($subject)->willReturn($paymentData);
     $this->subjectReader->expects(self::once())->method('readTransaction')->with($response)->willReturn($transaction);
     $this->subjectReader->expects(static::once())->method('readPayPal')->with($transaction)->willReturn($transaction->paypal);
     $this->payment->expects(static::exactly(2))->method('setAdditionalInformation');
     $this->payPalHandler->handle($subject, $response);
 }
Пример #3
0
 public function testHandle()
 {
     /** @var Record|\PHPUnit_Framework_MockObject_MockObject $recordToHandle */
     $recordToHandle = $this->getMockBuilder('Migration\\Resource\\Record')->setMethods(['getValue', 'setValue', 'getFields'])->disableOriginalConstructor()->getMock();
     /** @var Record $oppositeRecord|\PHPUnit_Framework_MockObject_MockObject */
     $oppositeRecord = $this->getMockBuilder('Migration\\Resource\\Record')->disableOriginalConstructor()->getMock();
     $fieldName = 'fieldname';
     $recordToHandle->expects($this->once())->method('getFields')->will($this->returnValue([$fieldName]));
     $recordToHandle->expects($this->once())->method('getValue')->with($fieldName)->will($this->returnValue('SELECT * FROM `source_some_document` LEFT JOIN `source_other_document`'));
     $recordToHandle->expects($this->once())->method('setValue')->with($fieldName, 'SELECT * FROM `pfx_dest_some_document` LEFT JOIN `pfx_dest_other_document`');
     $this->map->expects($this->any())->method('getDocumentMap')->willReturnMap([['source_some_document', MapInterface::TYPE_SOURCE, 'dest_some_document'], ['source_other_document', MapInterface::TYPE_SOURCE, 'dest_other_document'], ['source_ignored_document', MapInterface::TYPE_SOURCE, false]]);
     $this->source->expects($this->once())->method('getDocumentList')->will($this->returnValue(['source_some_document', 'source_other_document', 'source_ignored_document']));
     $this->source->expects($this->any())->method('addDocumentPrefix')->will($this->returnArgument(0));
     $this->handler->setField($fieldName);
     $this->handler->handle($recordToHandle, $oppositeRecord);
 }
Пример #4
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testHandleWithInvalidTotalCountCallbackThrowException()
 {
     $context = $this->createContext();
     $context->set('totalCount', function () {
         return false;
     });
     $this->handler->handle($context);
 }
 /**
  * @return void
  */
 public function testHandle()
 {
     $fieldNameRuleId = 'rule_id';
     $fieldNameForNormalization = 'website_ids';
     $idsForNormalization = '1,2,3';
     $normalizedData = [[$fieldNameRuleId => 1, $this->normalizationField => 1], [$fieldNameRuleId => 1, $this->normalizationField => 2], [$fieldNameRuleId => 1, $this->normalizationField => 3]];
     /** @var Record|\PHPUnit_Framework_MockObject_MockObject $recordToHandle */
     $recordToHandle = $this->getMockBuilder('Migration\\ResourceModel\\Record')->setMethods(['getValue', 'getFields'])->disableOriginalConstructor()->getMock();
     /** @var Record $oppositeRecord|\PHPUnit_Framework_MockObject_MockObject */
     $oppositeRecord = $this->getMockBuilder('Migration\\ResourceModel\\Record')->disableOriginalConstructor()->getMock();
     $recordToHandle->expects($this->once())->method('getFields')->willReturn([$fieldNameRuleId, $fieldNameForNormalization]);
     $recordToHandle->expects($this->any())->method('getValue')->willReturnMap([[$fieldNameRuleId, 1], [$fieldNameForNormalization, $idsForNormalization]]);
     $this->destination->expects($this->once())->method('clearDocument')->with($this->normalizationDocument)->willReturnSelf();
     $this->destination->expects($this->once())->method('saveRecords')->with($this->normalizationDocument, $normalizedData)->willReturnSelf();
     $this->handler->setField($fieldNameForNormalization);
     $this->handler->handle($recordToHandle, $oppositeRecord);
 }
Пример #6
0
 /**
  * @test
  * @dataProvider jumpUrlSecureFailsOnForbiddenFileLocationDataProvider
  * @expectedException \Exception
  * @expectedExceptionCode 1294585194
  * @param string $path
  * @param string $path
  */
 public function jumpUrlSecureFailsOnForbiddenFileLocation($path)
 {
     $this->jumpUrlHandler->expects($this->once())->method('isLocationDataValid')->with('')->will($this->returnValue(true));
     $hash = \TYPO3\CMS\Jumpurl\JumpUrlUtility::calculateHashSecure($path, '', '');
     $_GET['jumpurl'] = $path;
     $_GET['juSecure'] = '1';
     $_GET['juHash'] = $hash;
     $_GET['locationData'] = '';
     $this->jumpUrlHandler->canHandleCurrentUrl();
     $this->jumpUrlHandler->handle();
 }
 /**
  * @test
  */
 public function it_does_call_the_handle_method_of_AMQPPublisher()
 {
     $this->domainMessageNormalizer->expects($this->once())->method('normalize')->will($this->returnValue(new DomainEventStream([$this->domainMessage, $this->domainMessage])));
     $this->amqpPublisher->expects($this->exactly(2))->method('handle');
     $this->domainMessageNormalizerAMQPPublisherDecorator->handle($this->domainMessage);
 }
 public function testSendWithNormalUser()
 {
     $this->event->expects($this->once())->method('getUser')->willReturn($this->user);
     \Mail::shouldReceive('send')->once();
     $this->listener->handle($this->event);
 }