Code Duplication    Length = 25-28 lines in 2 locations

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

@@ 626-653 (lines=28) @@
623
     * @see \eZ\Publish\API\Repository\TrashService::findTrashItems()
624
     * @depends eZ\Publish\API\Repository\Tests\TrashServiceTest::testTrash
625
     */
626
    public function testFindTrashItems()
627
    {
628
        $repository = $this->getRepository();
629
        $trashService = $repository->getTrashService();
630
631
        /* BEGIN: Use Case */
632
        $this->createTrashItem();
633
634
        // Create a search query for all trashed items
635
        $query = new Query();
636
        $query->filter = new Criterion\LogicalAnd(
637
            array(
638
                new Criterion\Field('title', Criterion\Operator::LIKE, '*'),
639
            )
640
        );
641
642
        // Load all trashed locations
643
        $searchResult = $trashService->findTrashItems($query);
644
        /* END: Use Case */
645
646
        $this->assertInstanceOf(
647
            '\\eZ\\Publish\\API\\Repository\\Values\\Content\\SearchResult',
648
            $searchResult
649
        );
650
651
        // 4 trashed locations from the sub tree
652
        $this->assertEquals(4, $searchResult->count);
653
    }
654
655
    /**
656
     * Test for the emptyTrash() method.
@@ 661-685 (lines=25) @@
658
     * @see \eZ\Publish\API\Repository\TrashService::emptyTrash()
659
     * @depends eZ\Publish\API\Repository\Tests\TrashServiceTest::testFindTrashItems
660
     */
661
    public function testEmptyTrash()
662
    {
663
        $repository = $this->getRepository();
664
        $trashService = $repository->getTrashService();
665
666
        /* BEGIN: Use Case */
667
        $this->createTrashItem();
668
669
        // Empty the trash
670
        $trashService->emptyTrash();
671
672
        // Create a search query for all trashed items
673
        $query = new Query();
674
        $query->filter = new Criterion\LogicalAnd(
675
            array(
676
                new Criterion\Field('title', Criterion\Operator::LIKE, '*'),
677
            )
678
        );
679
680
        // Load all trashed locations, search result should be empty
681
        $searchResult = $trashService->findTrashItems($query);
682
        /* END: Use Case */
683
684
        $this->assertEquals(0, $searchResult->count);
685
    }
686
687
    /**
688
     * Test for the deleteTrashItem() method.