File: DefaultTimeExpressionTest.php

package info (click to toggle)
doctrine 3.5.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,536 kB
  • sloc: php: 109,324; xml: 1,340; makefile: 35
file content (43 lines) | stat: -rw-r--r-- 1,076 bytes parent folder | download
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
<?php

declare(strict_types=1);

namespace Doctrine\Tests\ORM\Functional;

use DateTime;
use DateTimeImmutable;
use Doctrine\Deprecations\PHPUnit\VerifyDeprecations;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Tests\OrmFunctionalTestCase;

class DefaultTimeExpressionTest extends OrmFunctionalTestCase
{
    use VerifyDeprecations;

    public function testUsingTimeRelatedDefaultExpressionCausesNoDbalDeprecation(): void
    {
        $this->expectNoDeprecationWithIdentifier('https://github.com/doctrine/dbal/pull/7195');

        $this->createSchemaForModels(TimeEntity::class);
    }
}

#[ORM\Entity]
class TimeEntity
{
    #[ORM\Id]
    #[ORM\Column]
    public int $id;

    #[ORM\Column(options: ['default' => 'CURRENT_TIMESTAMP'])]
    public DateTime $createdAt;

    #[ORM\Column(options: ['default' => 'CURRENT_TIMESTAMP'])]
    public DateTimeImmutable $createdAtImmutable;

    #[ORM\Column(options: ['default' => 'CURRENT_TIME'])]
    public DateTime $createdTime;

    #[ORM\Column(options: ['default' => 'CURRENT_DATE'])]
    public DateTime $createdDate;
}