File: GH7717Test.php

package info (click to toggle)
doctrine 3.5.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,556 kB
  • sloc: php: 108,620; xml: 1,340; makefile: 35; sh: 14
file content (42 lines) | stat: -rwxr-xr-x 1,271 bytes parent folder | download | duplicates (2)
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
<?php

declare(strict_types=1);

namespace Doctrine\Tests\ORM\Functional\Ticket;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Criteria;
use Doctrine\Tests\Models\GH7717\GH7717Child;
use Doctrine\Tests\Models\GH7717\GH7717Parent;
use Doctrine\Tests\OrmFunctionalTestCase;

final class GH7717Test extends OrmFunctionalTestCase
{
    public function setUp(): void
    {
        parent::setUp();

        $this->createSchemaForModels(
            GH7717Parent::class,
            GH7717Child::class,
        );
    }

    public function testManyToManyPersisterIsNullComparison(): void
    {
        $childWithNullProperty                      = new GH7717Child();
        $childWithoutNullProperty                   = new GH7717Child();
        $childWithoutNullProperty->nullableProperty = 'nope';

        $parent           = new GH7717Parent();
        $parent->children = new ArrayCollection([$childWithNullProperty, $childWithoutNullProperty]);

        $this->_em->persist($parent);
        $this->_em->flush();
        $this->_em->clear();

        $parent = $this->_em->find(GH7717Parent::class, 1);

        $this->assertCount(1, $parent->children->matching(new Criteria(Criteria::expr()->isNull('nullableProperty'))));
    }
}