Пример #1
0
 /**
  * @expectedException        RuntimeException
  */
 public function testExceptionLoadBasket()
 {
     $this->setExpectedException('RuntimeException');
     $customer = $this->getMock('Sonata\\Component\\Customer\\CustomerInterface');
     $basketFactory = $this->getMock('Sonata\\Component\\Basket\\BasketFactoryInterface');
     $basketFactory->expects($this->once())->method('load')->will($this->returnCallback(function () {
         throw new \RuntimeException();
     }));
     $customerSelector = $this->getMock('Sonata\\Component\\Customer\\CustomerSelectorInterface');
     $customerSelector->expects($this->once())->method('get')->will($this->returnValue($customer));
     $loader = new Loader($basketFactory, $customerSelector);
     $loader->getBasket();
 }