From b434c20c18a389521bb0a30fa7c0c025bb6dd50c Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Wed, 31 Oct 2012 16:51:36 +0100 Subject: Added unit test testinsertIfNotExistDontOverwrite. --- tests/lib/db.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/lib/db.php b/tests/lib/db.php index 5d30f6ac46c..ead4b19b38e 100644 --- a/tests/lib/db.php +++ b/tests/lib/db.php @@ -93,4 +93,41 @@ class Test_DB extends UnitTestCase { $this->assertTrue($result); $this->assertEqual($result->numRows(), '4'); } + + public function testinsertIfNotExistDontOverwrite() { + $fullname = 'fullname test'; + $uri = 'uri_1'; + $carddata = 'This is a vCard'; + + // Normal test to have same known data inserted. + $query = OC_DB::prepare('INSERT INTO *PREFIX*'.$this->table2.' (`fullname`, `uri`, `carddata`) VALUES (?, ?, ?)'); + $result = $query->execute(array($fullname, $uri, $carddata)); + $this->assertTrue($result); + $query = OC_DB::prepare('SELECT `fullname`, `uri`, `carddata` FROM *PREFIX*'.$this->table2.' WHERE `uri` = ?'); + $result = $query->execute(array($uri)); + $this->assertTrue($result); + $row = $result->fetchRow(); + $this->assertArrayHasKey('carddata', $row); + $this->assertEqual($row['carddata'], $carddata); + $this->assertEqual($result->numRows(), '1'); + + // Try to insert a new row + $result = OC_DB::insertIfNotExist('*PREFIX*'.$this->table2, + array( + 'fullname' => $fullname, + 'uri' => $uri, + )); + $this->assertTrue($result); + + $query = OC_DB::prepare('SELECT `fullname`, `uri`, `carddata` FROM *PREFIX*'.$this->table2.' WHERE `uri` = ?'); + $result = $query->execute(array($uri)); + $this->assertTrue($result); + $row = $result->fetchRow(); + $this->assertArrayHasKey('carddata', $row); + // Test that previously inserted data isn't overwritten + $this->assertEqual($row['carddata'], $carddata); + // And that a new row hasn't been inserted. + $this->assertEqual($result->numRows(), '1'); + + } } -- cgit v1.2.3 ion value='Temp_FopFontsForSVG'>Temp_FopFontsForSVG Apache XML Graphics FOP: https://github.com/apache/xmlgraphics-fopwww-data
aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java
blob: 0aec48b47411167c7d128395d3fedc761bf6a8a0 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119