/** * @covers ::save */ public function testSave() { $form_state = $this->getMock(FormStateInterface::class); $form_state->expects($this->once())->method('setRedirect')->with('entity.payment_status.collection'); /** @var \Drupal\payment\Entity\PaymentStatus\PaymentStatusForm|\PHPUnit_Framework_MockObject_MockObject $form */ $form = $this->getMockBuilder(PaymentStatusForm::class)->setConstructorArgs(array($this->stringTranslation, $this->paymentStatusStorage, $this->pluginSelectorManager, $this->pluginTypeManager))->setMethods(array('copyFormValuesToEntity'))->getMock(); $form->setEntity($this->paymentStatus); $this->paymentStatus->expects($this->once())->method('save'); $form->save([], $form_state); }