Exemplo n.º 1
0
 public function testGetMethodInstanceRequestedMethod()
 {
     $code = 'unreal_method';
     $this->info->setData('method', $code);
     $methodInstance = $this->getMockBuilder('Magento\\Payment\\Model\\MethodInterface')->disableOriginalConstructor()->setMethods(['setInfoInstance', 'getCode', 'getFormBlockType', 'getTitle'])->getMock();
     $this->paymentHelperMock->expects($this->once())->method('getMethodInstance')->with($code)->will($this->returnValue($methodInstance));
     $methodInstance->expects($this->once())->method('setInfoInstance')->with($this->info);
     $this->assertSame($methodInstance, $this->info->getMethodInstance());
     // as the method is already stored at Info, check that it's not initialized again
     $this->assertSame($methodInstance, $this->info->getMethodInstance());
 }
Exemplo n.º 2
0
 public function testInitAdditionalInformationWithUnserialize()
 {
     $data = serialize(['key1' => 'data1', 'key2' => 'data2']);
     $this->info->setData('additional_information', $data);
     $this->assertEquals(unserialize($data), $this->info->getAdditionalInformation());
 }