Code Duplication    Length = 29-29 lines in 2 locations

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

@@ 90-118 (lines=29) @@
87
        $this->assertNull($this->_em->find(Group::class, $g2Id));
88
    }
89
90
    public function testRemoveItem()
91
    {
92
        $user   = $this->user;
93
        $u1Id   = $user->id;
94
        $user   = $this->_em->find(User::class, $u1Id);
95
96
        $this->assertInstanceOf(User::class, $user);
97
        $this->assertEquals('FabioBatSilva', $user->name);
98
        $this->assertEquals($u1Id, $user->id);
99
100
        $this->assertCount(2, $user->groups);
101
        $this->assertInstanceOf(Group::class, $user->getGroups()->get(0));
102
        $this->assertInstanceOf(Group::class, $user->getGroups()->get(1));
103
104
        $user->getGroups()->remove(0);
105
106
        // Update
107
        $this->_em->persist($user);
108
        $this->_em->flush();
109
        $this->_em->clear();
110
111
        $user = $this->_em->find(User::class, $u1Id);
112
113
        $this->assertInstanceOf(User::class, $user);
114
        $this->assertEquals('FabioBatSilva', $user->name);
115
        $this->assertEquals($u1Id, $user->id);
116
117
        $this->assertCount(1, $user->getGroups());
118
    }
119
120
    public function testClearAll()
121
    {
@@ 120-148 (lines=29) @@
117
        $this->assertCount(1, $user->getGroups());
118
    }
119
120
    public function testClearAll()
121
    {
122
        $user   = $this->user;
123
        $u1Id   = $user->id;
124
        $user   = $this->_em->find(User::class, $u1Id);
125
126
        $this->assertInstanceOf(User::class, $user);
127
        $this->assertEquals('FabioBatSilva', $user->name);
128
        $this->assertEquals($u1Id, $user->id);
129
130
        $this->assertCount(2, $user->groups);
131
        $this->assertInstanceOf(Group::class, $user->getGroups()->get(0));
132
        $this->assertInstanceOf(Group::class, $user->getGroups()->get(1));
133
134
        $user->getGroups()->clear();
135
136
        // Update
137
        $this->_em->persist($user);
138
        $this->_em->flush();
139
        $this->_em->clear();
140
141
        $user = $this->_em->find(User::class, $u1Id);
142
143
        $this->assertInstanceOf(User::class, $user);
144
        $this->assertEquals('FabioBatSilva', $user->name);
145
        $this->assertEquals($u1Id, $user->id);
146
147
        $this->assertCount(0, $user->getGroups());
148
    }
149
150
    public function testCountExtraLazy()
151
    {