2009-01-22 22:38:10 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\ORM\Entity;
|
|
|
|
|
2009-01-24 19:56:44 +03:00
|
|
|
require_once __DIR__ . '/../../TestInit.php';
|
2011-12-20 01:56:19 +04:00
|
|
|
|
2009-01-22 22:38:10 +03:00
|
|
|
class ConstructorTest extends \Doctrine\Tests\OrmTestCase
|
|
|
|
{
|
|
|
|
public function testFieldInitializationInConstructor()
|
|
|
|
{
|
|
|
|
$entity = new ConstructorTestEntity1("romanb");
|
2011-12-20 01:56:19 +04:00
|
|
|
$this->assertEquals("romanb", $entity->username);
|
2009-01-22 22:38:10 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class ConstructorTestEntity1
|
|
|
|
{
|
|
|
|
private $id;
|
|
|
|
public $username;
|
|
|
|
|
|
|
|
public function __construct($username = null)
|
|
|
|
{
|
|
|
|
if ($username !== null) {
|
|
|
|
$this->username = $username;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|