Code Duplication    Length = 34-34 lines in 2 locations

eZ/Publish/Core/Persistence/Legacy/Tests/Content/Gateway/DoctrineDatabaseTest.php 2 locations

@@ 234-267 (lines=34) @@
231
    /**
232
     * @covers eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::setStatus
233
     */
234
    public function testSetStatus()
235
    {
236
        $gateway = $this->getDatabaseGateway();
237
238
        // insert content
239
        $struct = $this->getCreateStructFixture();
240
        $contentId = $gateway->insertContentObject($struct);
241
242
        // insert version
243
        $version = $this->getVersionFixture();
244
        $version->contentInfo->id = $contentId;
245
        $gateway->insertVersion($version, array());
246
247
        $this->assertTrue(
248
            $gateway->setStatus($version->contentInfo->id, $version->versionNo, VersionInfo::STATUS_PENDING)
249
        );
250
251
        $this->assertQueryResult(
252
            array(array(VersionInfo::STATUS_PENDING)),
253
            $this->getDatabaseHandler()
254
                ->createSelectQuery()
255
                ->select('status')
256
                ->from('ezcontentobject_version')
257
        );
258
259
        // check that content status has not been set to published
260
        $this->assertQueryResult(
261
            array(array(VersionInfo::STATUS_DRAFT)),
262
            $this->getDatabaseHandler()
263
                ->createSelectQuery()
264
                ->select('status')
265
                ->from('ezcontentobject')
266
        );
267
    }
268
269
    /**
270
     * @covers eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::setStatus
@@ 272-305 (lines=34) @@
269
    /**
270
     * @covers eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::setStatus
271
     */
272
    public function testSetStatusPublished()
273
    {
274
        $gateway = $this->getDatabaseGateway();
275
276
        // insert content
277
        $struct = $this->getCreateStructFixture();
278
        $contentId = $gateway->insertContentObject($struct);
279
280
        // insert version
281
        $version = $this->getVersionFixture();
282
        $version->contentInfo->id = $contentId;
283
        $gateway->insertVersion($version, array());
284
285
        $this->assertTrue(
286
            $gateway->setStatus($version->contentInfo->id, $version->versionNo, VersionInfo::STATUS_PUBLISHED)
287
        );
288
289
        $this->assertQueryResult(
290
            array(array(VersionInfo::STATUS_PUBLISHED)),
291
            $this->getDatabaseHandler()
292
                ->createSelectQuery()
293
                ->select('status')
294
                ->from('ezcontentobject_version')
295
        );
296
297
        // check that content status has been set to published
298
        $this->assertQueryResult(
299
            array(array(ContentInfo::STATUS_PUBLISHED)),
300
            $this->getDatabaseHandler()
301
                ->createSelectQuery()
302
                ->select('status')
303
                ->from('ezcontentobject')
304
        );
305
    }
306
307
    /**
308
     * @covers eZ\Publish\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase::setStatus