コード例 #1
0
ファイル: ItemTest.php プロジェクト: siwapp/siwapp-sf3
 public function testGetGrossAmount()
 {
     $item = new Item();
     $tax = new Tax();
     $tax->setValue(20);
     $item->setUnitaryCost(80);
     $item->setQuantity(1);
     $item->addTax($tax);
     $this->assertEquals(96, $item->getGrossAmount());
 }
コード例 #2
0
 protected function importTaxes(\PDO $dbh, EntityManager $em)
 {
     $count = 0;
     $sth = $dbh->prepare('SELECT * FROM tax');
     $sth->execute();
     foreach ($sth->fetchAll(\PDO::FETCH_ASSOC) as $row) {
         $tax = new Tax();
         $tax->setName($row['name']);
         $tax->setValue($row['value']);
         $tax->setActive($row['active']);
         $tax->setIsDefault($row['is_default']);
         $em->persist($tax);
         $this->mapping['taxes'][$row['id']] = $tax;
         $count++;
     }
     return $count;
 }