1
0
mirror of synced 2024-12-13 06:46:03 +03:00
doctrine2/tests/AccessTestCase.php

57 lines
1.6 KiB
PHP
Raw Normal View History

2006-04-14 00:37:28 +04:00
<?php
class Doctrine_AccessTestCase extends Doctrine_UnitTestCase {
public function prepareData() { }
2006-04-14 00:37:28 +04:00
public function testOffsetMethods() {
$user = new User();
$this->assertEqual($user["name"],null);
2006-04-14 00:37:28 +04:00
$user["name"] = "Jack";
$this->assertEqual($user["name"],"Jack");
$user->save();
2006-04-14 00:37:28 +04:00
$user = $this->session->getTable("User")->find($user->getID());
$this->assertEqual($user->name,"Jack");
$user["name"] = "Jack";
$this->assertEqual($user["name"],"Jack");
$user["name"] = "zYne";
$this->assertEqual($user["name"],"zYne");
2006-04-14 00:37:28 +04:00
}
public function testOverload() {
$user = new User();
$this->assertEqual($user->name,null);
$user->name = "Jack";
2006-04-14 00:37:28 +04:00
$this->assertEqual($user->name,"Jack");
$user->save();
2006-04-14 00:37:28 +04:00
$user = $this->session->getTable("User")->find($user->getID());
$this->assertEqual($user->name,"Jack");
2006-04-14 00:37:28 +04:00
$user->name = "Jack";
$this->assertEqual($user->name,"Jack");
$user->name = "zYne";
$this->assertEqual($user->name,"zYne");
2006-04-14 00:37:28 +04:00
}
public function testSet() {
$user = new User();
$this->assertEqual($user->get("name"),null);
2006-04-14 00:37:28 +04:00
$user->set("name","Jack");
$this->assertEqual($user->get("name"),"Jack");
2006-04-14 00:37:28 +04:00
$user->save();
2006-04-14 00:37:28 +04:00
$user = $this->session->getTable("User")->find($user->getID());
$this->assertEqual($user->get("name"),"Jack");
$user->set("name","Jack");
$this->assertEqual($user->get("name"),"Jack");
2006-04-14 00:37:28 +04:00
}
}
?>