|
1
|
|
|
<?php |
|
2
|
|
|
namespace FwlibTest\Bridge; |
|
3
|
|
|
|
|
4
|
|
|
use Fwlib\Bridge\Adodb; |
|
5
|
|
|
use Fwlib\Config\GlobalConfig; |
|
6
|
|
|
use Fwlib\Db\SqlGenerator; |
|
7
|
|
|
use Fwlib\Test\AbstractDbRelateTest; |
|
8
|
|
|
use Fwlib\Util\UtilContainerAwareTrait; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* @copyright Copyright 2013-2015, 2017 Fwolf |
|
12
|
|
|
* @license http://www.gnu.org/licenses/lgpl.html LGPL-3.0+ |
|
13
|
|
|
*/ |
|
14
|
|
|
class AdodbMysqlTest extends AbstractDbRelateTest |
|
15
|
|
|
{ |
|
16
|
|
|
use UtilContainerAwareTrait; |
|
17
|
|
|
|
|
18
|
|
|
|
|
19
|
|
|
protected static $dbUsing = 'mysql'; |
|
20
|
|
|
|
|
21
|
|
|
|
|
22
|
|
|
public function generateUuid() |
|
23
|
|
|
{ |
|
24
|
|
|
return $this->getUtilContainer()->getUuidBase16()->generate(); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Notice: Parameter type in adodb::SetFetchMode() is wrong, version 5.07 |
|
30
|
|
|
* - 5.19 |
|
31
|
|
|
*/ |
|
32
|
|
|
public function testCall() |
|
33
|
|
|
{ |
|
34
|
|
|
/** @var \ADOConnection $dbMysql */ |
|
35
|
|
|
$dbMysql = self::$dbMysql; |
|
36
|
|
|
|
|
37
|
|
|
$fetchMode = $dbMysql->fetchMode; |
|
38
|
|
|
$dbMysql->setFetchMode(3); // Both |
|
39
|
|
|
|
|
40
|
|
|
$ar = $dbMysql->GetAll('SELECT 1 AS a'); |
|
41
|
|
|
$y = [['1', 'a' => '1']]; |
|
42
|
|
|
$this->assertEqualArray($y, $ar); |
|
43
|
|
|
|
|
44
|
|
|
$ar = $dbMysql->CacheGetAll(1, 'SELECT 1 AS a'); |
|
45
|
|
|
$y = [['1', 'a' => '1']]; |
|
46
|
|
|
$this->assertEqualArray($y, $ar); |
|
47
|
|
|
|
|
48
|
|
|
$dbMysql->setFetchMode($fetchMode); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
|
|
52
|
|
|
public function testConstruct() |
|
53
|
|
|
{ |
|
54
|
|
|
$profile = GlobalConfig::getInstance()->get('dbserver.mysql'); |
|
55
|
|
|
$db = new Adodb($profile); |
|
56
|
|
|
|
|
57
|
|
|
$this->assertEqualArray($profile, $db->getProfile()); |
|
58
|
|
|
|
|
59
|
|
|
// SqlGenerator is not instanced now, see testGenerateSql() |
|
60
|
|
|
$this->assertNull($this->reflectionGet($db, 'sqlGenerator')); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
|
|
64
|
|
|
public function testConnect() |
|
65
|
|
|
{ |
|
66
|
|
|
// Clone doesn't affect property object conn |
|
67
|
|
|
//$conn = clone self::$dbMysql; |
|
68
|
|
|
|
|
69
|
|
|
// Check connection is reused |
|
70
|
|
|
$y = self::$dbMysql->_connectionID->thread_id; |
|
|
|
|
|
|
71
|
|
|
self::$dbMysql->connect(false); |
|
72
|
|
|
$x = self::$dbMysql->_connectionID->thread_id; |
|
|
|
|
|
|
73
|
|
|
$this->assertEquals($y, $x); |
|
74
|
|
|
|
|
75
|
|
|
// Force re-connect |
|
76
|
|
|
self::$dbMysql->connect(true); |
|
77
|
|
|
$x = self::$dbMysql->_connectionID->thread_id; |
|
|
|
|
|
|
78
|
|
|
$this->assertNotEquals($y, $x); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
|
|
82
|
|
View Code Duplication |
public function testConvertEncodingResult() |
|
|
|
|
|
|
83
|
|
|
{ |
|
84
|
|
|
// Backup original charset |
|
85
|
|
|
$originalCharsetPhp = self::$dbMysql->charsetPhp; |
|
86
|
|
|
$originalCharsetDb = self::$dbMysql->profile['lang']; |
|
87
|
|
|
|
|
88
|
|
|
self::$dbMysql->setCharsetPhp('UTF-8'); |
|
89
|
|
|
self::$dbMysql->profile['lang'] = 'GB2312'; |
|
90
|
|
|
|
|
91
|
|
|
$x = [null, '你好']; |
|
92
|
|
|
$y = [null, mb_convert_encoding('你好', 'UTF-8', 'GB2312')]; |
|
93
|
|
|
$this->assertEquals( |
|
94
|
|
|
$y, |
|
95
|
|
|
self::$dbMysql->convertEncodingResult($x) |
|
96
|
|
|
); |
|
97
|
|
|
|
|
98
|
|
|
|
|
99
|
|
|
// Recover original charset |
|
100
|
|
|
self::$dbMysql->setCharsetPhp($originalCharsetPhp); |
|
101
|
|
|
self::$dbMysql->profile['lang'] = $originalCharsetDb; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
|
|
105
|
|
View Code Duplication |
public function testConvertEncodingSql() |
|
|
|
|
|
|
106
|
|
|
{ |
|
107
|
|
|
// Backup original charset |
|
108
|
|
|
$originalCharsetPhp = self::$dbMysql->charsetPhp; |
|
109
|
|
|
$originalCharsetDb = self::$dbMysql->profile['lang']; |
|
110
|
|
|
|
|
111
|
|
|
self::$dbMysql->setCharsetPhp('UTF-8'); |
|
112
|
|
|
self::$dbMysql->profile['lang'] = 'GB2312'; |
|
113
|
|
|
|
|
114
|
|
|
$x = [null, '你好']; |
|
115
|
|
|
$y = [null, mb_convert_encoding('你好', 'GB2312', 'UTF-8')]; |
|
116
|
|
|
$this->assertEquals( |
|
117
|
|
|
$y, |
|
118
|
|
|
self::$dbMysql->convertEncodingSql($x) |
|
119
|
|
|
); |
|
120
|
|
|
|
|
121
|
|
|
|
|
122
|
|
|
// Recover original charset |
|
123
|
|
|
self::$dbMysql->setCharsetPhp($originalCharsetPhp); |
|
124
|
|
|
self::$dbMysql->profile['lang'] = $originalCharsetDb; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* @expectedException \PHPUnit_Framework_Error |
|
130
|
|
|
*/ |
|
131
|
|
|
public function testDeleteRow() |
|
132
|
|
|
{ |
|
133
|
|
|
$i = self::$dbMysql->deleteRow(self::$tableUser, ''); |
|
134
|
|
|
$this->assertEquals(-1, $i); |
|
135
|
|
|
|
|
136
|
|
|
$i = self::$dbMysql->deleteRow( |
|
137
|
|
|
self::$tableUser, |
|
138
|
|
|
'WHERE FALSE' |
|
139
|
|
|
); |
|
140
|
|
|
$this->assertEquals(0, $i); |
|
141
|
|
|
|
|
142
|
|
|
// When use executePrepare(), error was detected and rollback, so |
|
143
|
|
|
// return 0 instead of -1, throw exception. |
|
144
|
|
|
self::$dbMysql->deleteRow( |
|
145
|
|
|
self::$tableUser, |
|
146
|
|
|
'WHERE ERROR_CLAUSE' |
|
147
|
|
|
); |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
|
|
151
|
|
|
public function testError() |
|
152
|
|
|
{ |
|
153
|
|
|
self::$dbMysql->execute('SELECT 1'); |
|
154
|
|
|
$this->assertEquals('', self::$dbMysql->getErrorMessage()); |
|
155
|
|
|
$this->assertEquals('', self::$dbMysql->errorMsg()); |
|
156
|
|
|
$this->assertEquals(0, self::$dbMysql->getErrorCode()); |
|
157
|
|
|
$this->assertEquals(0, self::$dbMysql->errorNo()); |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
|
|
161
|
|
|
public function testExecute() |
|
162
|
|
|
{ |
|
163
|
|
|
self::$dbMysql->execute( |
|
164
|
|
|
[ |
|
165
|
|
|
'SELECT' => 'uuid', |
|
166
|
|
|
'FROM' => self::$tableUser, |
|
167
|
|
|
'LIMIT' => 1 |
|
168
|
|
|
] |
|
169
|
|
|
); |
|
170
|
|
|
$this->assertEquals(0, self::$dbMysql->getErrorCode()); |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
|
|
174
|
|
|
/** |
|
175
|
|
|
* @expectedException \PHPUnit_Framework_Error |
|
176
|
|
|
*/ |
|
177
|
|
|
public function testExecutePrepare() |
|
178
|
|
|
{ |
|
179
|
|
|
self::$dbMysql->executePrepare( |
|
180
|
|
|
[ |
|
|
|
|
|
|
181
|
|
|
'SELECT' => 'uuid', |
|
182
|
|
|
'FROM' => self::$tableUser, |
|
183
|
|
|
'LIMIT' => 1 |
|
184
|
|
|
] |
|
185
|
|
|
); |
|
186
|
|
|
$this->assertEquals(0, self::$dbMysql->getErrorCode()); |
|
187
|
|
|
|
|
188
|
|
|
self::$dbMysql->executePrepare( |
|
189
|
|
|
[ |
|
|
|
|
|
|
190
|
|
|
'SELECT' => 'uuid', |
|
191
|
|
|
'FROM' => self::$tableUser, |
|
192
|
|
|
'WHERE' => 'Error Clause', |
|
193
|
|
|
] |
|
194
|
|
|
); |
|
195
|
|
|
} |
|
196
|
|
|
|
|
197
|
|
|
|
|
198
|
|
|
/** |
|
199
|
|
|
* Test for Mysql db only |
|
200
|
|
|
*/ |
|
201
|
|
|
public function testForMysqlOnly() |
|
202
|
|
|
{ |
|
203
|
|
|
if (!self::$dbMysql->isDbMysql()) { |
|
204
|
|
|
$this->markTestSkipped('Skip mysql only test.'); |
|
205
|
|
|
} |
|
206
|
|
|
|
|
207
|
|
|
$this->assertEquals( |
|
208
|
|
|
";\n", |
|
209
|
|
|
self::$dbMysql->getSqlDelimiter() |
|
210
|
|
|
); |
|
211
|
|
|
|
|
212
|
|
|
$this->assertEquals( |
|
213
|
|
|
false, |
|
214
|
|
|
self::$dbMysql->isTimestampUnique() |
|
215
|
|
|
); |
|
216
|
|
|
} |
|
217
|
|
|
|
|
218
|
|
|
|
|
219
|
|
|
public function testGenerateSql() |
|
220
|
|
|
{ |
|
221
|
|
|
$userTable = self::$tableUser; |
|
222
|
|
|
|
|
223
|
|
|
$x = self::$dbMysql->generateSql(''); |
|
|
|
|
|
|
224
|
|
|
$this->assertEquals('', $x); |
|
225
|
|
|
|
|
226
|
|
|
|
|
227
|
|
|
// SqlGenerator is instanced now |
|
228
|
|
|
$this->assertInstanceOf( |
|
229
|
|
|
SqlGenerator::class, |
|
230
|
|
|
$this->reflectionGet(self::$dbMysql, 'sqlGenerator') |
|
231
|
|
|
); |
|
232
|
|
|
|
|
233
|
|
|
|
|
234
|
|
|
$ar = [ |
|
235
|
|
|
'SELECT' => 'title', |
|
236
|
|
|
'FROM' => $userTable, |
|
237
|
|
|
]; |
|
238
|
|
|
$x = self::$dbMysql->generateSql($ar); |
|
239
|
|
|
$y = "SELECT title FROM $userTable"; |
|
240
|
|
|
$this->assertEquals($y, $x); |
|
241
|
|
|
} |
|
242
|
|
|
|
|
243
|
|
|
|
|
244
|
|
|
public function testGenerateSqlPrepared() |
|
245
|
|
|
{ |
|
246
|
|
|
$userTable = self::$tableUser; |
|
247
|
|
|
|
|
248
|
|
|
$x = self::$dbMysql->generateSqlPrepared(''); |
|
|
|
|
|
|
249
|
|
|
$this->assertEquals('', $x); |
|
250
|
|
|
|
|
251
|
|
|
$ar = [ |
|
252
|
|
|
'INSERT' => self::$tableUser, |
|
253
|
|
|
'VALUES' => [ |
|
254
|
|
|
'uuid' => self::$dbMysql->param('uuid'), |
|
255
|
|
|
'title' => self::$dbMysql->param('title'), |
|
256
|
|
|
'age' => self::$dbMysql->param('age'), |
|
257
|
|
|
], |
|
258
|
|
|
]; |
|
259
|
|
|
$x = self::$dbMysql->generateSqlPrepared($ar); |
|
260
|
|
|
$y = "INSERT INTO $userTable(uuid, title, age) VALUES (?, ?, ?)"; |
|
261
|
|
|
$this->assertEquals($y, $x); |
|
262
|
|
|
} |
|
263
|
|
|
|
|
264
|
|
|
|
|
265
|
|
|
/** |
|
266
|
|
|
* @expectedException \PHPUnit_Framework_Error_Warning |
|
267
|
|
|
*/ |
|
268
|
|
|
public function testGetByKey() |
|
269
|
|
|
{ |
|
270
|
|
|
// Normal getByKey() tested with write() |
|
271
|
|
|
|
|
272
|
|
|
// Prepare data |
|
273
|
|
|
$uuid = $this->generateUuid(); |
|
274
|
|
|
$ar = [ |
|
275
|
|
|
'uuid' => $uuid, |
|
276
|
|
|
'title' => 'Title', |
|
277
|
|
|
'age' => 42, |
|
278
|
|
|
]; |
|
279
|
|
|
self::$dbMysql->write(self::$tableUser, $ar); |
|
280
|
|
|
|
|
281
|
|
|
|
|
282
|
|
|
// Different way to read one column |
|
283
|
|
|
$this->assertEquals( |
|
284
|
|
|
'Title', |
|
285
|
|
|
self::$dbMysql->getByKey(self::$tableUser, $uuid, 'title') |
|
286
|
|
|
); |
|
287
|
|
|
$this->assertEquals( |
|
288
|
|
|
'Title', |
|
289
|
|
|
self::$dbMysql->getByKey(self::$tableUser, $uuid, 'title', 'uuid') |
|
290
|
|
|
); |
|
291
|
|
|
$this->assertEquals( |
|
292
|
|
|
'Title', |
|
293
|
|
|
self::$dbMysql->getByKey( |
|
294
|
|
|
self::$tableUser, |
|
295
|
|
|
[$uuid], |
|
|
|
|
|
|
296
|
|
|
'title', |
|
297
|
|
|
['uuid'] |
|
298
|
|
|
) |
|
299
|
|
|
); |
|
300
|
|
|
|
|
301
|
|
|
// Read more than one column |
|
302
|
|
|
$this->assertEqualArray( |
|
303
|
|
|
['title' => 'Title', 'age' => '42'], |
|
304
|
|
|
self::$dbMysql->getByKey(self::$tableUser, $uuid, 'title, age') |
|
305
|
|
|
); |
|
306
|
|
|
|
|
307
|
|
|
// * col |
|
308
|
|
|
$data = self::$dbMysql->getByKey(self::$tableUser, $uuid); |
|
309
|
|
|
$this->assertEquals('Title', $data['title']); |
|
310
|
|
|
$this->assertEquals(42, $data['age']); |
|
311
|
|
|
|
|
312
|
|
|
// Not exists data |
|
313
|
|
|
$data = self::$dbMysql->getByKey(self::$tableUser, $uuid . 'foo'); |
|
314
|
|
|
$this->assertEquals(null, $data); |
|
315
|
|
|
|
|
316
|
|
|
// More PK value than column, throw exception |
|
317
|
|
|
$this->assertEquals( |
|
318
|
|
|
null, |
|
319
|
|
|
self::$dbMysql->getByKey(self::$tableUser, [1, 2], 'title') |
|
|
|
|
|
|
320
|
|
|
); |
|
321
|
|
|
} |
|
322
|
|
|
|
|
323
|
|
|
|
|
324
|
|
|
public function testGetMetaPrimaryKey() |
|
325
|
|
|
{ |
|
326
|
|
|
// Normal test completed by other method |
|
327
|
|
|
|
|
328
|
|
|
$this->assertEquals( |
|
329
|
|
|
null, |
|
330
|
|
|
self::$dbMysql->getMetaPrimaryKey(self::$tableUser . '_not_exists') |
|
331
|
|
|
); |
|
332
|
|
|
} |
|
333
|
|
|
|
|
334
|
|
|
|
|
335
|
|
|
public function testGetMetaTimestamp() |
|
336
|
|
|
{ |
|
337
|
|
|
$this->assertEquals( |
|
338
|
|
|
'', |
|
339
|
|
|
self::$dbMysql->getMetaTimeStamp(self::$tableUser . '_not_exists') |
|
340
|
|
|
); |
|
341
|
|
|
|
|
342
|
|
|
$this->assertEquals( |
|
343
|
|
|
'', |
|
344
|
|
|
self::$dbMysql->getMetaTimeStamp(self::$tableGroup) |
|
345
|
|
|
); |
|
346
|
|
|
} |
|
347
|
|
|
|
|
348
|
|
|
|
|
349
|
|
|
public function testGetProfileString() |
|
350
|
|
|
{ |
|
351
|
|
|
$profileString = self::$dbMysql->getProfileString('-'); |
|
352
|
|
|
$this->assertEquals(2, substr_count($profileString, '-')); |
|
353
|
|
|
} |
|
354
|
|
|
|
|
355
|
|
|
|
|
356
|
|
|
public function testGetQueryCount() |
|
357
|
|
|
{ |
|
358
|
|
|
/** @var \ADOConnection|\Fwlib\Bridge\Adodb $db */ |
|
359
|
|
|
$db = self::$dbMysql; |
|
360
|
|
|
$i = $db->getQueryCount(); |
|
361
|
|
|
|
|
362
|
|
|
$db->GetAll('SELECT 1 AS a'); |
|
|
|
|
|
|
363
|
|
|
$this->assertEquals($i + 1, $db->getQueryCount()); |
|
364
|
|
|
|
|
365
|
|
|
$db->CacheGetAll(0, 'SELECT 1 AS a'); |
|
|
|
|
|
|
366
|
|
|
$this->assertEquals($i + 1, $db->getQueryCount()); |
|
367
|
|
|
|
|
368
|
|
|
$db->GetAll('SELECT 1 AS a'); |
|
|
|
|
|
|
369
|
|
|
$this->assertEquals($i + 2, $db->getQueryCount()); |
|
370
|
|
|
} |
|
371
|
|
|
|
|
372
|
|
|
|
|
373
|
|
|
public function testGetSet() |
|
374
|
|
|
{ |
|
375
|
|
|
self::$dbMysql->debug = false; |
|
|
|
|
|
|
376
|
|
|
$this->assertFalse(self::$dbMysql->debug); |
|
|
|
|
|
|
377
|
|
|
} |
|
378
|
|
|
|
|
379
|
|
|
|
|
380
|
|
|
public function testGetSqlTrans() |
|
381
|
|
|
{ |
|
382
|
|
|
$this->assertEquals( |
|
383
|
|
|
'TRANSACTION', |
|
384
|
|
|
substr(self::$dbMysql->getSqlTransBegin(), 6, 11) |
|
385
|
|
|
); |
|
386
|
|
|
$this->assertStringStartsWith( |
|
387
|
|
|
'COMMIT', |
|
388
|
|
|
self::$dbMysql->getSqlTransCommit() |
|
389
|
|
|
); |
|
390
|
|
|
$this->assertStringStartsWith( |
|
391
|
|
|
'ROLLBACK', |
|
392
|
|
|
self::$dbMysql->getSqlTransRollback() |
|
393
|
|
|
); |
|
394
|
|
|
} |
|
395
|
|
|
|
|
396
|
|
|
|
|
397
|
|
|
public function testIsTblExist() |
|
398
|
|
|
{ |
|
399
|
|
|
$this->assertTrue(self::$dbMysql->isTableExist(self::$tableUser)); |
|
400
|
|
|
$this->assertFalse( |
|
401
|
|
|
self::$dbMysql->isTableExist(self::$tableUser . '_not_exists') |
|
402
|
|
|
); |
|
403
|
|
|
} |
|
404
|
|
|
|
|
405
|
|
|
|
|
406
|
|
|
/** |
|
407
|
|
|
* @expectedException \PHPUnit_Framework_Error_Warning |
|
408
|
|
|
*/ |
|
409
|
|
|
public function testQuoteValue() |
|
410
|
|
|
{ |
|
411
|
|
|
// Normal test completed by other method |
|
412
|
|
|
|
|
413
|
|
|
// Quote un-exists column |
|
414
|
|
|
// Compare will not execute because exception will be caught by PHPUnit |
|
415
|
|
|
$col = 'not_exists'; |
|
416
|
|
|
$this->assertEquals( |
|
417
|
|
|
'\'' . $col . '\'', |
|
418
|
|
|
self::$dbMysql->quoteValue(self::$tableUser, $col, $col) |
|
419
|
|
|
); |
|
420
|
|
|
} |
|
421
|
|
|
|
|
422
|
|
|
|
|
423
|
|
|
/** |
|
424
|
|
|
* @expectedException \PHPUnit_Framework_Error_Warning |
|
425
|
|
|
*/ |
|
426
|
|
|
public function testWrite() |
|
427
|
|
|
{ |
|
428
|
|
|
$uuid = $this->generateUuid(); |
|
429
|
|
|
|
|
430
|
|
|
// Auto INSERT |
|
431
|
|
|
$ar = [ |
|
432
|
|
|
'uuid' => $uuid, |
|
433
|
|
|
'title' => 'Title', |
|
434
|
|
|
'age' => 42, |
|
435
|
|
|
]; |
|
436
|
|
|
self::$dbMysql->write(self::$tableUser, $ar); |
|
437
|
|
|
$this->assertEquals( |
|
438
|
|
|
'Title', |
|
439
|
|
|
self::$dbMysql->getByKey(self::$tableUser, $uuid, 'title') |
|
440
|
|
|
); |
|
441
|
|
|
|
|
442
|
|
|
// Auto UPDATE |
|
443
|
|
|
$ar['age'] = 24; |
|
444
|
|
|
self::$dbMysql->write(self::$tableUser, $ar); |
|
445
|
|
|
$this->assertEquals( |
|
446
|
|
|
24, |
|
447
|
|
|
self::$dbMysql->getByKey(self::$tableUser, $uuid, 'age') |
|
448
|
|
|
); |
|
449
|
|
|
|
|
450
|
|
|
// Write without PK, will fail |
|
451
|
|
|
unset($ar['uuid']); |
|
452
|
|
|
$this->assertEquals( |
|
453
|
|
|
-1, |
|
454
|
|
|
self::$dbMysql->write(self::$tableUser, $ar) |
|
455
|
|
|
); |
|
456
|
|
|
|
|
457
|
|
|
// For INSERT, will fail and throw exception |
|
458
|
|
|
$ar['uuid'] = $uuid; |
|
459
|
|
|
$this->assertEquals( |
|
460
|
|
|
-1, |
|
461
|
|
|
self::$dbMysql->write(self::$tableUser, $ar, 'I') |
|
462
|
|
|
); |
|
463
|
|
|
} |
|
464
|
|
|
} |
|
465
|
|
|
|
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.