示例#1
0
 /**
  * Test checking for non-default values.
  * @see http://propel.phpdb.org/trac/ticket/331
  */
 public function testHasOnlyDefaultValues()
 {
     $emp = new BookstoreEmployee();
     $emp->setName(md5(microtime()));
     $acct2 = new BookstoreEmployeeAccount();
     $acct = new BookstoreEmployeeAccount();
     $acct->setBookstoreEmployee($emp);
     $acct->setLogin("foo");
     $acct->setPassword("bar");
     $acct->save();
     $this->assertFalse($acct->isModified(), "Expected BookstoreEmployeeAccount NOT to be modified after save().");
     $acct->setEnabled(true);
     $acct->setPassword($acct2->getPassword());
     $this->assertTrue($acct->isModified(), "Expected BookstoreEmployeeAccount to be modified after setting default values.");
     $this->assertTrue($acct->hasOnlyDefaultValues(), "Expected BookstoreEmployeeAccount to not have only default values.");
     $acct->setPassword("bar");
     $this->assertFalse($acct->hasOnlyDefaultValues(), "Expected BookstoreEmployeeAccount to have at one non-default value after setting one value to non-default.");
     // Test a default date/time value
     $r = new Review();
     $r->setReviewDate(new DateTime("now"));
     $this->assertFalse($r->hasOnlyDefaultValues());
 }