Code Duplication    Length = 32-32 lines in 2 locations

eZ/Publish/Core/Persistence/Legacy/Tests/Notification/HandlerTest.php 1 location

@@ 180-211 (lines=32) @@
177
    /**
178
     * @covers \eZ\Publish\Core\Persistence\Legacy\Notification\Handler::loadUserNotifications
179
     */
180
    public function testLoadUserNotifications()
181
    {
182
        $ownerId = 9;
183
        $limit = 5;
184
        $offset = 0;
185
186
        $rows = [
187
            ['id' => 1/* ... */],
188
            ['id' => 2/* ... */],
189
            ['id' => 3/* ... */],
190
        ];
191
192
        $objects = [
193
            new Notification(['id' => 1/* ... */]),
194
            new Notification(['id' => 2/* ... */]),
195
            new Notification(['id' => 3/* ... */]),
196
        ];
197
198
        $this->gateway
199
            ->expects($this->once())
200
            ->method('loadUserNotifications')
201
            ->with($ownerId, $offset, $limit)
202
            ->willReturn($rows);
203
204
        $this->mapper
205
            ->expects($this->once())
206
            ->method('extractNotificationsFromRows')
207
            ->with($rows)
208
            ->willReturn($objects);
209
210
        $this->assertEquals($objects, $this->handler->loadUserNotifications($ownerId, $offset, $limit));
211
    }
212
213
    public function testDelete()
214
    {

eZ/Publish/Core/Persistence/Legacy/Tests/UserPreference/HandlerTest.php 1 location

@@ 93-124 (lines=32) @@
90
    /**
91
     * @covers \eZ\Publish\Core\Persistence\Legacy\UserPreference\Handler::loadUserPreferences
92
     */
93
    public function testLoadUserPreferences()
94
    {
95
        $ownerId = 9;
96
        $limit = 5;
97
        $offset = 0;
98
99
        $rows = [
100
            ['id' => 1/* ... */],
101
            ['id' => 2/* ... */],
102
            ['id' => 3/* ... */],
103
        ];
104
105
        $objects = [
106
            new UserPreference(['id' => 1/* ... */]),
107
            new UserPreference(['id' => 2/* ... */]),
108
            new UserPreference(['id' => 3/* ... */]),
109
        ];
110
111
        $this->gateway
112
            ->expects($this->once())
113
            ->method('loadUserPreferences')
114
            ->with($ownerId, $offset, $limit)
115
            ->willReturn($rows);
116
117
        $this->mapper
118
            ->expects($this->once())
119
            ->method('extractUserPreferencesFromRows')
120
            ->with($rows)
121
            ->willReturn($objects);
122
123
        $this->assertEquals($objects, $this->handler->loadUserPreferences($ownerId, $offset, $limit));
124
    }
125
}
126