public function testDelete()
 {
     $attributes = array('user_id' => 3, 'first_name' => 'Lily', 'last_name' => 'Leo', 'email' => '*****@*****.**');
     UserProfileLBDBModel::model()->setKey(3)->fromArray($attributes)->save();
     $user = UserProfileLBDBModel::model()->get(3);
     $this->assertEquals('*****@*****.**', $user['email']);
     $bool = UserProfileLBDBModel::model()->delete(3);
     $this->assertTrue($bool);
     $user = UserProfileLBDBModel::model()->get(3);
     $this->assertFalse($user === array());
 }
 public function setUp()
 {
     $this->key = 100;
     $pdos = UserProfileLBDBModel::model()->pdos();
     $this->pdo = array_pop($pdos);
     if ($this->pdo instanceof \PDO) {
         $sql = "CREATE TABLE `tbl_user_profile` (\n  `id` bigint(20) unsigned NOT NULL,\n  `data` json NOT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
         $this->pdo->exec($sql);
         $demo_user_profile = array('user_id' => 1, 'first_name' => 'Davis', 'last_name' => 'Zeng', 'email' => '*****@*****.**');
         $id = 1;
         $data = json_encode($demo_user_profile);
         $sql = "INSERT INTO `tbl_user_profile` VALUES (:id, :data)";
         $stmt = $this->pdo->prepare($sql);
         $stmt->bindParam(':id', $id);
         $stmt->bindParam(':data', $data);
         $stmt->execute();
     } else {
         $this->assertTrue(false);
     }
 }
 /**
  *
  * @author: De-Wu Zeng <*****@*****.**>
  * @return MySQLSource
  */
 protected function source()
 {
     return new MySQLSource(UserProfileLBDBModel::model());
 }