check type, assertgreaterthan

This commit is contained in:
Jörn Friedrich Dreyer 2013-07-09 13:17:25 +02:00 committed by Andreas Fischer
parent 05fa55f2eb
commit b8bd1e5a81
1 changed files with 6 additions and 4 deletions

View File

@ -74,14 +74,16 @@ class Test_DB extends PHPUnit_Framework_TestCase {
public function testLastInsertId() {
$query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (?,?)');
$result = OC_DB::executeAudited($query, array('insertid 1','uri_1'));
$result1 = OC_DB::executeAudited($query, array('insertid 1','uri_1'));
$id1 = OC_DB::insertid('*PREFIX*'.$this->table2);
$this->assertInternalType('int', $id1);
// we don't know the id we should expect, so insert another row
$query = OC_DB::prepare('INSERT INTO `*PREFIX*'.$this->table2.'` (`fullname`,`uri`) VALUES (?,?)');
$result = OC_DB::executeAudited($query, array('insertid 2','uri_2'));
$result2 = OC_DB::executeAudited($query, array('insertid 2','uri_2'));
$id2 = OC_DB::insertid('*PREFIX*'.$this->table2);
// now we can check if the two ids are in correct order
$this->assertEquals($id1+1, $id2);
$this->assertInternalType('int', $id2);
$this->assertGreaterThan($id1, $id2);
}
public function testinsertIfNotExist() {