/** * @covers ::submitConfigurationForm */ public function testSubmitConfigurationForm() { $amount = mt_rand(); $currency_code = $this->randomMachineName(3); $description = $this->randomMachineName(); $name = $this->randomMachineName(); $payment_id = mt_rand(); $quantity = mt_rand(); $form = array('#parents' => array('foo', 'bar')); $form_state = $this->getMock(FormStateInterface::class); $form_state->expects($this->atLeastOnce())->method('getValues')->willReturn(array('foo' => array('bar' => array('amount' => array('amount' => $amount, 'currency_code' => $currency_code), 'description' => $description, 'name' => $name, 'payment_id' => $payment_id, 'quantity' => $quantity)))); $this->sut->submitConfigurationForm($form, $form_state); $this->assertSame($amount, $this->sut->getAmount()); $this->assertSame($currency_code, $this->sut->getCurrencyCode()); $this->assertSame($description, $this->sut->getDescription()); $this->assertSame($name, $this->sut->getName()); $this->assertSame($quantity, $this->sut->getQuantity()); }
/** * @covers ::setQuantity * @covers ::getQuantity */ public function testGetQuantity() { $quantity = 7.7; $this->assertSame($this->sut, $this->sut->setQuantity($quantity)); $this->assertSame($quantity, $this->sut->getQuantity()); }