-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
Copy pathDBAL483Test.php
56 lines (42 loc) · 1.22 KB
/
DBAL483Test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
declare(strict_types=1);
namespace Doctrine\Tests\ORM\Functional\SchemaTool;
use Doctrine\ORM\Annotation as ORM;
use Doctrine\ORM\Tools;
use Doctrine\Tests\OrmFunctionalTestCase;
use function array_filter;
use function strpos;
class DBAL483Test extends OrmFunctionalTestCase
{
public function setUp() : void
{
parent::setUp();
$this->em->getConnection();
$this->schemaTool = new Tools\SchemaTool($this->em);
}
/**
* @group DBAL-483
*/
public function testDefaultValueIsComparedCorrectly() : void
{
$class = $this->em->getClassMetadata(DBAL483Default::class);
$this->schemaTool->createSchema([$class]);
$updateSql = $this->schemaTool->getUpdateSchemaSql([$class]);
$updateSql = array_filter($updateSql, function ($sql) {
return strpos($sql, 'DBAL483') !== false;
});
self::assertCount(0, $updateSql);
}
}
/**
* @ORM\Entity
*/
class DBAL483Default
{
/** @ORM\Id @ORM\Column(type="integer") @ORM\GeneratedValue */
public $id;
/** @ORM\Column(type="integer", options={"default": 0}) */
public $num;
/** @ORM\Column(type="string", options={"default": "foo"}) */
public $str = 'foo';
}