blob: 6bcaeb91228d0481a9735ff80f2ce9381c6fbafc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
<?php
require_once(dirname(__FILE__).'/BaseGatewayTest.php');
/**
* @package System.Data.TableGateway
*/
class TableGatewayDeleteByPkTest extends BaseGatewayTest
{
function test_delete_by_1_pk()
{
$this->add_record1();
$id = $this->getGateway()->getLastInsertId();
$deleted = $this->getGateway()->deleteByPk($id);
$this->assertEqual(1, $deleted);
}
function test_delete_by_multiple_pk()
{
$this->add_record1();
$id1 = $this->getGateway()->getLastInsertId();
$this->add_record2();
$id2 = $this->getGateway()->getLastInsertId();
$deleted = $this->getGateway()->deleteByPk($id1, $id2);
$this->assertEqual(2, $deleted);
}
function test_delete_by_multiple_pk2()
{
$this->add_record1();
$id1 = $this->getGateway()->getLastInsertId();
$this->add_record2();
$id2 = $this->getGateway()->getLastInsertId();
$deleted = $this->getGateway()->deleteByPk(array($id1, $id2));
$this->assertEqual(2, $deleted);
}
function test_delete_by_multiple_pk3()
{
$this->add_record1();
$id1 = $this->getGateway()->getLastInsertId();
$this->add_record2();
$id2 = $this->getGateway()->getLastInsertId();
$deleted = $this->getGateway()->deleteByPk(array(array($id1), array($id2)));
$this->assertEqual(2, $deleted);
}
}
|