Code Duplication    Length = 25-28 lines in 2 locations

eZ/Publish/API/Repository/Tests/TrashServiceTest.php 2 locations

@@ 527-554 (lines=28) @@
524
     * @see \eZ\Publish\API\Repository\TrashService::findTrashItems()
525
     * @depends eZ\Publish\API\Repository\Tests\TrashServiceTest::testTrash
526
     */
527
    public function testFindTrashItems()
528
    {
529
        $repository = $this->getRepository();
530
        $trashService = $repository->getTrashService();
531
532
        /* BEGIN: Use Case */
533
        $this->createTrashItem();
534
535
        // Create a search query for all trashed items
536
        $query = new Query();
537
        $query->filter = new Criterion\LogicalAnd(
538
            array(
539
                new Criterion\Field('title', Criterion\Operator::LIKE, '*'),
540
            )
541
        );
542
543
        // Load all trashed locations
544
        $searchResult = $trashService->findTrashItems($query);
545
        /* END: Use Case */
546
547
        $this->assertInstanceOf(
548
            '\\eZ\\Publish\\API\\Repository\\Values\\Content\\SearchResult',
549
            $searchResult
550
        );
551
552
        // 4 trashed locations from the sub tree
553
        $this->assertEquals(4, $searchResult->count);
554
    }
555
556
    /**
557
     * Test for the emptyTrash() method.
@@ 562-586 (lines=25) @@
559
     * @see \eZ\Publish\API\Repository\TrashService::emptyTrash()
560
     * @depends eZ\Publish\API\Repository\Tests\TrashServiceTest::testFindTrashItems
561
     */
562
    public function testEmptyTrash()
563
    {
564
        $repository = $this->getRepository();
565
        $trashService = $repository->getTrashService();
566
567
        /* BEGIN: Use Case */
568
        $this->createTrashItem();
569
570
        // Empty the trash
571
        $trashService->emptyTrash();
572
573
        // Create a search query for all trashed items
574
        $query = new Query();
575
        $query->filter = new Criterion\LogicalAnd(
576
            array(
577
                new Criterion\Field('title', Criterion\Operator::LIKE, '*'),
578
            )
579
        );
580
581
        // Load all trashed locations, search result should be empty
582
        $searchResult = $trashService->findTrashItems($query);
583
        /* END: Use Case */
584
585
        $this->assertEquals(0, $searchResult->count);
586
    }
587
588
    /**
589
     * Test for the deleteTrashItem() method.