/** * @dataProvider canCaptureDataProvider * @param string $state * @param bool|null $canPaymentCapture * @param bool $expectedResult */ public function testCanCapture($state, $canPaymentCapture, $expectedResult) { $this->model->setState($state); if (null !== $canPaymentCapture) { $this->orderMock->expects($this->once())->method('getPayment')->willReturn($this->paymentMock); $this->paymentMock->expects($this->once())->method('canCapture')->willReturn($canPaymentCapture); } else { $this->orderMock->expects($this->never())->method('getPayment'); $this->paymentMock->expects($this->never())->method('canCapture'); } $this->assertEquals($expectedResult, $this->model->canCapture()); }