@@ 5-14 (lines=10) @@ | ||
2 | ||
3 | class InsertTest extends BridgeTestCase |
|
4 | { |
|
5 | public function testLastInsertedId() |
|
6 | { |
|
7 | $this->assertEquals(0, $this->bridge->insertId()); |
|
8 | ||
9 | $this->bridge->query('INSERT INTO test_table VALUES (100, "test insert")'); |
|
10 | $this->assertEquals(100, $this->bridge->insertId()); |
|
11 | ||
12 | $this->bridge->query('INSERT INTO test_table (testfield) VALUES ("test insert")'); |
|
13 | $this->assertEquals(101, $this->bridge->insertId()); |
|
14 | } |
|
15 | } |
@@ 14-23 (lines=10) @@ | ||
11 | $this->assertEquals(5, $this->bridge->affectedRows()); |
|
12 | } |
|
13 | ||
14 | public function testInsertAffectedRows() |
|
15 | { |
|
16 | $this->assertEquals(0, $this->bridge->affectedRows()); |
|
17 | ||
18 | $this->bridge->query("INSERT INTO test_table VALUES (100, 'test insert 100')"); |
|
19 | $this->assertEquals(1, $this->bridge->affectedRows()); |
|
20 | ||
21 | $this->bridge->query("INSERT INTO test_table VALUES (101, 'test insert 101'), (102, 'test insert 102')"); |
|
22 | $this->assertEquals(2, $this->bridge->affectedRows()); |
|
23 | } |
|
24 | ||
25 | public function testDeleteAffectedRows() |
|
26 | { |
|
@@ 25-34 (lines=10) @@ | ||
22 | $this->assertEquals(2, $this->bridge->affectedRows()); |
|
23 | } |
|
24 | ||
25 | public function testDeleteAffectedRows() |
|
26 | { |
|
27 | $this->assertEquals(0, $this->bridge->affectedRows()); |
|
28 | ||
29 | $this->bridge->query('DELETE FROM test_table WHERE id = 1'); |
|
30 | $this->assertEquals(1, $this->bridge->affectedRows()); |
|
31 | ||
32 | $this->bridge->query('DELETE FROM test_table WHERE id > 5'); |
|
33 | $this->assertEquals(5, $this->bridge->affectedRows()); |
|
34 | } |
|
35 | ||
36 | public function testNumRows() |
|
37 | { |