/** * @param Money $price * @param User $bidder */ public function addBid(Money $price, User $bidder) { if ($this->owner->equals($bidder)) { throw new InvalidArgumentException("You may not bid on your own auction"); } if (!$this->currentPrice->isLessThan($price)) { throw new InvalidArgumentException("Your bid must be higher than the current"); } if ($this->wasEnded()) { throw new LogicException("You may not bid on a ended auction"); } $this->currentPrice = $price; }
public function testCanCompareDifferentUsers() { $user2 = new User("User02", "*****@*****.**"); $this->assertFalse($this->testUser->equals($user2)); }
/** * @covers EMongoDocument::equals */ function testEquals() { $c = new User(); $c->username = '******'; $this->assertTrue($c->save()); $d = User::model()->findOne(array('username' => 'sammaye')); $this->assertTrue($c->equals($d)); }