@@ -53,6 +53,10 @@ |
||
53 | 53 | $this->assertIsDepSection($ds[1], 2, 5); |
54 | 54 | } |
55 | 55 | |
56 | + /** |
|
57 | + * @param integer $dep_id |
|
58 | + * @param integer $sec_id |
|
59 | + */ |
|
56 | 60 | function assertIsDepSection($dep, $dep_id, $sec_id) |
57 | 61 | { |
58 | 62 | $this->assertTrue($dep instanceof DepSections); |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | Prado::using('System.Data.ActiveRecord.TActiveRecord'); |
3 | -require_once(dirname(__FILE__).'/records/DepartmentRecord.php'); |
|
4 | -require_once(dirname(__FILE__).'/records/DepSections.php'); |
|
3 | +require_once(dirname(__FILE__) . '/records/DepartmentRecord.php'); |
|
4 | +require_once(dirname(__FILE__) . '/records/DepSections.php'); |
|
5 | 5 | |
6 | 6 | class FindByPksTestCase extends UnitTestCase |
7 | 7 | { |
8 | 8 | function setup() |
9 | 9 | { |
10 | - $conn = new TDbConnection('pgsql:host=localhost;dbname=test', 'test','test'); |
|
10 | + $conn = new TDbConnection('pgsql:host=localhost;dbname=test', 'test', 'test'); |
|
11 | 11 | TActiveRecordManager::getInstance()->setDbConnection($conn); |
12 | 12 | } |
13 | 13 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | function test_find_by_pks() |
29 | 29 | { |
30 | - $deps = DepartmentRecord::finder()->findAllByPks(1,2,4); |
|
30 | + $deps = DepartmentRecord::finder()->findAllByPks(1, 2, 4); |
|
31 | 31 | $this->assertEqual(count($deps), 3); |
32 | 32 | |
33 | 33 | $this->assertEqual($deps[0]->department_id, 1); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | function test_find_by_pks_with_invalid() |
39 | 39 | { |
40 | - $deps = DepartmentRecord::finder()->findAllByPks(4,2,14); |
|
40 | + $deps = DepartmentRecord::finder()->findAllByPks(4, 2, 14); |
|
41 | 41 | $this->assertEqual(count($deps), 2); |
42 | 42 | |
43 | 43 | $this->assertEqual($deps[0]->department_id, 2); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | function test_find_by_composite_pks() |
48 | 48 | { |
49 | - $ds = DepSections::finder()->findAllByPks(array(1,1), array(2,5)); |
|
49 | + $ds = DepSections::finder()->findAllByPks(array(1, 1), array(2, 5)); |
|
50 | 50 | $this->assertEqual(count($ds), 2); |
51 | 51 | |
52 | 52 | $this->assertIsDepSection($ds[0], 1, 1); |
@@ -53,6 +53,10 @@ |
||
53 | 53 | $this->assertTrue($user->delete()); |
54 | 54 | } |
55 | 55 | |
56 | + /** |
|
57 | + * @param UserRecord $user |
|
58 | + * @param null|TActiveRecord $check |
|
59 | + */ |
|
56 | 60 | function assertSameUser($user,$check) |
57 | 61 | { |
58 | 62 | $props = array('username', 'password', 'email', 'first_name', 'last_name', 'job_title', |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | Prado::using('System.Data.ActiveRecord.TActiveRecord'); |
3 | -require_once(dirname(__FILE__).'/records/UserRecord.php'); |
|
3 | +require_once(dirname(__FILE__) . '/records/UserRecord.php'); |
|
4 | 4 | |
5 | 5 | class UserRecordTestCase extends UnitTestCase |
6 | 6 | { |
7 | 7 | function setup() |
8 | 8 | { |
9 | - $conn = new TDbConnection('pgsql:host=localhost;dbname=test', 'test','test'); |
|
9 | + $conn = new TDbConnection('pgsql:host=localhost;dbname=test', 'test', 'test'); |
|
10 | 10 | TActiveRecordManager::getInstance()->setDbConnection($conn); |
11 | 11 | } |
12 | 12 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $this->assertNotNull($user1); |
23 | 23 | |
24 | 24 | $user2 = UserRecord::finder()->findByPk('admin'); |
25 | - $this->assertFalse($user1===$user2); |
|
25 | + $this->assertFalse($user1 === $user2); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | function testFindByPk_returns_null() |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | $this->assertTrue($user->delete()); |
54 | 54 | } |
55 | 55 | |
56 | - function assertSameUser($user,$check) |
|
56 | + function assertSameUser($user, $check) |
|
57 | 57 | { |
58 | 58 | $props = array('username', 'password', 'email', 'first_name', 'last_name', 'job_title', |
59 | 59 | 'work_phone', 'work_fax', 'active', 'department_id', 'salutation', |
60 | 60 | 'hint_question', 'hint_answer'); |
61 | - foreach($props as $prop) |
|
62 | - $this->assertEqual($user->$prop,$check->$prop); |
|
61 | + foreach ($props as $prop) |
|
62 | + $this->assertEqual($user->$prop, $check->$prop); |
|
63 | 63 | } |
64 | 64 | } |
@@ -58,7 +58,8 @@ |
||
58 | 58 | $props = array('username', 'password', 'email', 'first_name', 'last_name', 'job_title', |
59 | 59 | 'work_phone', 'work_fax', 'active', 'department_id', 'salutation', |
60 | 60 | 'hint_question', 'hint_answer'); |
61 | - foreach($props as $prop) |
|
62 | - $this->assertEqual($user->$prop,$check->$prop); |
|
61 | + foreach($props as $prop) { |
|
62 | + $this->assertEqual($user->$prop,$check->$prop); |
|
63 | + } |
|
63 | 64 | } |
64 | 65 | } |
@@ -119,6 +119,9 @@ |
||
119 | 119 | $this->assertEqual(array('id'), $table->getPrimaryKeys()); |
120 | 120 | } |
121 | 121 | |
122 | + /** |
|
123 | + * @param TDbTableInfo $table |
|
124 | + */ |
|
122 | 125 | function assertColumn($columns, $table) |
123 | 126 | { |
124 | 127 | foreach($columns as $id=>$asserts) |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | { |
7 | 7 | function create_meta_data() |
8 | 8 | { |
9 | - $conn = new TDbConnection('pgsql:host=localhost;dbname=test', 'test','test'); |
|
9 | + $conn = new TDbConnection('pgsql:host=localhost;dbname=test', 'test', 'test'); |
|
10 | 10 | return new TPgsqlMetaData($conn); |
11 | 11 | } |
12 | 12 | |
@@ -121,12 +121,12 @@ discard block |
||
121 | 121 | |
122 | 122 | function assertColumn($columns, $table) |
123 | 123 | { |
124 | - foreach($columns as $id=>$asserts) |
|
124 | + foreach ($columns as $id=>$asserts) |
|
125 | 125 | { |
126 | 126 | $column = $table->Columns[$id]; |
127 | - foreach($asserts as $property=>$assert) |
|
127 | + foreach ($asserts as $property=>$assert) |
|
128 | 128 | { |
129 | - $ofAssert= var_export($assert,true); |
|
129 | + $ofAssert = var_export($assert, true); |
|
130 | 130 | $value = $column->{$property}; |
131 | 131 | $ofValue = var_export($value, true); |
132 | 132 | $this->assertEqual($value, $assert, |
@@ -31,6 +31,9 @@ discard block |
||
31 | 31 | $this->ScriptDirectory = $this->config->getScriptDir(); |
32 | 32 | } |
33 | 33 | |
34 | + /** |
|
35 | + * @param string $feature |
|
36 | + */ |
|
34 | 37 | public function hasSupportFor($feature) |
35 | 38 | { |
36 | 39 | return $this->config->hasFeature($feature); |
@@ -63,6 +66,7 @@ discard block |
||
63 | 66 | |
64 | 67 | /** |
65 | 68 | * Run a sql batch for the datasource. |
69 | + * @param string $script |
|
66 | 70 | */ |
67 | 71 | protected function initScript($script) |
68 | 72 | { |
@@ -248,6 +252,9 @@ discard block |
||
248 | 252 | return strtotime($this->getDatetime()); |
249 | 253 | } |
250 | 254 | |
255 | + /** |
|
256 | + * @return string |
|
257 | + */ |
|
251 | 258 | public function getDateTime() |
252 | 259 | { |
253 | 260 | return $this->_datetime; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once(dirname(__FILE__).'/common.php'); |
|
3 | +require_once(dirname(__FILE__) . '/common.php'); |
|
4 | 4 | Prado::using('System.Data.SqlMap.TSqlMapManager'); |
5 | 5 | |
6 | 6 | /** |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | |
39 | 39 | public function __destruct() |
40 | 40 | { |
41 | - if(!is_null($this->mapper)) |
|
41 | + if (!is_null($this->mapper)) |
|
42 | 42 | $this->mapper->cacheConfiguration(); |
43 | 43 | } |
44 | 44 | |
45 | 45 | function getConnection() |
46 | 46 | { |
47 | - if(is_null($this->connection)) |
|
47 | + if (is_null($this->connection)) |
|
48 | 48 | $this->connection = $this->config->getConnection(); |
49 | 49 | $this->connection->setActive(true); |
50 | 50 | return $this->connection; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | protected function initScript($script) |
68 | 68 | { |
69 | 69 | $runner = $this->config->getScriptRunner(); |
70 | - $runner->runScript($this->getConnection(), $this->ScriptDirectory.$script); |
|
70 | + $runner->runScript($this->getConnection(), $this->ScriptDirectory . $script); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | */ |
110 | 110 | protected function assertOrder1(Order $order) |
111 | 111 | { |
112 | - $date = @mktime(8,15,0,2,15,2003); |
|
112 | + $date = @mktime(8, 15, 0, 2, 15, 2003); |
|
113 | 113 | |
114 | - $this->assertIdentical((int)$order->getID(), 1); |
|
115 | - if($order->getDate() instanceof TDateTime) |
|
114 | + $this->assertIdentical((int) $order->getID(), 1); |
|
115 | + if ($order->getDate() instanceof TDateTime) |
|
116 | 116 | $this->assertIdentical($order->getDate()->getTimestamp(), $date); |
117 | 117 | else |
118 | 118 | $this->fail(); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | function assertAccount1AsHashArray($account) |
128 | 128 | { |
129 | - $this->assertIdentical(1, (int)$account["Id"]); |
|
129 | + $this->assertIdentical(1, (int) $account["Id"]); |
|
130 | 130 | $this->assertIdentical("Joe", $account["FirstName"]); |
131 | 131 | $this->assertIdentical("Dalton", $account["LastName"]); |
132 | 132 | $this->assertIdentical("[email protected]", $account["EmailAddress"]); |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | |
135 | 135 | function AssertOrder1AsHashArray($order) |
136 | 136 | { |
137 | - $date = @mktime(8,15,0,2,15,2003); |
|
137 | + $date = @mktime(8, 15, 0, 2, 15, 2003); |
|
138 | 138 | |
139 | 139 | $this->assertIdentical(1, $order["Id"]); |
140 | - if($order['Date'] instanceof TDateTime) |
|
140 | + if ($order['Date'] instanceof TDateTime) |
|
141 | 141 | $this->assertIdentical($date, $order["Date"]->getTimestamp()); |
142 | 142 | else |
143 | 143 | $this->fail(); |
@@ -157,22 +157,22 @@ discard block |
||
157 | 157 | public function getResult($string) |
158 | 158 | { |
159 | 159 | $value = intval($string); |
160 | - if($value == 100) |
|
160 | + if ($value == 100) |
|
161 | 161 | return true; |
162 | - if($value == 200) |
|
162 | + if ($value == 200) |
|
163 | 163 | return false; |
164 | 164 | //throw new Exception('unexpected value '.$value); |
165 | 165 | } |
166 | 166 | |
167 | 167 | public function getParameter($parameter) |
168 | 168 | { |
169 | - if($parameter) |
|
169 | + if ($parameter) |
|
170 | 170 | return 100; |
171 | 171 | else |
172 | 172 | return 200; |
173 | 173 | } |
174 | 174 | |
175 | - public function createNewInstance($data=null) |
|
175 | + public function createNewInstance($data = null) |
|
176 | 176 | { |
177 | 177 | throw new TDataMapperException('can not create'); |
178 | 178 | } |
@@ -185,22 +185,22 @@ discard block |
||
185 | 185 | |
186 | 186 | public function getResult($string) |
187 | 187 | { |
188 | - if($string === self::YES) |
|
188 | + if ($string === self::YES) |
|
189 | 189 | return true; |
190 | - if($string === self::NO) |
|
190 | + if ($string === self::NO) |
|
191 | 191 | return false; |
192 | 192 | //throw new Exception('unexpected value '.$string); |
193 | 193 | } |
194 | 194 | |
195 | 195 | public function getParameter($parameter) |
196 | 196 | { |
197 | - if($parameter) |
|
197 | + if ($parameter) |
|
198 | 198 | return self::YES; |
199 | 199 | else |
200 | 200 | return self::NO; |
201 | 201 | } |
202 | 202 | |
203 | - public function createNewInstance($data=null) |
|
203 | + public function createNewInstance($data = null) |
|
204 | 204 | { |
205 | 205 | throw new TDataMapperException('can not create'); |
206 | 206 | } |
@@ -221,13 +221,13 @@ discard block |
||
221 | 221 | |
222 | 222 | public function getParameter($parameter) |
223 | 223 | { |
224 | - if($parameter instanceof TDateTime) |
|
224 | + if ($parameter instanceof TDateTime) |
|
225 | 225 | return $parameter->getTimestamp(); |
226 | 226 | else |
227 | 227 | return $parameter; |
228 | 228 | } |
229 | 229 | |
230 | - public function createNewInstance($data=null) |
|
230 | + public function createNewInstance($data = null) |
|
231 | 231 | { |
232 | 232 | return new TDateTime; |
233 | 233 | } |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | { |
238 | 238 | private $_datetime; |
239 | 239 | |
240 | - public function __construct($datetime=null) |
|
240 | + public function __construct($datetime = null) |
|
241 | 241 | { |
242 | - if(!is_null($datetime)) |
|
242 | + if (!is_null($datetime)) |
|
243 | 243 | $this->setDatetime($datetime); |
244 | 244 | } |
245 | 245 |
@@ -38,14 +38,16 @@ discard block |
||
38 | 38 | |
39 | 39 | public function __destruct() |
40 | 40 | { |
41 | - if(!is_null($this->mapper)) |
|
42 | - $this->mapper->cacheConfiguration(); |
|
41 | + if(!is_null($this->mapper)) { |
|
42 | + $this->mapper->cacheConfiguration(); |
|
43 | + } |
|
43 | 44 | } |
44 | 45 | |
45 | 46 | function getConnection() |
46 | 47 | { |
47 | - if(is_null($this->connection)) |
|
48 | - $this->connection = $this->config->getConnection(); |
|
48 | + if(is_null($this->connection)) { |
|
49 | + $this->connection = $this->config->getConnection(); |
|
50 | + } |
|
49 | 51 | $this->connection->setActive(true); |
50 | 52 | return $this->connection; |
51 | 53 | } |
@@ -112,10 +114,11 @@ discard block |
||
112 | 114 | $date = @mktime(8,15,0,2,15,2003); |
113 | 115 | |
114 | 116 | $this->assertIdentical((int)$order->getID(), 1); |
115 | - if($order->getDate() instanceof TDateTime) |
|
116 | - $this->assertIdentical($order->getDate()->getTimestamp(), $date); |
|
117 | - else |
|
118 | - $this->fail(); |
|
117 | + if($order->getDate() instanceof TDateTime) { |
|
118 | + $this->assertIdentical($order->getDate()->getTimestamp(), $date); |
|
119 | + } else { |
|
120 | + $this->fail(); |
|
121 | + } |
|
119 | 122 | $this->assertIdentical($order->getCardType(), 'VISA'); |
120 | 123 | $this->assertIdentical($order->getCardNumber(), '999999999999'); |
121 | 124 | $this->assertIdentical($order->getCardExpiry(), '05/03'); |
@@ -137,10 +140,11 @@ discard block |
||
137 | 140 | $date = @mktime(8,15,0,2,15,2003); |
138 | 141 | |
139 | 142 | $this->assertIdentical(1, $order["Id"]); |
140 | - if($order['Date'] instanceof TDateTime) |
|
141 | - $this->assertIdentical($date, $order["Date"]->getTimestamp()); |
|
142 | - else |
|
143 | - $this->fail(); |
|
143 | + if($order['Date'] instanceof TDateTime) { |
|
144 | + $this->assertIdentical($date, $order["Date"]->getTimestamp()); |
|
145 | + } else { |
|
146 | + $this->fail(); |
|
147 | + } |
|
144 | 148 | $this->assertIdentical("VISA", $order["CardType"]); |
145 | 149 | $this->assertIdentical("999999999999", $order["CardNumber"]); |
146 | 150 | $this->assertIdentical("05/03", $order["CardExpiry"]); |
@@ -157,19 +161,22 @@ discard block |
||
157 | 161 | public function getResult($string) |
158 | 162 | { |
159 | 163 | $value = intval($string); |
160 | - if($value == 100) |
|
161 | - return true; |
|
162 | - if($value == 200) |
|
163 | - return false; |
|
164 | + if($value == 100) { |
|
165 | + return true; |
|
166 | + } |
|
167 | + if($value == 200) { |
|
168 | + return false; |
|
169 | + } |
|
164 | 170 | //throw new Exception('unexpected value '.$value); |
165 | 171 | } |
166 | 172 | |
167 | 173 | public function getParameter($parameter) |
168 | 174 | { |
169 | - if($parameter) |
|
170 | - return 100; |
|
171 | - else |
|
172 | - return 200; |
|
175 | + if($parameter) { |
|
176 | + return 100; |
|
177 | + } else { |
|
178 | + return 200; |
|
179 | + } |
|
173 | 180 | } |
174 | 181 | |
175 | 182 | public function createNewInstance($data=null) |
@@ -185,19 +192,22 @@ discard block |
||
185 | 192 | |
186 | 193 | public function getResult($string) |
187 | 194 | { |
188 | - if($string === self::YES) |
|
189 | - return true; |
|
190 | - if($string === self::NO) |
|
191 | - return false; |
|
195 | + if($string === self::YES) { |
|
196 | + return true; |
|
197 | + } |
|
198 | + if($string === self::NO) { |
|
199 | + return false; |
|
200 | + } |
|
192 | 201 | //throw new Exception('unexpected value '.$string); |
193 | 202 | } |
194 | 203 | |
195 | 204 | public function getParameter($parameter) |
196 | 205 | { |
197 | - if($parameter) |
|
198 | - return self::YES; |
|
199 | - else |
|
200 | - return self::NO; |
|
206 | + if($parameter) { |
|
207 | + return self::YES; |
|
208 | + } else { |
|
209 | + return self::NO; |
|
210 | + } |
|
201 | 211 | } |
202 | 212 | |
203 | 213 | public function createNewInstance($data=null) |
@@ -221,10 +231,11 @@ discard block |
||
221 | 231 | |
222 | 232 | public function getParameter($parameter) |
223 | 233 | { |
224 | - if($parameter instanceof TDateTime) |
|
225 | - return $parameter->getTimestamp(); |
|
226 | - else |
|
227 | - return $parameter; |
|
234 | + if($parameter instanceof TDateTime) { |
|
235 | + return $parameter->getTimestamp(); |
|
236 | + } else { |
|
237 | + return $parameter; |
|
238 | + } |
|
228 | 239 | } |
229 | 240 | |
230 | 241 | public function createNewInstance($data=null) |
@@ -239,8 +250,9 @@ discard block |
||
239 | 250 | |
240 | 251 | public function __construct($datetime=null) |
241 | 252 | { |
242 | - if(!is_null($datetime)) |
|
243 | - $this->setDatetime($datetime); |
|
253 | + if(!is_null($datetime)) { |
|
254 | + $this->setDatetime($datetime); |
|
255 | + } |
|
244 | 256 | } |
245 | 257 | |
246 | 258 | public function getTimestamp() |
@@ -51,12 +51,19 @@ |
||
51 | 51 | protected $baseFile; |
52 | 52 | protected $targetFile; |
53 | 53 | |
54 | + /** |
|
55 | + * @param string $base |
|
56 | + * @param string $target |
|
57 | + */ |
|
54 | 58 | public function __construct($base, $target) |
55 | 59 | { |
56 | 60 | $this->baseFile = $base; |
57 | 61 | $this->targetFile = $target; |
58 | 62 | } |
59 | 63 | |
64 | + /** |
|
65 | + * @param string $script |
|
66 | + */ |
|
60 | 67 | function runScript($connection, $script) |
61 | 68 | { |
62 | 69 | copy($this->baseFile, $this->targetFile); |
@@ -2,33 +2,33 @@ discard block |
||
2 | 2 | |
3 | 3 | Prado::using('System.Data.TDbConnection'); |
4 | 4 | |
5 | -if(!defined('SQLMAP_TESTS')) |
|
5 | +if (!defined('SQLMAP_TESTS')) |
|
6 | 6 | define('SQLMAP_TESTS', realpath(dirname(__FILE__))); |
7 | 7 | |
8 | -if(!class_exists('Account', false)) |
|
8 | +if (!class_exists('Account', false)) |
|
9 | 9 | { |
10 | - include(SQLMAP_TESTS.'/domain/A.php'); |
|
11 | - include(SQLMAP_TESTS.'/domain/Account.php'); |
|
12 | - include(SQLMAP_TESTS.'/domain/AccountBis.php'); |
|
13 | - include(SQLMAP_TESTS.'/domain/AccountCollection.php'); |
|
14 | - include(SQLMAP_TESTS.'/domain/B.php'); |
|
15 | - include(SQLMAP_TESTS.'/domain/Document.php'); |
|
16 | - include(SQLMAP_TESTS.'/domain/Book.php'); |
|
17 | - include(SQLMAP_TESTS.'/domain/C.php'); |
|
18 | - include(SQLMAP_TESTS.'/domain/Category.php'); |
|
19 | - include(SQLMAP_TESTS.'/domain/Complex.php'); |
|
20 | - include(SQLMAP_TESTS.'/domain/D.php'); |
|
21 | - include(SQLMAP_TESTS.'/domain/DocumentCollection.php'); |
|
22 | - include(SQLMAP_TESTS.'/domain/E.php'); |
|
23 | - include(SQLMAP_TESTS.'/domain/F.php'); |
|
24 | - include(SQLMAP_TESTS.'/domain/LineItem.php'); |
|
25 | - include(SQLMAP_TESTS.'/domain/LineItemCollection.php'); |
|
26 | - include(SQLMAP_TESTS.'/domain/Newspaper.php'); |
|
27 | - include(SQLMAP_TESTS.'/domain/Order.php'); |
|
28 | - include(SQLMAP_TESTS.'/domain/Other.php'); |
|
29 | - include(SQLMAP_TESTS.'/domain/Sample.php'); |
|
30 | - include(SQLMAP_TESTS.'/domain/Search.php'); |
|
31 | - include(SQLMAP_TESTS.'/domain/User.php'); |
|
10 | + include(SQLMAP_TESTS . '/domain/A.php'); |
|
11 | + include(SQLMAP_TESTS . '/domain/Account.php'); |
|
12 | + include(SQLMAP_TESTS . '/domain/AccountBis.php'); |
|
13 | + include(SQLMAP_TESTS . '/domain/AccountCollection.php'); |
|
14 | + include(SQLMAP_TESTS . '/domain/B.php'); |
|
15 | + include(SQLMAP_TESTS . '/domain/Document.php'); |
|
16 | + include(SQLMAP_TESTS . '/domain/Book.php'); |
|
17 | + include(SQLMAP_TESTS . '/domain/C.php'); |
|
18 | + include(SQLMAP_TESTS . '/domain/Category.php'); |
|
19 | + include(SQLMAP_TESTS . '/domain/Complex.php'); |
|
20 | + include(SQLMAP_TESTS . '/domain/D.php'); |
|
21 | + include(SQLMAP_TESTS . '/domain/DocumentCollection.php'); |
|
22 | + include(SQLMAP_TESTS . '/domain/E.php'); |
|
23 | + include(SQLMAP_TESTS . '/domain/F.php'); |
|
24 | + include(SQLMAP_TESTS . '/domain/LineItem.php'); |
|
25 | + include(SQLMAP_TESTS . '/domain/LineItemCollection.php'); |
|
26 | + include(SQLMAP_TESTS . '/domain/Newspaper.php'); |
|
27 | + include(SQLMAP_TESTS . '/domain/Order.php'); |
|
28 | + include(SQLMAP_TESTS . '/domain/Other.php'); |
|
29 | + include(SQLMAP_TESTS . '/domain/Sample.php'); |
|
30 | + include(SQLMAP_TESTS . '/domain/Search.php'); |
|
31 | + include(SQLMAP_TESTS . '/domain/User.php'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | class DefaultScriptRunner |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | { |
38 | 38 | $sql = file_get_contents($script); |
39 | 39 | $lines = explode(';', $sql); |
40 | - foreach($lines as $line) |
|
40 | + foreach ($lines as $line) |
|
41 | 41 | { |
42 | 42 | $line = trim($line); |
43 | - if(strlen($line) > 0) |
|
43 | + if (strlen($line) > 0) |
|
44 | 44 | $connection->createCommand($line)->execute(); |
45 | 45 | } |
46 | 46 | } |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | |
71 | 71 | public function __construct() |
72 | 72 | { |
73 | - $this->_sqlmapConfigFile = SQLMAP_TESTS.'/sqlite.xml'; |
|
74 | - $this->_scriptDir = SQLMAP_TESTS.'/scripts/sqlite/'; |
|
73 | + $this->_sqlmapConfigFile = SQLMAP_TESTS . '/sqlite.xml'; |
|
74 | + $this->_scriptDir = SQLMAP_TESTS . '/scripts/sqlite/'; |
|
75 | 75 | |
76 | - $this->targetFile = realpath(SQLMAP_TESTS.'/sqlite/tests.db'); |
|
77 | - $this->baseFile = realpath(SQLMAP_TESTS.'/sqlite/backup.db'); |
|
76 | + $this->targetFile = realpath(SQLMAP_TESTS . '/sqlite/tests.db'); |
|
77 | + $this->baseFile = realpath(SQLMAP_TESTS . '/sqlite/backup.db'); |
|
78 | 78 | $file = realpath($this->targetFile); |
79 | 79 | $this->_connection = new TDbConnection("sqlite:{$file}"); |
80 | 80 | } |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | { |
90 | 90 | public function __construct() |
91 | 91 | { |
92 | - $this->_sqlmapConfigFile = SQLMAP_TESTS.'/mysql.xml'; |
|
93 | - $this->_scriptDir = SQLMAP_TESTS.'/scripts/mysql/'; |
|
92 | + $this->_sqlmapConfigFile = SQLMAP_TESTS . '/mysql.xml'; |
|
93 | + $this->_scriptDir = SQLMAP_TESTS . '/scripts/mysql/'; |
|
94 | 94 | $this->_features = array('insert_id'); |
95 | 95 | $dsn = 'mysql:host=localhost;dbname=sqlmap_test;port=3307'; |
96 | 96 | $this->_connection = new TDbConnection($dsn, 'test5', 'test5'); |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | { |
102 | 102 | public function __construct() |
103 | 103 | { |
104 | - $this->_sqlmap = SQLMAP_TESTS.'/mssql.xml'; |
|
104 | + $this->_sqlmap = SQLMAP_TESTS . '/mssql.xml'; |
|
105 | 105 | $this->_connectionString = 'odbc_mssql://sqlmap_tests'; |
106 | - $this->_scriptDir = SQLMAP_TESTS.'/scripts/mssql/'; |
|
106 | + $this->_scriptDir = SQLMAP_TESTS . '/scripts/mssql/'; |
|
107 | 107 | $this->_features = array('insert_id'); |
108 | 108 | } |
109 | 109 | } |
@@ -2,8 +2,9 @@ discard block |
||
2 | 2 | |
3 | 3 | Prado::using('System.Data.TDbConnection'); |
4 | 4 | |
5 | -if(!defined('SQLMAP_TESTS')) |
|
5 | +if(!defined('SQLMAP_TESTS')) { |
|
6 | 6 | define('SQLMAP_TESTS', realpath(dirname(__FILE__))); |
7 | +} |
|
7 | 8 | |
8 | 9 | if(!class_exists('Account', false)) |
9 | 10 | { |
@@ -40,8 +41,9 @@ discard block |
||
40 | 41 | foreach($lines as $line) |
41 | 42 | { |
42 | 43 | $line = trim($line); |
43 | - if(strlen($line) > 0) |
|
44 | - $connection->createCommand($line)->execute(); |
|
44 | + if(strlen($line) > 0) { |
|
45 | + $connection->createCommand($line)->execute(); |
|
46 | + } |
|
45 | 47 | } |
46 | 48 | } |
47 | 49 | } |
@@ -11,15 +11,31 @@ |
||
11 | 11 | private $_CartOptions=0; |
12 | 12 | |
13 | 13 | public function getID(){ return $this->_ID; } |
14 | + |
|
15 | + /** |
|
16 | + * @param integer $value |
|
17 | + */ |
|
14 | 18 | public function setID($value){ $this->_ID = intval($value); } |
15 | 19 | |
16 | 20 | public function getFirstName(){ return $this->_FirstName; } |
21 | + |
|
22 | + /** |
|
23 | + * @param string $value |
|
24 | + */ |
|
17 | 25 | public function setFirstName($value){ $this->_FirstName = $value; } |
18 | 26 | |
19 | 27 | public function getLastName(){ return $this->_LastName; } |
28 | + |
|
29 | + /** |
|
30 | + * @param string $value |
|
31 | + */ |
|
20 | 32 | public function setLastName($value){ $this->_LastName = $value; } |
21 | 33 | |
22 | 34 | public function getEmailAddress(){ return $this->_EmailAddress; } |
35 | + |
|
36 | + /** |
|
37 | + * @param string|null $value |
|
38 | + */ |
|
23 | 39 | public function setEmailAddress($value){ $this->_EmailAddress = $value; } |
24 | 40 | |
25 | 41 | public function getIDS(){ return $this->_IDS; } |
@@ -2,33 +2,33 @@ |
||
2 | 2 | |
3 | 3 | class Account |
4 | 4 | { |
5 | - private $_ID=0; |
|
6 | - private $_FirstName=''; |
|
7 | - private $_LastName=''; |
|
8 | - private $_EmailAddress=null; |
|
9 | - private $_IDS=''; |
|
10 | - private $_BannerOptions=0; |
|
11 | - private $_CartOptions=0; |
|
5 | + private $_ID = 0; |
|
6 | + private $_FirstName = ''; |
|
7 | + private $_LastName = ''; |
|
8 | + private $_EmailAddress = null; |
|
9 | + private $_IDS = ''; |
|
10 | + private $_BannerOptions = 0; |
|
11 | + private $_CartOptions = 0; |
|
12 | 12 | |
13 | - public function getID(){ return $this->_ID; } |
|
14 | - public function setID($value){ $this->_ID = intval($value); } |
|
13 | + public function getID() { return $this->_ID; } |
|
14 | + public function setID($value) { $this->_ID = intval($value); } |
|
15 | 15 | |
16 | - public function getFirstName(){ return $this->_FirstName; } |
|
17 | - public function setFirstName($value){ $this->_FirstName = $value; } |
|
16 | + public function getFirstName() { return $this->_FirstName; } |
|
17 | + public function setFirstName($value) { $this->_FirstName = $value; } |
|
18 | 18 | |
19 | - public function getLastName(){ return $this->_LastName; } |
|
20 | - public function setLastName($value){ $this->_LastName = $value; } |
|
19 | + public function getLastName() { return $this->_LastName; } |
|
20 | + public function setLastName($value) { $this->_LastName = $value; } |
|
21 | 21 | |
22 | - public function getEmailAddress(){ return $this->_EmailAddress; } |
|
23 | - public function setEmailAddress($value){ $this->_EmailAddress = $value; } |
|
22 | + public function getEmailAddress() { return $this->_EmailAddress; } |
|
23 | + public function setEmailAddress($value) { $this->_EmailAddress = $value; } |
|
24 | 24 | |
25 | - public function getIDS(){ return $this->_IDS; } |
|
26 | - public function setIDS($value){ $this->_IDS = $value; } |
|
25 | + public function getIDS() { return $this->_IDS; } |
|
26 | + public function setIDS($value) { $this->_IDS = $value; } |
|
27 | 27 | |
28 | - public function getBannerOptions(){ return $this->_BannerOptions; } |
|
29 | - public function setBannerOptions($value){ $this->_BannerOptions = $value; } |
|
28 | + public function getBannerOptions() { return $this->_BannerOptions; } |
|
29 | + public function setBannerOptions($value) { $this->_BannerOptions = $value; } |
|
30 | 30 | |
31 | - public function getCartOptions(){ return $this->_CartOptions; } |
|
32 | - public function setCartOptions($value){ $this->_CartOptions = $value; } |
|
31 | + public function getCartOptions() { return $this->_CartOptions; } |
|
32 | + public function setCartOptions($value) { $this->_CartOptions = $value; } |
|
33 | 33 | |
34 | 34 | } |
@@ -10,18 +10,38 @@ |
||
10 | 10 | private $_PictureData=''; |
11 | 11 | |
12 | 12 | public function getID(){ return $this->_ID; } |
13 | + |
|
14 | + /** |
|
15 | + * @param integer $value |
|
16 | + */ |
|
13 | 17 | public function setID($value){ $this->_ID = $value; } |
14 | 18 | |
15 | 19 | public function getOrder(){ return $this->_Order; } |
20 | + |
|
21 | + /** |
|
22 | + * @param Order $value |
|
23 | + */ |
|
16 | 24 | public function setOrder($value){ $this->_Order = $value; } |
17 | 25 | |
18 | 26 | public function getCode(){ return $this->_Code; } |
27 | + |
|
28 | + /** |
|
29 | + * @param string $value |
|
30 | + */ |
|
19 | 31 | public function setCode($value){ $this->_Code = $value; } |
20 | 32 | |
21 | 33 | public function getQuantity(){ return $this->_Quantity; } |
34 | + |
|
35 | + /** |
|
36 | + * @param integer $value |
|
37 | + */ |
|
22 | 38 | public function setQuantity($value){ $this->_Quantity = $value; } |
23 | 39 | |
24 | 40 | public function getPrice(){ return $this->_Price; } |
41 | + |
|
42 | + /** |
|
43 | + * @param double $value |
|
44 | + */ |
|
25 | 45 | public function setPrice($value){ $this->_Price = $value; } |
26 | 46 | |
27 | 47 | public function getPictureData(){ return $this->_PictureData; } |
@@ -2,29 +2,29 @@ |
||
2 | 2 | |
3 | 3 | class LineItem |
4 | 4 | { |
5 | - private $_ID=-1; |
|
6 | - private $_Order=''; |
|
7 | - private $_Code=''; |
|
8 | - private $_Quantity=-1; |
|
9 | - private $_Price=0.0; |
|
10 | - private $_PictureData=''; |
|
5 | + private $_ID = -1; |
|
6 | + private $_Order = ''; |
|
7 | + private $_Code = ''; |
|
8 | + private $_Quantity = -1; |
|
9 | + private $_Price = 0.0; |
|
10 | + private $_PictureData = ''; |
|
11 | 11 | |
12 | - public function getID(){ return $this->_ID; } |
|
13 | - public function setID($value){ $this->_ID = $value; } |
|
12 | + public function getID() { return $this->_ID; } |
|
13 | + public function setID($value) { $this->_ID = $value; } |
|
14 | 14 | |
15 | - public function getOrder(){ return $this->_Order; } |
|
16 | - public function setOrder($value){ $this->_Order = $value; } |
|
15 | + public function getOrder() { return $this->_Order; } |
|
16 | + public function setOrder($value) { $this->_Order = $value; } |
|
17 | 17 | |
18 | - public function getCode(){ return $this->_Code; } |
|
19 | - public function setCode($value){ $this->_Code = $value; } |
|
18 | + public function getCode() { return $this->_Code; } |
|
19 | + public function setCode($value) { $this->_Code = $value; } |
|
20 | 20 | |
21 | - public function getQuantity(){ return $this->_Quantity; } |
|
22 | - public function setQuantity($value){ $this->_Quantity = $value; } |
|
21 | + public function getQuantity() { return $this->_Quantity; } |
|
22 | + public function setQuantity($value) { $this->_Quantity = $value; } |
|
23 | 23 | |
24 | - public function getPrice(){ return $this->_Price; } |
|
25 | - public function setPrice($value){ $this->_Price = $value; } |
|
24 | + public function getPrice() { return $this->_Price; } |
|
25 | + public function setPrice($value) { $this->_Price = $value; } |
|
26 | 26 | |
27 | - public function getPictureData(){ return $this->_PictureData; } |
|
28 | - public function setPictureData($value){ $this->_PictureData = $value; } |
|
27 | + public function getPictureData() { return $this->_PictureData; } |
|
28 | + public function setPictureData($value) { $this->_PictureData = $value; } |
|
29 | 29 | |
30 | 30 | } |
@@ -8,14 +8,30 @@ |
||
8 | 8 | private $_Bool2=false; |
9 | 9 | |
10 | 10 | public function getBool2(){ return $this->_Bool2; } |
11 | + |
|
12 | + /** |
|
13 | + * @param boolean $value |
|
14 | + */ |
|
11 | 15 | public function setBool2($value){ $this->_Bool2 = $value; } |
12 | 16 | |
13 | 17 | public function getBool(){ return $this->_Bool; } |
18 | + |
|
19 | + /** |
|
20 | + * @param boolean $value |
|
21 | + */ |
|
14 | 22 | public function setBool($value){ $this->_Bool = $value; } |
15 | 23 | |
16 | 24 | public function getInt(){ return $this->_Int; } |
25 | + |
|
26 | + /** |
|
27 | + * @param integer $value |
|
28 | + */ |
|
17 | 29 | public function setInt($value){ $this->_Int = $value; } |
18 | 30 | |
19 | 31 | public function getLong(){ return $this->_Long; } |
32 | + |
|
33 | + /** |
|
34 | + * @param integer $value |
|
35 | + */ |
|
20 | 36 | public function setLong($value){ $this->_Long = $value; } |
21 | 37 | } |
@@ -2,20 +2,20 @@ |
||
2 | 2 | |
3 | 3 | class Other |
4 | 4 | { |
5 | - private $_Int=-1; |
|
6 | - private $_Long=-1; |
|
7 | - private $_Bool=false; |
|
8 | - private $_Bool2=false; |
|
5 | + private $_Int = -1; |
|
6 | + private $_Long = -1; |
|
7 | + private $_Bool = false; |
|
8 | + private $_Bool2 = false; |
|
9 | 9 | |
10 | - public function getBool2(){ return $this->_Bool2; } |
|
11 | - public function setBool2($value){ $this->_Bool2 = $value; } |
|
10 | + public function getBool2() { return $this->_Bool2; } |
|
11 | + public function setBool2($value) { $this->_Bool2 = $value; } |
|
12 | 12 | |
13 | - public function getBool(){ return $this->_Bool; } |
|
14 | - public function setBool($value){ $this->_Bool = $value; } |
|
13 | + public function getBool() { return $this->_Bool; } |
|
14 | + public function setBool($value) { $this->_Bool = $value; } |
|
15 | 15 | |
16 | - public function getInt(){ return $this->_Int; } |
|
17 | - public function setInt($value){ $this->_Int = $value; } |
|
16 | + public function getInt() { return $this->_Int; } |
|
17 | + public function setInt($value) { $this->_Int = $value; } |
|
18 | 18 | |
19 | - public function getLong(){ return $this->_Long; } |
|
20 | - public function setLong($value){ $this->_Long = $value; } |
|
19 | + public function getLong() { return $this->_Long; } |
|
20 | + public function setLong($value) { $this->_Long = $value; } |
|
21 | 21 | } |
@@ -95,12 +95,21 @@ discard block |
||
95 | 95 | $this->assertNewspaper($news, 4, "Le Canard enchaine", "Paris"); |
96 | 96 | } |
97 | 97 | |
98 | + /** |
|
99 | + * @param integer $id |
|
100 | + * @param string $title |
|
101 | + */ |
|
98 | 102 | function AssertDocument(Document $document, $id, $title) |
99 | 103 | { |
100 | 104 | $this->assertEqual($id, $document->getID()); |
101 | 105 | $this->assertEqual($title, $document->getTitle()); |
102 | 106 | } |
103 | 107 | |
108 | + /** |
|
109 | + * @param integer $id |
|
110 | + * @param string $title |
|
111 | + * @param integer $pageNumber |
|
112 | + */ |
|
104 | 113 | function AssertBook(Book $book, $id, $title, $pageNumber) |
105 | 114 | { |
106 | 115 | $this->assertEqual($id, $book->getId()); |
@@ -108,6 +117,11 @@ discard block |
||
108 | 117 | $this->assertEqual($pageNumber, (int)$book->getPageNumber()); |
109 | 118 | } |
110 | 119 | |
120 | + /** |
|
121 | + * @param integer $id |
|
122 | + * @param string $title |
|
123 | + * @param string $city |
|
124 | + */ |
|
111 | 125 | function AssertNewspaper(Newspaper $news, $id, $title, $city) |
112 | 126 | { |
113 | 127 | $this->assertEqual($id, $news->getId()); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once(dirname(__FILE__).'/BaseCase.php'); |
|
3 | +require_once(dirname(__FILE__) . '/BaseCase.php'); |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * @package System.DataAccess.SQLMap |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | { |
106 | 106 | $this->assertEqual($id, $book->getId()); |
107 | 107 | $this->assertEqual($title, $book->getTitle()); |
108 | - $this->assertEqual($pageNumber, (int)$book->getPageNumber()); |
|
108 | + $this->assertEqual($pageNumber, (int) $book->getPageNumber()); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | function AssertNewspaper(Newspaper $news, $id, $title, $city) |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | throw new TDataMapperException('not implemented'); |
138 | 138 | } |
139 | 139 | |
140 | - public function createNewInstance($data=null) |
|
140 | + public function createNewInstance($data = null) |
|
141 | 141 | { |
142 | 142 | throw new TDataMapperException('can not create'); |
143 | 143 | } |