/** * @expectedException \Sonata\Component\Payment\PaymentNotFoundException * @expectedExceptionMessage Payment method with code 'not_existing' was not found */ public function testGetPaymentException() { $paymentPoolMethods = array('first method', 'second method'); $paymentPool = $this->getMockBuilder('Sonata\\Component\\Payment\\Pool')->getMock(); $paymentPool->expects($this->any())->method('getMethods')->will($this->returnValue($paymentPoolMethods)); $productPool = $this->getMockBuilder('Sonata\\Component\\Product\\Pool')->getMock(); $selector = new Selector($paymentPool, $productPool); $selector->getPayment('not_existing'); }