コード例 #1
0
ファイル: _AkActiveRecord_2.php プロジェクト: joeymetal/v1
 public function Test_of_newRecord()
 {
     $User = new AkTestUser();
     $User->newRecord('last_name->', 'Ferrer', 'date->', '1978-06-16', 'expires_on->', '2120-06-16');
     $User->set('first_name', 'Bermi');
     $User->set('last_name', $User->get('last_name') . ' Martínez');
     $this->assertEqual($User->getAttributes(), array('id' => null, 'user_name' => null, 'first_name' => 'Bermi', 'last_name' => 'Ferrer Martínez', 'email' => null, 'country' => null, 'password' => '*********', 'created_at' => null, 'updated_at' => null, 'expires_on' => '2120-06-16'));
     $this->assertTrue($User->isNewRecord());
     $User = new AkTestUser();
     $User->addCombinedAttributeConfiguration('name', "%s %s", 'first_name', 'last_name');
     $User->newRecord(array('first_name' => 'Bermi', 'last_name' => 'Ferrer', 'date' => '1978-06-16', 'expires_on' => '2120-06-16'));
     $this->assertEqual($User->getAttributes(), array('id' => null, 'user_name' => null, 'first_name' => 'Bermi', 'last_name' => 'Ferrer', 'email' => null, 'country' => null, 'password' => '*********', 'created_at' => null, 'updated_at' => null, 'expires_on' => '2120-06-16', 'name' => 'Bermi Ferrer'));
     $this->assertFalse(empty($User->_newRecord));
 }
コード例 #2
0
ファイル: _AkActiveRecord_1.php プロジェクト: joeymetal/v1
 function Test_of_setAttributes()
 {
     $User = new AkTestUser();
     $attributes = array('first_name' => 'Bermi', 'password' => 'bermi', '_columns' => array(), '_test_private_var' => true);
     $User->setAttributes($attributes);
     $this->assertFalse(empty($User->_columns));
     $this->assertEqual($User->first_name, 'Bermi');
     $this->assertEqual($User->get('password'), '*********');
     $this->assertEqual($User->getAttributeBeforeTypeCast('password'), 'c6dd746a20f85fecb18591f29508d42d');
     $User->setAttributes($attributes, true);
     $this->assertFalse(!empty($User->_test_private_var));
 }