Beispiel #1
0
 /**
  * @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;
 }
Beispiel #2
0
 public function testCanCompareDifferentUsers()
 {
     $user2 = new User("User02", "*****@*****.**");
     $this->assertFalse($this->testUser->equals($user2));
 }
Beispiel #3
0
 /**
  * @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));
 }