| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
class Doctrine_Ticket_932_TestCase extends Doctrine_UnitTestCase |
|---|
| 4 |
{ |
|---|
| 5 |
public function prepareTables() |
|---|
| 6 |
{ |
|---|
| 7 |
$this->tables[] = "UserNoAutoIncrement"; |
|---|
| 8 |
parent::prepareTables(); |
|---|
| 9 |
} |
|---|
| 10 |
|
|---|
| 11 |
public function prepareData() |
|---|
| 12 |
{ |
|---|
| 13 |
} |
|---|
| 14 |
|
|---|
| 15 |
public function testInit() |
|---|
| 16 |
{ |
|---|
| 17 |
$this->dbh = new Doctrine_Adapter_Mock('pgsql'); |
|---|
| 18 |
$this->conn = Doctrine_Manager::getInstance()->openConnection($this->dbh); |
|---|
| 19 |
} |
|---|
| 20 |
|
|---|
| 21 |
public function testCreateNewUserNoAutoIncrement() |
|---|
| 22 |
{ |
|---|
| 23 |
$newUser = new UserNoAutoIncrement(); |
|---|
| 24 |
$newUser->id = 1; |
|---|
| 25 |
$newUser->display_name = "Mah Name"; |
|---|
| 26 |
$newUser->save(); |
|---|
| 27 |
} |
|---|
| 28 |
} |
|---|
| 29 |
|
|---|
| 30 |
class UserNoAutoIncrement extends Doctrine_Record |
|---|
| 31 |
{ |
|---|
| 32 |
public function setTableDefinition() |
|---|
| 33 |
{ |
|---|
| 34 |
$this->hasColumn('id', 'integer', 4, array('primary' => true, 'autoincrement' => false, 'notnull' => true)); |
|---|
| 35 |
$this->hasColumn('display_name', 'string', 255, array('notnull' => true)); |
|---|
| 36 |
} |
|---|
| 37 |
} |
|---|
| 38 |
|
|---|