Completed
Push — master ( a0071b...e33605 )
by Michael
12s
created

Doctrine/Tests/ORM/Entity/ConstructorTest.php (1 issue)

Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Tests\ORM\Entity;
6
7
use Doctrine\Tests\OrmTestCase;
8
9
class ConstructorTest extends OrmTestCase
10
{
11
    public function testFieldInitializationInConstructor()
12
    {
13
        $entity = new ConstructorTestEntity1("romanb");
14
        self::assertEquals("romanb", $entity->username);
15
    }
16
}
17
18
class ConstructorTestEntity1
19
{
20
    private $id;
0 ignored issues
show
The private property $id is not used, and could be removed.
Loading history...
21
    public $username;
22
23
    public function __construct($username = null)
24
    {
25
        if ($username !== null) {
26
            $this->username = $username;
27
        }
28
    }
29
}
30