public function test_set_post_date()
 {
     $r = self::factory()->response->create();
     $response = new \WeBWorK\Server\Response($r);
     $new_date = '2015-05-05 05:05:05';
     $response->set_post_date($new_date);
     $this->assertTrue($response->save());
     $response2 = new \WeBWorK\Server\Response($r);
     $this->assertSame($new_date, $response2->get_post_date());
 }
 public function create_object($args)
 {
     $args['post_type'] = 'webwork_response';
     $post_id = parent::create_object($args);
     if (!$post_id || is_wp_error($post_id)) {
         return $post_id;
     }
     $response = new \WeBWorK\Server\Response($post_id);
     $is_answer = isset($args['is_answer']) ? (bool) $args['is_answer'] : false;
     $response->set_is_answer($is_answer);
     $question_id = isset($args['question_id']) ? (int) $args['question_id'] : false;
     if ($question_id) {
         $response->set_question_id($question_id);
     }
     if (isset($args['post_date'])) {
         $response->set_post_date($args['post_date']);
     }
     $response->save();
     return $post_id;
 }