예제 #1
0
파일: MysqlTest.php 프로젝트: vtk13/lib-sql
 public function testInsertDelete()
 {
     $rows = $this->db->insert('test_users', array('username' => 'user4', 'password' => 'password'));
     $this->assertEquals(1, $rows);
     $this->assertGreaterThan(3, $this->db->insertId());
     $row = $this->db->selectRow('SELECT * FROM test_users WHERE username="******"');
     $this->assertEquals('user4', $row['username']);
     $this->assertEquals('password', $row['password']);
     $rows = $this->db->query('DELETE FROM test_users WHERE username="******"');
     $this->assertEquals(1, $rows);
     $count = $this->db->selectValue("SELECT COUNT(*) FROM test_users WHERE username='******'");
     $this->assertEquals(0, $count);
 }