/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { $this->object = new sfShoppingCart(); // item 1 $item = new sfShoppingCartItem(); $item->setId(1); $item->setPrice(14.4); $item->setQuantity(8); $item->setWeight(14.5); $item->setClass('IStoreShoppingCartItem'); $this->object->addItem($item); // item 1 $item = new sfShoppingCartItem(); $item->setId(2); $item->setPrice(299.9); $item->setQuantity(3); $item->setWeight(8); $item->setClass('IStoreShoppingCartItem'); $this->object->addItem($item); }
/** * Test de la méthode qui modifie le poids d'un article */ public function testSetWeight() { $this->object->setWeight(20.5); $value = $this->object->getWeight(); $this->assertEquals($value, 20.5); }