forked from lox/pheasant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDomainObjectSequenceTest.php
44 lines (34 loc) · 1011 Bytes
/
DomainObjectSequenceTest.php
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
<?php
namespace Pheasant\Tests;
use \Pheasant\Types\SequenceType;
use \Pheasant\Types\StringType;
use \Pheasant\Tests\Examples\Person;
class DomainObjectSequenceTest extends \Pheasant\Tests\MysqlTestCase
{
public function setUp()
{
parent::setUp();
$table = $this->table('person', array(
'personid' => new SequenceType(),
'name' => new StringType(),
));
}
public function testSequencePrimaryKey()
{
$person = new Person();
$person->save();
$this->assertEquals(1, $person->personid);
$person->name = "Frank";
$person->save();
$this->assertEquals(1, $person->personid);
$this->assertEquals("Frank", $person->name);
}
public function testSequenceFaileWhenManuallySet()
{
$person = new Person();
$person->personid = 24;
$person->save();
// FIXME: is this desired behaviour?
$this->assertEquals(1, $person->personid);
}
}