/**
  * Displays a form to create a new Product entity.
  *
  * @Template()
  * @Secure(roles="ROLE_USER")
  */
 public function newAction()
 {
     $entity = new Product();
     $entity->setUnity('pièce');
     $entity->setDiscountSupplier(0);
     $entity->setExpenseRatio(10);
     $entity->setShipping(0);
     $entity->setUnitPrice(0);
     $form = $this->createNewForm($entity);
     return array('entity' => $entity, 'form' => $form->createView());
 }
 /**
  * @dataProvider getPurchases
  * @param float $p
  * @param float $ds
  * @param float $er
  * @param float $s
  * @param float $res
  */
 public function testCalcs($p, $ds, $er, $s, $pp, $up, $m, $c)
 {
     $this->entity->setPurchase($p);
     $this->entity->setDiscountSupplier($ds);
     $this->entity->setExpenseRatio($er);
     $this->entity->setShipping($s);
     $this->assertEquals($pp, $this->entity->getPurchasePrice());
     $this->entity->setUnitPrice($up);
     $this->assertEquals($m, $this->entity->getMargin());
     $this->assertEquals($c, $this->entity->getCoef());
     $this->assertTrue($this->entity->isCoefPositive());
 }