Beispiel #1
0
 public function testGettersSetters()
 {
     $invoice = new Invoice();
     $this->assertTrue($invoice === $invoice->setPriceType(Invoice::PRICE_GROSS));
     $this->assertEquals(Invoice::PRICE_GROSS, $invoice->getPriceType());
     $this->assertTrue($invoice === $invoice->setCurrency('EUR'));
     $this->assertEquals('EUR', $invoice->getCurrency());
     $this->assertEquals(2, $invoice->getPrecision());
     $this->assertTrue($invoice === $invoice->setCurrency('JPY', 0));
     $this->assertEquals('JPY', $invoice->getCurrency());
     $this->assertEquals(0, $invoice->getPrecision());
     $address = array('imos GmbH', 'Alfons-Feifel-Str. 9', '73037 Göppingen');
     $this->assertTrue($invoice === $invoice->setCustomerAddress($address));
     $this->assertEquals($address, $invoice->getCustomerAddress());
     $this->assertTrue($invoice === $invoice->setCustomerNumber('99999'));
     $this->assertEquals('99999', $invoice->getCustomerNumber());
     $this->assertTrue($invoice === $invoice->setInvoiceNumber('RE-12345'));
     $this->assertEquals('RE-12345', $invoice->getInvoiceNumber());
     $this->assertTrue($invoice === $invoice->setInvoiceDate(new DateTime('2016-01-01')));
     $this->assertEquals(new DateTime('2016-01-01'), $invoice->getInvoiceDate());
     $this->assertTrue($invoice === $invoice->setDueDate(new DateTime('2016-02-01')));
     $this->assertEquals(new DateTime('2016-02-01'), $invoice->getDueDate());
     $this->assertTrue($invoice === $invoice->setBillingPeriod(DateRange::create('2016-01-01', '2016-02-01')));
     $this->assertEquals(DateRange::create('2016-01-01', '2016-02-01'), $invoice->getBillingPeriod());
     $this->assertTrue($invoice === $invoice->setCommission('Partner 1'));
     $this->assertEquals('Partner 1', $invoice->getCommission());
     $this->assertTrue($invoice === $invoice->clearTaxIds());
     $this->assertTrue($invoice === $invoice->addTaxId('Ust-ID', 'DE999999999'));
     $this->assertTrue($invoice === $invoice->addTaxId('Steuernummer', '12345 / 67890'));
     $this->assertEquals(array(array('label' => 'Ust-ID', 'value' => 'DE999999999'), array('label' => 'Steuernummer', 'value' => '12345 / 67890')), $invoice->getTaxIds());
     $this->assertTrue($invoice === $invoice->setPaymentTerms('30 days strictly net'));
     $this->assertEquals('30 days strictly net', $invoice->getPaymentTerms());
     $this->assertTrue($invoice === $invoice->clearExtraInfo());
     $this->assertTrue($invoice === $invoice->addExtraInfo('Payable by bank transfer.'));
     $this->assertTrue($invoice === $invoice->addExtraInfo('IBAN: DE99 1234 5678 9012 3456 78'));
     $this->assertEquals(array('Payable by bank transfer.', 'IBAN: DE99 1234 5678 9012 3456 78'), $invoice->getExtraInfo());
     $item1 = new LineItem();
     $item2 = new LineItem();
     $this->assertTrue($invoice === $invoice->clearLineItems());
     $this->assertTrue($invoice === $invoice->addLineItem($item1));
     $this->assertTrue($invoice === $invoice->addLineItem($item2));
     $result = $invoice->getLineItems();
     $this->assertCount(2, $result);
     $this->assertTrue($item1 === $result[0]);
     $this->assertTrue($item2 === $result[1]);
 }
Beispiel #2
0
 /**
  * @expectedException \Exception
  */
 public function testNegative()
 {
     DateRange::create('2000-02-01', '2000-01-01');
 }