Пример #1
0
 public function __construct()
 {
     parent::__construct();
     if (!UUID::is_valid($this->key)) {
         $this->key = UUID::v4();
     }
 }
 public function testExtendedTypes()
 {
     /* @var $result TestModelExtendedTypes */
     $this->markTestSkipped("ugh");
     $this->extended->blob_field = file_get_contents($_SERVER['SCRIPT_FILENAME']);
     $this->extended->decimal_field = 12345.6789;
     $this->extended->enum_field = "Yes";
     $this->extended->md5_field = md5($this->extended->blob_field);
     $this->extended->sha1_field = sha1($this->extended->blob_field);
     $this->extended->uuid_field = UUID::v4();
     $this->extended->string_with_length_field = "blah";
     $result = $this->extended->save();
     $this->assertEquals($this->extended->blob_field, $result->blob_field);
     $this->assertEquals($this->extended->decimal_field, $result->decimal_field);
     $this->assertEquals($this->extended->enum_field, $result->enum_field);
     $this->assertEquals($this->extended->md5_field, $result->md5_field);
     $this->assertEquals($this->extended->sha1_field, $result->sha1_field);
     $this->assertEquals($this->extended->uuid_field, $result->uuid_field);
     $this->assertEquals($this->extended->string_with_length_field, $result->string_with_length_field);
 }
Пример #3
0
 public function save($automatic_reload = true)
 {
     if (!$this->user_uuid) {
         $this->user_uuid = UUID::v4();
     }
     if (!$this->user_id) {
         TigerApp::log("New user created: {$this->username} / {$this->displayname} / {$this->email}");
     }
     return parent::save($automatic_reload);
 }