Code Duplication    Length = 18-18 lines in 2 locations

tests/Doctrine/Tests/ORM/Functional/Ticket/GH6029Test.php 2 locations

@@ 35-52 (lines=18) @@
32
     *
33
     * @group 6029
34
     */
35
    public function testManyToManyAssociation() : void
36
    {
37
        $user = new GH6029User();
38
        $user->groups->add(new GH6029Group2());
39
40
        $this->expectException(ORMInvalidArgumentException::class);
41
        $this->expectExceptionMessage(
42
            sprintf(
43
                'Expected value of type "%s" for association field "%s#$groups", got "%s" instead.',
44
                GH6029Group::class,
45
                GH6029User::class,
46
                GH6029Group2::class
47
            )
48
        );
49
50
        $this->_em->persist($user);
51
        $this->_em->flush();
52
    }
53
54
    /**
55
     * Verifies that when wrong entity is persisted via relationship field, the error message does not correctly state
@@ 60-77 (lines=18) @@
57
     *
58
     * @group 6029
59
     */
60
    public function testOneToManyAssociation() : void
61
    {
62
        $product = new GH6029Product();
63
        $product->features->add(new GH6029Group2());
64
65
        $this->expectException(ORMInvalidArgumentException::class);
66
        $this->expectExceptionMessage(
67
            sprintf(
68
                'Expected value of type "%s" for association field "%s#$features", got "%s" instead.',
69
                GH6029Feature::class,
70
                GH6029Product::class,
71
                GH6029Group2::class
72
            )
73
        );
74
75
        $this->_em->persist($product);
76
        $this->_em->flush();
77
    }
78
}
79
80
/** @Entity */