Beispiel #1
0
 /**
  * @param Invoice $invoice
  * @return array
  */
 protected function getColumns(Invoice $invoice)
 {
     $columns = array();
     foreach ($this->availableColumns as $column) {
         foreach ($invoice->getLineItems() as $lineItem) {
             $getMethod = 'get' . strtoupper($column[0]) . substr($column, 1);
             if (!is_null($lineItem->{$getMethod}())) {
                 $columns[$column] = $column;
                 continue 2;
                 // To next column
             }
         }
     }
     return $columns;
 }
Beispiel #2
0
 public function testRound()
 {
     bcscale(10);
     $invoice = new Invoice();
     $invoice->setCurrency('EUR', 2);
     $this->assertEquals('1.25', $invoice->round('1.254'));
     $this->assertEquals('1.26', $invoice->round('1.255'));
     $this->assertEquals('1.26', $invoice->round('1.256'));
     $invoice->setCurrency('JPY', 0);
     $this->assertEquals('125', $invoice->round('125.4'));
     $this->assertEquals('126', $invoice->round('125.5'));
     $this->assertEquals('126', $invoice->round('125.6'));
 }