Exemplo n.º 1
0
 /**
  * @test
  */
 public function shouldCallStaticRegistryIfGatewayConfigNotFoundOnGetGateway()
 {
     $staticRegistryMock = $this->createRegistryMock();
     $staticRegistryMock->expects($this->once())->method('getGateway')->with('theGatewayName')->willReturn('theGateway');
     $staticRegistryMock->expects($this->never())->method('getGatewayFactory');
     $storageMock = $this->createStorageMock();
     $storageMock->expects($this->once())->method('findBy')->with(array('gatewayName' => 'theGatewayName'))->willReturn(null);
     $registry = new DynamicRegistry($storageMock, $staticRegistryMock);
     $this->assertSame('theGateway', $registry->getGateway('theGatewayName'));
 }
Exemplo n.º 2
0
 /**
  * @test
  *
  * @expectedException \Payum\Core\Exception\InvalidArgumentException
  * @expectedExceptionMessage Gateway "theGatewayName" does not exist.
  */
 public function throwIfGatewayConfigNotFoundOnGetGateway()
 {
     $gatewayFactoryRegistry = $this->createGatewayFactoryRegistryMock();
     $gatewayFactoryRegistry->expects($this->never())->method('getGatewayFactory');
     $storageMock = $this->createStorageMock();
     $storageMock->expects($this->once())->method('findBy')->with(array('gatewayName' => 'theGatewayName'))->willReturn(null);
     $registry = new DynamicRegistry($storageMock, $gatewayFactoryRegistry);
     $registry->setBackwardCompatibility(false);
     $registry->getGateway('theGatewayName');
 }