|
@@ 253-267 (lines=15) @@
|
| 250 |
|
* |
| 251 |
|
* @return void |
| 252 |
|
*/ |
| 253 |
|
public function testAutoSaveUuid() { |
| 254 |
|
// SQLite does not support non-integer primary keys |
| 255 |
|
$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with SQLite.'); |
| 256 |
|
|
| 257 |
|
$this->loadFixtures('Uuid'); |
| 258 |
|
$TestModel = new Uuid(); |
| 259 |
|
|
| 260 |
|
$TestModel->save(array('title' => 'Test record')); |
| 261 |
|
$result = $TestModel->findByTitle('Test record'); |
| 262 |
|
$this->assertEquals( |
| 263 |
|
array('id', 'title', 'count', 'created', 'updated'), |
| 264 |
|
array_keys($result['Uuid']) |
| 265 |
|
); |
| 266 |
|
$this->assertEquals(36, strlen($result['Uuid']['id'])); |
| 267 |
|
} |
| 268 |
|
|
| 269 |
|
/** |
| 270 |
|
* Ensure that if the id key is null but present the save doesn't fail (with an |
|
@@ 275-289 (lines=15) @@
|
| 272 |
|
* |
| 273 |
|
* @return void |
| 274 |
|
*/ |
| 275 |
|
public function testSaveUuidNull() { |
| 276 |
|
// SQLite does not support non-integer primary keys |
| 277 |
|
$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with SQLite.'); |
| 278 |
|
|
| 279 |
|
$this->loadFixtures('Uuid'); |
| 280 |
|
$TestModel = new Uuid(); |
| 281 |
|
|
| 282 |
|
$TestModel->save(array('title' => 'Test record', 'id' => null)); |
| 283 |
|
$result = $TestModel->findByTitle('Test record'); |
| 284 |
|
$this->assertEquals( |
| 285 |
|
array('id', 'title', 'count', 'created', 'updated'), |
| 286 |
|
array_keys($result['Uuid']) |
| 287 |
|
); |
| 288 |
|
$this->assertEquals(36, strlen($result['Uuid']['id'])); |
| 289 |
|
} |
| 290 |
|
|
| 291 |
|
/** |
| 292 |
|
* testZeroDefaultFieldValue method |