public function testRemove() { $card1 = new IdCard(); $card1->setRate(10); $card2 = new IdCard(); $card2->setRate(90); $box = new LuckyBox(); $box->add($card1); $box->add($card2); $box->remove($card1); $rp = new \ReflectionProperty($box, 'cards'); $rp->setAccessible(true); $this->assertEquals(array($card2), $rp->getValue($box)); $rp = new \ReflectionProperty($box, 'totalRate'); $rp->setAccessible(true); $this->assertEquals(90, $rp->getValue($box)); }