Code Duplication    Length = 25-28 lines in 2 locations

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

@@ 526-553 (lines=28) @@
523
     * @see \eZ\Publish\API\Repository\TrashService::findTrashItems()
524
     * @depends eZ\Publish\API\Repository\Tests\TrashServiceTest::testTrash
525
     */
526
    public function testFindTrashItems()
527
    {
528
        $repository = $this->getRepository();
529
        $trashService = $repository->getTrashService();
530
531
        /* BEGIN: Use Case */
532
        $this->createTrashItem();
533
534
        // Create a search query for all trashed items
535
        $query = new Query();
536
        $query->filter = new Criterion\LogicalAnd(
537
            array(
538
                new Criterion\Field('title', Criterion\Operator::LIKE, '*'),
539
            )
540
        );
541
542
        // Load all trashed locations
543
        $searchResult = $trashService->findTrashItems($query);
544
        /* END: Use Case */
545
546
        $this->assertInstanceOf(
547
            '\\eZ\\Publish\\API\\Repository\\Values\\Content\\SearchResult',
548
            $searchResult
549
        );
550
551
        // 4 trashed locations from the sub tree
552
        $this->assertEquals(4, $searchResult->count);
553
    }
554
555
    /**
556
     * Test for the findTrashItems() method.
@@ 602-626 (lines=25) @@
599
     * @see \eZ\Publish\API\Repository\TrashService::emptyTrash()
600
     * @depends eZ\Publish\API\Repository\Tests\TrashServiceTest::testFindTrashItems
601
     */
602
    public function testEmptyTrash()
603
    {
604
        $repository = $this->getRepository();
605
        $trashService = $repository->getTrashService();
606
607
        /* BEGIN: Use Case */
608
        $this->createTrashItem();
609
610
        // Empty the trash
611
        $trashService->emptyTrash();
612
613
        // Create a search query for all trashed items
614
        $query = new Query();
615
        $query->filter = new Criterion\LogicalAnd(
616
            array(
617
                new Criterion\Field('title', Criterion\Operator::LIKE, '*'),
618
            )
619
        );
620
621
        // Load all trashed locations, search result should be empty
622
        $searchResult = $trashService->findTrashItems($query);
623
        /* END: Use Case */
624
625
        $this->assertEquals(0, $searchResult->count);
626
    }
627
628
    /**
629
     * Test for the deleteTrashItem() method.