Commit 7c7645f8 authored by zYne's avatar zYne

--no commit message

--no commit message
parent e60c34c7
...@@ -30,11 +30,38 @@ ...@@ -30,11 +30,38 @@
* @since 1.0 * @since 1.0
* @version $Revision$ * @version $Revision$
*/ */
class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase { class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase
public function prepareTables() { } {
public function prepareTables()
{
$this->tables = array('Entity');
parent::prepareTables();
}
public function prepareData() { } public function prepareData() { }
public function testAssignUnknownState() { public function testAssignFieldsToProxies()
{
$user = new User();
$user->name = 'someuser';
$user->password = '123';
$user->save();
$this->connection->clear();
$user = $this->connection->queryOne("SELECT u.name FROM User u WHERE u.name = 'someuser'");
$this->assertEqual($user->name, 'someuser');
$user->name = 'someother';
$this->assertEqual($user->name, 'someother');
$user->save();
$this->assertEqual($user->name, 'someother');
}
public function testAssignUnknownState()
{
$user = new User(); $user = new User();
try { try {
$user->state(123123); $user->state(123123);
...@@ -52,7 +79,8 @@ class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase { ...@@ -52,7 +79,8 @@ class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($user->state(), Doctrine_Record::STATE_TCLEAN); $this->assertEqual($user->state(), Doctrine_Record::STATE_TCLEAN);
} }
public function testAssignDirtyState() { public function testAssignDirtyState()
{
$user = new User(); $user = new User();
$user->state(Doctrine_Record::STATE_DIRTY); $user->state(Doctrine_Record::STATE_DIRTY);
...@@ -63,7 +91,9 @@ class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase { ...@@ -63,7 +91,9 @@ class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($user->state(), Doctrine_Record::STATE_DIRTY); $this->assertEqual($user->state(), Doctrine_Record::STATE_DIRTY);
} }
public function testAssignCleanState() {
public function testAssignCleanState()
{
$user = new User(); $user = new User();
$user->state(Doctrine_Record::STATE_CLEAN); $user->state(Doctrine_Record::STATE_CLEAN);
...@@ -74,7 +104,9 @@ class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase { ...@@ -74,7 +104,9 @@ class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($user->state(), Doctrine_Record::STATE_CLEAN); $this->assertEqual($user->state(), Doctrine_Record::STATE_CLEAN);
} }
public function testAssignTransientCleanState() {
public function testAssignTransientCleanState()
{
$user = new User(); $user = new User();
$user->state(Doctrine_Record::STATE_TCLEAN); $user->state(Doctrine_Record::STATE_TCLEAN);
...@@ -85,7 +117,9 @@ class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase { ...@@ -85,7 +117,9 @@ class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($user->state(), Doctrine_Record::STATE_TCLEAN); $this->assertEqual($user->state(), Doctrine_Record::STATE_TCLEAN);
} }
public function testAssignTransientDirtyState() {
public function testAssignTransientDirtyState()
{
$user = new User(); $user = new User();
$user->state(Doctrine_Record::STATE_TDIRTY); $user->state(Doctrine_Record::STATE_TDIRTY);
...@@ -96,7 +130,9 @@ class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase { ...@@ -96,7 +130,9 @@ class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($user->state(), Doctrine_Record::STATE_TDIRTY); $this->assertEqual($user->state(), Doctrine_Record::STATE_TDIRTY);
} }
public function testAssignProxyState() {
public function testAssignProxyState()
{
$user = new User(); $user = new User();
$user->state(Doctrine_Record::STATE_PROXY); $user->state(Doctrine_Record::STATE_PROXY);
...@@ -107,6 +143,7 @@ class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase { ...@@ -107,6 +143,7 @@ class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($user->state(), Doctrine_Record::STATE_PROXY); $this->assertEqual($user->state(), Doctrine_Record::STATE_PROXY);
} }
public function testProxiesAreAutomaticallyUpdatedWithFetches() public function testProxiesAreAutomaticallyUpdatedWithFetches()
{ {
$user = new User(); $user = new User();
...@@ -130,20 +167,4 @@ class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase { ...@@ -130,20 +167,4 @@ class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($count, count($this->dbh)); $this->assertEqual($count, count($this->dbh));
} }
public function testAssignFieldsToProxies() {
$user = new User();
$user->name = 'someuser';
$user->password = '123';
$user->save();
$this->connection->clear();
$user = $this->connection->queryOne("SELECT u.name FROM User u WHERE u.name = 'someuser'");
$user->name = 'someother';
$user->save();
$this->assertEqual($user->name, 'someother');
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment