Beispiel #1
0
 public function testGetReversedData()
 {
     $mockOne = $this->getMock('Geocoder\\Provider\\ProviderInterface');
     $mockOne->expects($this->once())->method('getReversedData')->will($this->returnCallback(function () {
         throw new \Exception();
     }));
     $mockTwo = $this->getMock('Geocoder\\Provider\\ProviderInterface');
     $mockTwo->expects($this->once())->method('getReversedData')->with(array('11', '22'))->will($this->returnValue(array('foo' => 'bar')));
     $chain = new ChainProvider(array($mockOne, $mockTwo));
     $this->assertEquals(array('foo' => 'bar'), $chain->getReversedData(array('11', '22')));
 }
 public function testChainProviderReverseThrowsChainNoResultException()
 {
     $mockOne = $this->getMock('Geocoder\\Provider\\ProviderInterface');
     $mockOne->expects($this->exactly(2))->method('getReversedData')->will($this->returnCallback(function () {
         throw new \Exception();
     }));
     $chain = new ChainProvider(array($mockOne, $mockOne));
     try {
         $chain->getReversedData(array('11', '22'));
     } catch (ChainNoResultException $e) {
         $this->assertCount(2, $e->getExceptions());
     }
 }