parent
338bd78e66
commit
a73a73da66
@ -436,10 +436,10 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count
|
||||
$data = array();
|
||||
|
||||
foreach ($this->getTable()->getFieldNames() as $fieldName) {
|
||||
if ( ! isset($tmp[$fieldName])) {
|
||||
$data[$fieldName] = self::$_null;
|
||||
} else {
|
||||
if (isset($tmp[$fieldName])) {
|
||||
$data[$fieldName] = $tmp[$fieldName];
|
||||
} else if (!isset($this->_data[$fieldName])) {
|
||||
$data[$fieldName] = self::$_null;
|
||||
}
|
||||
unset($tmp[$fieldName]);
|
||||
}
|
||||
|
52
tests/Ticket/576TestCase.php
Normal file
52
tests/Ticket/576TestCase.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Doctrine_Ticket_587_TestCase
|
||||
*
|
||||
* @package Doctrine
|
||||
* @author Joaquin Bravo <jackbravo@gmail.com>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @category Object Relational Mapping
|
||||
* @link www.phpdoctrine.com
|
||||
* @since 1.0
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
class Doctrine_Ticket_576_TestCase extends Doctrine_UnitTestCase
|
||||
{
|
||||
public function prepareTables()
|
||||
{
|
||||
$this->tables = array('Entity');
|
||||
parent::prepareTables();
|
||||
}
|
||||
|
||||
public function prepareData() { }
|
||||
|
||||
public function testInit()
|
||||
{
|
||||
$entity = new Entity();
|
||||
$entity->name = 'myname';
|
||||
$entity->loginname = 'test';
|
||||
$entity->save();
|
||||
}
|
||||
|
||||
public function testBug()
|
||||
{
|
||||
// load our user and our collection of pages
|
||||
$user = Doctrine_Query::create()->from('Entity')->fetchOne();
|
||||
$this->assertEqual($user->name, 'myname');
|
||||
$this->assertEqual($user->loginname, 'test');
|
||||
|
||||
$user->name = null;
|
||||
$this->assertEqual($user->name, null);
|
||||
|
||||
$data = Doctrine_Query::create()
|
||||
->select('name')
|
||||
->from('Entity')
|
||||
->fetchOne(array(), Doctrine::FETCH_ARRAY);
|
||||
|
||||
$user->hydrate($data);
|
||||
$this->assertEqual($user->name, 'myname');
|
||||
$this->assertEqual($user->loginname, 'test'); // <<----- this is what the bug is about
|
||||
}
|
||||
}
|
39
tests/Ticket/583TestCase.php
Normal file
39
tests/Ticket/583TestCase.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Doctrine_Ticket_587_TestCase
|
||||
*
|
||||
* @package Doctrine
|
||||
* @author Joaquin Bravo <jackbravo@gmail.com>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @category Object Relational Mapping
|
||||
* @link www.phpdoctrine.com
|
||||
* @since 1.0
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
class Doctrine_Ticket_583_TestCase extends Doctrine_UnitTestCase
|
||||
{
|
||||
public function prepareTables()
|
||||
{
|
||||
$this->tables = array('Entity');
|
||||
parent::prepareTables();
|
||||
}
|
||||
|
||||
public function prepareData() { }
|
||||
|
||||
public function testBug()
|
||||
{
|
||||
$entity = new Entity();
|
||||
$entity->name = 'myname';
|
||||
$entity->save();
|
||||
|
||||
// load our user and our collection of pages
|
||||
$user = Doctrine_Query::create()->select('id')->from('Entity')->fetchOne();
|
||||
$this->assertEqual($user->name, 'myname');
|
||||
|
||||
// load our user and our collection of pages
|
||||
$user = Doctrine_Query::create()->select('*')->from('Entity')->fetchOne();
|
||||
$this->assertEqual($user->name, 'myname');
|
||||
}
|
||||
}
|
@ -15,6 +15,8 @@ $tickets->addTestCase(new Doctrine_Ticket_Njero_TestCase());
|
||||
$tickets->addTestCase(new Doctrine_Ticket_428_TestCase());
|
||||
$tickets->addTestCase(new Doctrine_Ticket_480_TestCase());
|
||||
$tickets->addTestCase(new Doctrine_Ticket_587_TestCase());
|
||||
$tickets->addTestCase(new Doctrine_Ticket_576_TestCase());
|
||||
$tickets->addTestCase(new Doctrine_Ticket_583_TestCase());
|
||||
//If you write a ticket testcase add it here like shown above!
|
||||
$test->addTestCase($tickets);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user