예제 #1
0
 public function test_delete_success()
 {
     $r = self::factory()->response->create();
     $response = new \WeBWorK\Server\Response($r);
     $this->assertTrue($response->exists());
     $this->assertTrue($response->delete());
     $response_2 = new \WeBWorK\Server\Vote($r);
     $this->assertFalse($response_2->exists());
 }
예제 #2
0
 public function test_response_count_cache_should_be_invalidated_on_deleted_response()
 {
     $q = self::factory()->question->create_and_get();
     $r = new \WeBWorK\Server\Response();
     $r->set_question_id($q->get_id());
     $r->save();
     $this->assertSame(1, $q->get_response_count());
     $r->delete();
     $this->assertSame(0, $q->get_response_count());
 }