Beispiel #1
0
 /**
  */
 public function testGetSet()
 {
     $identity = new UserIdentity(null, null);
     $attributes = array('username' => 'u1', 'email' => 'e1', 'firstName' => 'f1', 'lastName' => 'l1');
     $identity->setAttributes($attributes);
     $this->assertEquals($attributes, $identity->getAttributes());
     $this->assertEquals($attributes['email'], $identity->getEmail());
     $identity->setId(800);
     $this->assertEquals(800, $identity->getId());
     $this->assertFalse($identity->save());
     $identity->setId(null);
     $this->assertTrue($identity->save());
     $this->assertEquals(5, $identity->getId());
     $this->assertEquals($attributes, $identity->getAttributes());
     $identity = UserIdentity::find(array('username' => 'u1'));
     $this->assertEquals(5, $identity->getId());
     $this->assertEquals($attributes, $identity->getAttributes());
     $identity->setAttributes(array('username' => null, 'password' => null));
     $this->assertFalse($identity->save());
 }