/** * Test get width. * * @dataProvider dataGetWeight */ public function testGetWeight(array $weights, $total) { $cartLines = new ArrayCollection([]); foreach ($weights as $weight) { $cartLine = $this->getMock('Elcodi\\Component\\Cart\\Entity\\Interfaces\\CartLineInterface'); $cartLine->method('getWeight')->will($this->returnValue($weight)); $cartLines->add($cartLine); } $cart = new Cart(); $cart->setCartLines($cartLines); $this->assertEquals($total, $cart->getWeight()); }