2006-10-24 12:56:47 +04:00
|
|
|
<?php
|
|
|
|
class Doctrine_Query_Update_TestCase extends Doctrine_UnitTestCase {
|
|
|
|
public function testUpdateAllWithColumnAggregationInheritance() {
|
|
|
|
$q = new Doctrine_Query();
|
|
|
|
|
|
|
|
$q->parseQuery("UPDATE User u SET u.name = 'someone'");
|
|
|
|
|
2006-12-22 01:06:08 +03:00
|
|
|
$this->assertEqual($q->getQuery(), "UPDATE entity e SET e.name = 'someone' WHERE (e.type = 0)");
|
2006-10-24 12:56:47 +04:00
|
|
|
|
|
|
|
$q = new Doctrine_Query();
|
|
|
|
|
2006-12-22 01:06:08 +03:00
|
|
|
$q->update('User u')->set('u.name', "'someone'");
|
2006-10-24 12:56:47 +04:00
|
|
|
|
2006-12-22 01:06:08 +03:00
|
|
|
$this->assertEqual($q->getQuery(), "UPDATE entity e SET e.name = 'someone' WHERE (e.type = 0)");
|
|
|
|
}
|
|
|
|
public function testUpdateWorksWithMultipleColumns() {
|
|
|
|
$q = new Doctrine_Query();
|
|
|
|
|
|
|
|
$q->parseQuery("UPDATE User u SET u.name = 'someone', u.email_id = 5");
|
|
|
|
|
|
|
|
$this->assertEqual($q->getQuery(), "UPDATE entity e SET e.name = 'someone', e.email_id = 5 WHERE (e.type = 0)");
|
|
|
|
|
|
|
|
$q = new Doctrine_Query();
|
|
|
|
|
|
|
|
$q->update('User u')->set('u.name', "'someone'")->set('u.email_id', 5);
|
|
|
|
|
|
|
|
$this->assertEqual($q->getQuery(), "UPDATE entity e SET e.name = 'someone', e.email_id = 5 WHERE (e.type = 0)");
|
2006-10-24 12:56:47 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|